- Timestamp:
- 11/11/09 18:25:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PluginInfrastructure Refactoring/HeuristicLab/SplashScreen.cs
r2442 r2481 27 27 using System.Reflection; 28 28 using HeuristicLab.PluginInfrastructure; 29 using HeuristicLab.PluginInfrastructure.Manager; 29 30 30 31 namespace HeuristicLab { … … 35 36 private object bigLock = new object(); 36 37 private bool closing = false; 38 private PluginManager manager; 37 39 38 40 public SplashScreen() { 39 41 InitializeComponent(); 42 } 40 43 44 public SplashScreen(PluginManager manager, int initialInterval, string initialText) 45 : this() { 46 this.initialInterval = initialInterval; 47 infoLabel.Text = initialText; 48 this.manager = manager; 49 manager.Action += new PluginManagerActionEventHandler(Manager_Action); 41 50 Assembly assembly = this.GetType().Assembly; 42 51 object[] attributes = assembly.GetCustomAttributes(false); … … 47 56 infoLabel.Text = ""; 48 57 49 foreach (object obj in attributes) {50 if (obj is AssemblyCopyrightAttribute) {58 foreach (object obj in attributes) { 59 if (obj is AssemblyCopyrightAttribute) { 51 60 copyrightLabel.Text = "Copyright " + ((AssemblyCopyrightAttribute)obj).Copyright; 52 61 } … … 57 66 company = HeuristicLab.Properties.Settings.Default.Organization; 58 67 59 if ((user == null) || (user.Equals(""))) {68 if ((user == null) || (user.Equals(""))) { 60 69 userNameLabel.Text = "-"; 61 70 } else { … … 63 72 } 64 73 65 if ((company == null) || (company.Equals(""))) {74 if ((company == null) || (company.Equals(""))) { 66 75 companyLabel.Text = "-"; 67 76 } else { 68 77 companyLabel.Text = company; 69 78 } 70 } catch(Exception) { 79 } 80 catch (Exception) { 71 81 userNameLabel.Text = "-"; 72 82 companyLabel.Text = "-"; 73 83 } 74 }75 76 public SplashScreen(int initialInterval, string initialText)77 : this() {78 this.initialInterval = initialInterval;79 infoLabel.Text = initialText;80 84 } 81 85 … … 86 90 public void Manager_Action(object sender, PluginManagerActionEventArgs e) { 87 91 string info; 88 if(e.Action == PluginManagerAction.Initializing) info = "Initializing ..."; 89 else if(e.Action == PluginManagerAction.InitializingPlugin) info = "Initializing Plugin " + e.Id + " ..."; 90 else if(e.Action == PluginManagerAction.InitializedPlugin) info = "Initializing Plugin " + e.Id + " ... Initialized"; 91 else if(e.Action == PluginManagerAction.Initialized) { 92 if (e.Action == PluginManagerAction.Initializing) info = "Initializing ..."; 93 else if (e.Action == PluginManagerAction.PluginLoaded) info = "Loaded plugin " + e.Id + " ..."; 94 else if (e.Action == PluginManagerAction.Initialized) { 92 95 info = "Initialization Completed"; 93 96 fadeTimer = new System.Timers.Timer(); … … 98 101 fadeTimer.Start(); 99 102 } else { 100 if (e.Id != null) info = e.Action.ToString() + " (" + e.Id + ")";103 if (e.Id != null) info = e.Action.ToString() + " (" + e.Id + ")"; 101 104 else info = e.Action.ToString(); 102 105 } … … 107 110 private void fadeTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { 108 111 fadeTimer.Stop(); 109 if (InvokeRequired) {112 if (InvokeRequired) { 110 113 Invoke((MethodInvoker)UpdateOpacity); 111 114 } else { … … 140 143 closing = true; 141 144 if (fadeTimer != null) fadeTimer.Stop(); 142 PluginManager.Manager.Action -= new PluginManagerActionEventHandler(this.Manager_Action); // remove event before calling close145 manager.Action -= new PluginManagerActionEventHandler(this.Manager_Action); // remove event before calling close 143 146 Application.DoEvents(); // work up all existing events 144 147 Close(); // close
Note: See TracChangeset
for help on using the changeset viewer.