Index: /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetwork.cs
===================================================================
--- /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetwork.cs	(revision 11601)
+++ /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetwork.cs	(revision 11602)
@@ -30,5 +30,9 @@
   [Item("ProgrammableNetwork", "Abstract base class for programmable networks.")]
   [StorableClass]
-  public abstract class ProgrammableNetwork : ProgrammableNode, IProgrammableNetwork {
+  public abstract class ProgrammableNetwork : ProgrammableNode, IProgrammableNetwork, IStorableContent {
+    #region IStorableContent Members
+    public string Filename { get; set; }
+    #endregion
+
     #region Network Members
     [Storable]
Index: /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetworkCode.cs
===================================================================
--- /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetworkCode.cs	(revision 11601)
+++ /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetworkCode.cs	(revision 11602)
@@ -4,4 +4,13 @@
 using System;
 using System.Threading;
+
+#region How to use the variable store?
+// use "Vars" to access variables in the variable store (e.g. Vars.x = 5)
+// use "Vars[string]" to access variables using runtime strings (e.g. Vars["x"] = 5)
+// use "Vars.Contains(string)" to check if a variable exists
+// use "Vars.Clear()" to remove all variables
+// use "foreach (KeyValuePair<string, object> v in Vars) { ... }" to iterate over all variables
+// use "Variables" to work with IEnumerable<T> extension methods on the variable store
+#endregion
 
 namespace HeuristicLab.Networks.Programmable {
@@ -15,5 +24,10 @@
     }
 
-    protected override void MessagePort_MessageReceived(object sender, EventArgs<IMessage, CancellationToken> e) {
+    public override void Initialize() {
+      base.Initialize();
+      // implement initialization here
+    }
+
+    protected override void ProcessMessage(IMessage message, IMessagePort port, CancellationToken token) {
       // implement processing of messages here
     }
Index: /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetworkItem.cs
===================================================================
--- /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetworkItem.cs	(revision 11601)
+++ /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetworkItem.cs	(revision 11602)
@@ -24,4 +24,5 @@
 using HeuristicLab.Core.Networks;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Scripting;
 using Microsoft.CSharp;
 using System;
@@ -124,4 +125,9 @@
     public virtual bool CanChangeCode {
       get { return false; }
+    }
+    [Storable]
+    private VariableStore variableStore;
+    public VariableStore VariableStore {
+      get { return variableStore; }
     }
 
@@ -161,4 +167,5 @@
       if (original.compileErrors != null)
         compileErrors = new CompilerErrorCollection(original.compileErrors);
+      variableStore = cloner.Clone(original.variableStore);
       CompiledNetworkItem = cloner.Clone(original.compiledNetworkItem);
     }
@@ -168,4 +175,5 @@
       description = string.Empty;
       code = CodeTemplate;
+      variableStore = new VariableStore();
       Compile();
     }
@@ -175,4 +183,5 @@
       description = string.Empty;
       code = CodeTemplate;
+      variableStore = new VariableStore();
       Compile();
     }
@@ -182,4 +191,5 @@
       this.description = string.IsNullOrEmpty(description) ? string.Empty : description;
       code = CodeTemplate;
+      variableStore = new VariableStore();
       Compile();
     }
@@ -227,5 +237,9 @@
     }
     public virtual IEnumerable<Assembly> GetAssemblies() {
-      return AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic && File.Exists(a.Location));
+      var assemblies = AppDomain.CurrentDomain.GetAssemblies()
+        .Where(a => !a.IsDynamic && File.Exists(a.Location))
+        .ToList();
+      assemblies.Add(typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly);  // for dlr functionality
+      return assemblies;
     }
     #endregion
@@ -347,4 +361,14 @@
 
       protected ProgrammableNetworkItem Context { get; private set; }
+      private Variables variables;
+      protected Variables Variables {
+        get {
+          if (variables == null) variables = new Variables(Context.variableStore);
+          return variables;
+        }
+      }
+      protected dynamic Vars {
+        get { return Variables; }
+      }
 
       protected CompiledProgrammableNetworkItem(CompiledProgrammableNetworkItem original, Cloner cloner)
@@ -359,5 +383,7 @@
       }
 
-      public virtual void Initialize() { }
+      public virtual void Initialize() {
+        Variables.Clear();
+      }
 
       public override string ToString() {
Index: /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetworkItemCode.cs
===================================================================
--- /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetworkItemCode.cs	(revision 11601)
+++ /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNetworkItemCode.cs	(revision 11602)
@@ -1,4 +1,13 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+
+#region How to use the variable store?
+// use "Vars" to access variables in the variable store (e.g. Vars.x = 5)
+// use "Vars[string]" to access variables using runtime strings (e.g. Vars["x"] = 5)
+// use "Vars.Contains(string)" to check if a variable exists
+// use "Vars.Clear()" to remove all variables
+// use "foreach (KeyValuePair<string, object> v in Vars) { ... }" to iterate over all variables
+// use "Variables" to work with IEnumerable<T> extension methods on the variable store
+#endregion
 
 namespace HeuristicLab.Networks.Programmable {
@@ -11,4 +20,9 @@
       return new MyProgrammableNetworkItem(this, cloner);
     }
+
+    public override void Initialize() {
+      base.Initialize();
+      // implement initialization here
+    }
   }
 }
Index: /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNode.cs
===================================================================
--- /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNode.cs	(revision 11601)
+++ /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNode.cs	(revision 11602)
@@ -126,5 +126,8 @@
       }
 
-      protected virtual void MessagePort_MessageReceived(object sender, EventArgs<IMessage, CancellationToken> e) { }
+      private void MessagePort_MessageReceived(object sender, EventArgs<IMessage, CancellationToken> e) {
+        ProcessMessage(e.Value, (IMessagePort)sender, e.Value2);
+      }
+      protected virtual void ProcessMessage(IMessage message, IMessagePort port, CancellationToken token) { }
 
       #region Events
Index: /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNodeCode.cs
===================================================================
--- /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNodeCode.cs	(revision 11601)
+++ /branches/OptimizationNetworks/HeuristicLab.Networks/3.3/Programmable/ProgrammableNodeCode.cs	(revision 11602)
@@ -4,4 +4,13 @@
 using System;
 using System.Threading;
+
+#region How to use the variable store?
+// use "Vars" to access variables in the variable store (e.g. Vars.x = 5)
+// use "Vars[string]" to access variables using runtime strings (e.g. Vars["x"] = 5)
+// use "Vars.Contains(string)" to check if a variable exists
+// use "Vars.Clear()" to remove all variables
+// use "foreach (KeyValuePair<string, object> v in Vars) { ... }" to iterate over all variables
+// use "Variables" to work with IEnumerable<T> extension methods on the variable store
+#endregion
 
 namespace HeuristicLab.Networks.Programmable {
@@ -15,5 +24,10 @@
     }
 
-    protected override void MessagePort_MessageReceived(object sender, EventArgs<IMessage, CancellationToken> e) {
+    public override void Initialize() {
+      base.Initialize();
+      // implement initialization here
+    }
+
+    protected override void ProcessMessage(IMessage message, IMessagePort port, CancellationToken token) {
       // implement processing of messages here
     }
Index: /branches/OptimizationNetworks/HeuristicLab.Scripting.Views/3.3/ProgrammableItemView.Designer.cs
===================================================================
--- /branches/OptimizationNetworks/HeuristicLab.Scripting.Views/3.3/ProgrammableItemView.Designer.cs	(revision 11601)
+++ /branches/OptimizationNetworks/HeuristicLab.Scripting.Views/3.3/ProgrammableItemView.Designer.cs	(revision 11602)
@@ -46,5 +46,5 @@
     private void InitializeComponent() {
       this.components = new System.ComponentModel.Container();
-      this.splitContainer = new System.Windows.Forms.SplitContainer();
+      this.splitContainer2 = new System.Windows.Forms.SplitContainer();
       this.codeGroupBox = new System.Windows.Forms.GroupBox();
       this.codeEditor = new HeuristicLab.CodeEditor.CodeEditor();
@@ -61,31 +61,35 @@
       this.compilationLabel = new System.Windows.Forms.Label();
       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
-      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
-      this.splitContainer.Panel1.SuspendLayout();
-      this.splitContainer.Panel2.SuspendLayout();
-      this.splitContainer.SuspendLayout();
+      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+      this.variableStoreView = new HeuristicLab.Scripting.Views.VariableStoreView();
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
+      this.splitContainer2.Panel1.SuspendLayout();
+      this.splitContainer2.Panel2.SuspendLayout();
+      this.splitContainer2.SuspendLayout();
       this.codeGroupBox.SuspendLayout();
       this.errorsGroupBox.SuspendLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+      this.splitContainer1.Panel1.SuspendLayout();
+      this.splitContainer1.Panel2.SuspendLayout();
+      this.splitContainer1.SuspendLayout();
       this.SuspendLayout();
       // 
-      // splitContainer
-      // 
-      this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-      this.splitContainer.Location = new System.Drawing.Point(0, 33);
-      this.splitContainer.Name = "splitContainer";
-      this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
-      // 
-      // splitContainer.Panel1
-      // 
-      this.splitContainer.Panel1.Controls.Add(this.codeGroupBox);
-      // 
-      // splitContainer.Panel2
-      // 
-      this.splitContainer.Panel2.Controls.Add(this.errorsGroupBox);
-      this.splitContainer.Size = new System.Drawing.Size(486, 454);
-      this.splitContainer.SplitterDistance = 382;
-      this.splitContainer.TabIndex = 3;
+      // splitContainer2
+      // 
+      this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.splitContainer2.Location = new System.Drawing.Point(0, 0);
+      this.splitContainer2.Name = "splitContainer2";
+      this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
+      // 
+      // splitContainer2.Panel1
+      // 
+      this.splitContainer2.Panel1.Controls.Add(this.codeGroupBox);
+      // 
+      // splitContainer2.Panel2
+      // 
+      this.splitContainer2.Panel2.Controls.Add(this.errorsGroupBox);
+      this.splitContainer2.Size = new System.Drawing.Size(357, 454);
+      this.splitContainer2.SplitterDistance = 382;
+      this.splitContainer2.TabIndex = 3;
       // 
       // codeGroupBox
@@ -95,5 +99,5 @@
       this.codeGroupBox.Location = new System.Drawing.Point(0, 0);
       this.codeGroupBox.Name = "codeGroupBox";
-      this.codeGroupBox.Size = new System.Drawing.Size(486, 382);
+      this.codeGroupBox.Size = new System.Drawing.Size(357, 382);
       this.codeGroupBox.TabIndex = 0;
       this.codeGroupBox.TabStop = false;
@@ -108,5 +112,6 @@
       this.codeEditor.Name = "codeEditor";
       this.codeEditor.Prefix = "";
-      this.codeEditor.Size = new System.Drawing.Size(474, 357);
+      this.codeEditor.ReadOnly = false;
+      this.codeEditor.Size = new System.Drawing.Size(345, 357);
       this.codeEditor.Suffix = "";
       this.codeEditor.TabIndex = 0;
@@ -120,5 +125,5 @@
       this.errorsGroupBox.Location = new System.Drawing.Point(0, 0);
       this.errorsGroupBox.Name = "errorsGroupBox";
-      this.errorsGroupBox.Size = new System.Drawing.Size(486, 68);
+      this.errorsGroupBox.Size = new System.Drawing.Size(357, 68);
       this.errorsGroupBox.TabIndex = 0;
       this.errorsGroupBox.TabStop = false;
@@ -142,5 +147,5 @@
       this.errorsListView.Location = new System.Drawing.Point(6, 19);
       this.errorsListView.Name = "errorsListView";
-      this.errorsListView.Size = new System.Drawing.Size(474, 43);
+      this.errorsListView.Size = new System.Drawing.Size(345, 43);
       this.errorsListView.SmallImageList = this.imageList;
       this.errorsListView.TabIndex = 0;
@@ -200,17 +205,51 @@
       this.compilationLabel.Text = "Not compiled";
       // 
+      // splitContainer1
+      // 
+      this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.splitContainer1.Location = new System.Drawing.Point(0, 33);
+      this.splitContainer1.Name = "splitContainer1";
+      // 
+      // splitContainer1.Panel1
+      // 
+      this.splitContainer1.Panel1.Controls.Add(this.splitContainer2);
+      // 
+      // splitContainer1.Panel2
+      // 
+      this.splitContainer1.Panel2.Controls.Add(this.variableStoreView);
+      this.splitContainer1.Size = new System.Drawing.Size(486, 454);
+      this.splitContainer1.SplitterDistance = 357;
+      this.splitContainer1.TabIndex = 4;
+      // 
+      // variableStoreView
+      // 
+      this.variableStoreView.Caption = "ItemCollection View";
+      this.variableStoreView.Content = null;
+      this.variableStoreView.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.variableStoreView.Location = new System.Drawing.Point(0, 0);
+      this.variableStoreView.Name = "variableStoreView";
+      this.variableStoreView.ReadOnly = false;
+      this.variableStoreView.Size = new System.Drawing.Size(125, 454);
+      this.variableStoreView.TabIndex = 0;
+      // 
       // ProgrammableItemView
       // 
+      this.Controls.Add(this.splitContainer1);
       this.Controls.Add(this.compilationLabel);
       this.Controls.Add(this.compileButton);
-      this.Controls.Add(this.splitContainer);
       this.Name = "ProgrammableItemView";
       this.Size = new System.Drawing.Size(486, 487);
-      this.splitContainer.Panel1.ResumeLayout(false);
-      this.splitContainer.Panel2.ResumeLayout(false);
-      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
-      this.splitContainer.ResumeLayout(false);
+      this.splitContainer2.Panel1.ResumeLayout(false);
+      this.splitContainer2.Panel2.ResumeLayout(false);
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
+      this.splitContainer2.ResumeLayout(false);
       this.codeGroupBox.ResumeLayout(false);
       this.errorsGroupBox.ResumeLayout(false);
+      this.splitContainer1.Panel1.ResumeLayout(false);
+      this.splitContainer1.Panel2.ResumeLayout(false);
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+      this.splitContainer1.ResumeLayout(false);
       this.ResumeLayout(false);
       this.PerformLayout();
@@ -220,5 +259,5 @@
     #endregion
 
-    protected System.Windows.Forms.SplitContainer splitContainer;
+    protected System.Windows.Forms.SplitContainer splitContainer2;
     protected System.Windows.Forms.GroupBox errorsGroupBox;
     protected System.Windows.Forms.Button compileButton;
@@ -235,4 +274,6 @@
     protected System.Windows.Forms.GroupBox codeGroupBox;
     protected System.Windows.Forms.ToolTip toolTip;
+    protected System.Windows.Forms.SplitContainer splitContainer1;
+    protected VariableStoreView variableStoreView;
 
   }
Index: /branches/OptimizationNetworks/HeuristicLab.Scripting.Views/3.3/ProgrammableItemView.cs
===================================================================
--- /branches/OptimizationNetworks/HeuristicLab.Scripting.Views/3.3/ProgrammableItemView.cs	(revision 11601)
+++ /branches/OptimizationNetworks/HeuristicLab.Scripting.Views/3.3/ProgrammableItemView.cs	(revision 11602)
@@ -60,8 +60,10 @@
       if (Content == null) {
         codeEditor.UserCode = string.Empty;
+        variableStoreView.Content = null;
       } else {
         codeEditor.UserCode = Content.Code;
         foreach (var asm in Content.GetAssemblies())
           codeEditor.AddAssembly(asm);
+        variableStoreView.Content = Content.VariableStore;
       }
       ShowCompilationResults();
@@ -74,4 +76,5 @@
       codeEditor.Enabled = Content != null && !Locked;
       codeEditor.ReadOnly = ReadOnly || Locked || ((Content != null) && !Content.CanChangeCode);
+      variableStoreView.ReadOnly = (Content != null) && !Content.CanChangeCode;
     }
 
Index: /branches/OptimizationNetworks/HeuristicLab.Scripting/3.3/IProgrammableItem.cs
===================================================================
--- /branches/OptimizationNetworks/HeuristicLab.Scripting/3.3/IProgrammableItem.cs	(revision 11601)
+++ /branches/OptimizationNetworks/HeuristicLab.Scripting/3.3/IProgrammableItem.cs	(revision 11602)
@@ -31,4 +31,5 @@
     CompilerErrorCollection CompileErrors { get; }
     bool CanChangeCode { get; }
+    VariableStore VariableStore { get; }
 
     void Compile();
