Index: trunk/sources/HeuristicLab.Scripting/3.3/Scripts/CSharp/CSharpScript.cs
===================================================================
--- trunk/sources/HeuristicLab.Scripting/3.3/Scripts/CSharp/CSharpScript.cs	(revision 13024)
+++ trunk/sources/HeuristicLab.Scripting/3.3/Scripts/CSharp/CSharpScript.cs	(revision 13080)
@@ -23,5 +23,4 @@
 using System.Linq;
 using System.Reflection;
-using System.Threading;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -32,7 +31,6 @@
   [Creatable(CreatableAttribute.Categories.Scripts, Priority = 100)]
   [StorableClass]
-  public class CSharpScript : Script, IStorableContent {
+  public class CSharpScript : ExecutableScript, IStorableContent {
     #region Constants
-    protected const string ExecuteMethodName = "Execute";
     protected override string CodeTemplate { get { return ScriptTemplates.CSharpScriptTemplate; } }
     #endregion
@@ -40,6 +38,4 @@
     #region Fields & Properties
     private CSharpScriptBase compiledScript;
-    private Thread scriptThread;
-    private DateTime lastUpdateTime;
 
     public string Filename { get; set; }
@@ -50,17 +46,7 @@
       get { return variableStore; }
     }
-
-    [Storable]
-    private TimeSpan executionTime;
-    public TimeSpan ExecutionTime {
-      get { return executionTime; }
-      protected set {
-        executionTime = value;
-        OnExecutionTimeChanged();
-      }
-    }
     #endregion
 
-    #region Construction & Initialization
+    #region Construction & Cloning
     [StorableConstructor]
     protected CSharpScript(bool deserializing) : base(deserializing) { }
@@ -68,15 +54,12 @@
       : base(original, cloner) {
       variableStore = cloner.Clone(original.variableStore);
-      executionTime = original.executionTime;
     }
-    public CSharpScript() {
+    public CSharpScript()
+      : base() {
       variableStore = new VariableStore();
-      executionTime = TimeSpan.Zero;
-      Code = CodeTemplate;
     }
     public CSharpScript(string code)
       : base(code) {
       variableStore = new VariableStore();
-      executionTime = TimeSpan.Zero;
     }
 
@@ -97,5 +80,4 @@
 
     #region Compilation
-
     public override Assembly Compile() {
       DeregisterScriptEvents();
@@ -109,58 +91,12 @@
     #endregion
 
-    public virtual void ExecuteAsync() {
+    protected override void ExecuteCode() {
       if (compiledScript == null) return;
-      executionTime = TimeSpan.Zero;
-      scriptThread = new Thread(() => {
-        Exception ex = null;
-        var timer = new System.Timers.Timer(250) { AutoReset = true };
-        timer.Elapsed += timer_Elapsed;
-        try {
-          OnScriptExecutionStarted();
-          lastUpdateTime = DateTime.UtcNow;
-          timer.Start();
-          compiledScript.Execute(VariableStore);
-        } catch (Exception e) {
-          ex = e;
-        } finally {
-          scriptThread = null;
-          timer.Elapsed -= timer_Elapsed;
-          timer.Stop();
-          ExecutionTime += DateTime.UtcNow - lastUpdateTime;
-          OnScriptExecutionFinished(ex);
-        }
-      });
-      scriptThread.SetApartmentState(ApartmentState.STA);
-      scriptThread.Start();
-    }
 
-    public virtual void Kill() {
-      if (scriptThread == null) return;
-      scriptThread.Abort();
-    }
-
-    private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
-      var timer = (System.Timers.Timer)sender;
-      timer.Enabled = false;
-      DateTime now = DateTime.UtcNow;
-      ExecutionTime += now - lastUpdateTime;
-      lastUpdateTime = now;
-      timer.Enabled = true;
+      compiledScript.Execute(VariableStore);
     }
 
     protected virtual void CompiledScriptOnConsoleOutputChanged(object sender, EventArgs<string> e) {
       OnConsoleOutputChanged(e.Value);
-    }
-
-    public event EventHandler ScriptExecutionStarted;
-    protected virtual void OnScriptExecutionStarted() {
-      var handler = ScriptExecutionStarted;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-
-    public event EventHandler<EventArgs<Exception>> ScriptExecutionFinished;
-    protected virtual void OnScriptExecutionFinished(Exception e) {
-      var handler = ScriptExecutionFinished;
-      if (handler != null) handler(this, new EventArgs<Exception>(e));
     }
 
@@ -170,10 +106,4 @@
       if (handler != null) handler(this, new EventArgs<string>(args));
     }
-
-    public event EventHandler ExecutionTimeChanged;
-    protected virtual void OnExecutionTimeChanged() {
-      var handler = ExecutionTimeChanged;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
   }
 }
