Changeset 10891 for stable/HeuristicLab.HLScript/3.3/Script.cs
- Timestamp:
- 05/26/14 16:38:08 (11 years ago)
- Location:
- stable
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/branches/HLScript (added) merged: 10331-10332,10358 /trunk/sources merged: 10359,10391,10401,10506
- Property svn:mergeinfo changed
-
stable/HeuristicLab.HLScript/3.3
-
Property
svn:global-ignores
set to
bin
obj
Plugin.cs
-
Property
svn:global-ignores
set to
-
stable/HeuristicLab.HLScript/3.3/Script.cs
r10401 r10891 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.CodeDom; 3 24 using System.CodeDom.Compiler; … … 16 37 using Microsoft.CSharp; 17 38 18 namespace HeuristicLab. HLScript{19 [Item("Script", "A HeuristicLabscript.")]39 namespace HeuristicLab.Scripting { 40 [Item("Script", "An empty C# script.")] 20 41 [Creatable("Scripts")] 21 42 [StorableClass] … … 27 48 28 49 using System; 29 30 namespace UserScripts { 31 public class UserScript : HeuristicLab.HLScript.UserScriptBase { 32 public override void Main() { 33 // type your code here 34 } 35 36 // further classes and methods37 50 using System.Linq; 51 using System.Collections.Generic; 52 using HeuristicLab.Common; 53 using HeuristicLab.Core; 54 using HeuristicLab.Data; 55 56 public class UserScript : HeuristicLab.Scripting.UserScriptBase { 57 public override void Main() { 58 // type your code here 38 59 } 60 61 // further classes and methods 62 39 63 }"; 40 64 #endregion … … 126 150 GenerateExecutable = false, 127 151 GenerateInMemory = true, 128 IncludeDebugInformation = false 152 IncludeDebugInformation = true, 153 WarningLevel = 4 129 154 }; 130 155 parameters.ReferencedAssemblies.AddRange( … … 212 237 if (executeMethod != null) { 213 238 scriptThread = new Thread(() => { 239 Exception ex = null; 214 240 try { 215 241 OnScriptExecutionStarted(); 216 242 executeMethod.Invoke(compiledScript, new[] { VariableStore }); 243 } catch (ThreadAbortException) { 244 // the execution was cancelled by the user 245 } catch (TargetInvocationException e) { 246 ex = e.InnerException; 217 247 } finally { 218 OnScriptExecutionFinished( );248 OnScriptExecutionFinished(ex); 219 249 } 220 250 }); … … 250 280 } 251 281 252 public event EventHandler ScriptExecutionFinished;253 private void OnScriptExecutionFinished( ) {282 public event EventHandler<EventArgs<Exception>> ScriptExecutionFinished; 283 private void OnScriptExecutionFinished(Exception e) { 254 284 var handler = ScriptExecutionFinished; 255 if (handler != null) handler(this, EventArgs.Empty);285 if (handler != null) handler(this, new EventArgs<Exception>(e)); 256 286 } 257 287
Note: See TracChangeset
for help on using the changeset viewer.