Changeset 242
- Timestamp:
- 05/13/08 20:24:46 (17 years ago)
- Location:
- trunk/sources
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/ApplicationInfo.cs
r2 r242 46 46 } 47 47 48 private bool autoRestart; 49 public bool AutoRestart { 50 get { return autoRestart; } 51 set { autoRestart = value; } 52 } 53 48 54 private string pluginAssembly; 49 55 /// <summary> 50 56 /// Name of the assembly that contains the IApplication type. 51 /// NEEDED?52 57 /// </summary> 53 58 public string PluginAssembly { … … 59 64 /// <summary> 60 65 /// Name of the type that implements the interface IApplication. 61 /// NEEDED?62 66 /// </summary> 63 67 public string PluginType { -
trunk/sources/HeuristicLab.PluginInfrastructure/BaseClasses/ApplicationBase.cs
r8 r242 30 30 private Version version; 31 31 private string description; 32 32 private bool autoRestart; 33 33 34 public ApplicationBase() { 34 35 ReadAttributes(); … … 45 46 // after the assertion we are sure that the array access will not fail 46 47 ClassInfoAttribute pluginAttribute = (ClassInfoAttribute)pluginAttributes[0]; 48 if(pluginAttribute != null) { 49 // if the plugin name is not explicitly set in the attribute then the default plugin name is the FullName of the type 50 if(pluginAttribute.Name != null) { 51 this.name = pluginAttribute.Name; 52 } else { 53 this.name = this.GetType().FullName; 54 } 47 55 48 // if the plugin name is not explicitly set in the attribute then the default plugin name is the FullName of the type49 if(pluginAttribute != null && pluginAttribute.Name!= null) {50 this.name = pluginAttribute.Name;51 } else {52 this.name = this.GetType().FullName;53 }56 // if the version is not explicitly set in the attribute then the version of the assembly is used as default 57 if(pluginAttribute.Version != null) { 58 this.version = new Version(pluginAttribute.Version); 59 } else { 60 this.version = this.GetType().Assembly.GetName().Version; 61 } 54 62 55 // if the version is not explicitly set in the attribute then the version of the assemblyis used as default56 if(pluginAttribute != null && pluginAttribute.Version != null) {57 this.version = new Version(pluginAttribute.Version);58 } else {59 this.version = this.GetType().Assembly.GetName().Version;60 }63 // if the description is not explicitly set in the attribute then the name of name of the application is used as default 64 if(pluginAttribute.Description != null) { 65 this.description = pluginAttribute.Description; 66 } else { 67 this.description = name; 68 } 61 69 62 // if the description is not explicitly set in the attribute then the name of name of the application is used as default 63 if(pluginAttribute != null && pluginAttribute.Description != null) { 64 this.description = pluginAttribute.Description; 65 } else { 66 this.description = name; 70 this.autoRestart = pluginAttribute.AutoRestart; 67 71 } 68 72 } … … 83 87 } 84 88 85 public abstract void Run() ; 89 public bool AutoRestart { 90 get { return autoRestart; } 91 } 92 93 public abstract void Run(); 86 94 87 95 #endregion -
trunk/sources/HeuristicLab.PluginInfrastructure/ClassInfoAttribute.cs
r91 r242 52 52 } 53 53 54 private bool autoRestart; 55 public bool AutoRestart { 56 get { return autoRestart; } 57 set { autoRestart = value; } 58 } 59 54 60 public ClassInfoAttribute() {} 55 61 } -
trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IApplication.cs
r2 r242 29 29 Version Version { get; } 30 30 string Description { get;} 31 bool AutoRestart { get; } 31 32 void Run(); 32 33 } -
trunk/sources/HeuristicLab.PluginInfrastructure/Loader.cs
r91 r242 120 120 info.Version = application.Version; 121 121 info.Description = application.Description; 122 info.AutoRestart = application.AutoRestart; 122 123 info.PluginAssembly = application.GetType().Assembly.GetName().Name; 123 124 info.PluginType = application.GetType().Namespace + "." + application.GetType().Name; -
trunk/sources/HeuristicLab/MainForm.cs
r241 r242 94 94 PluginManager.Manager.Action += new PluginManagerActionEventHandler(splashScreen.Manager_Action); 95 95 Thread t = new Thread(delegate() { 96 try { 97 PluginManager.Manager.Run(app); 98 } catch(Exception ex) { 99 ShowErrorMessageBox(ex); 100 } 96 bool stopped = false; 97 do { 98 try { 99 PluginManager.Manager.Run(app); 100 stopped = true; 101 } catch(Exception ex) { 102 stopped = false; 103 ThreadPool.QueueUserWorkItem(delegate(object exception) { ShowErrorMessageBox((Exception)exception); }, ex); 104 Thread.Sleep(5000); // sleep 5 seconds before autorestart 105 } 106 } while(!stopped && app.AutoRestart); 101 107 }); 102 108 t.SetApartmentState(ApartmentState.STA); // needed for the AdvancedOptimizationFrontent
Note: See TracChangeset
for help on using the changeset viewer.