Changeset 595 for trunk/sources
- Timestamp:
- 09/25/08 16:47:35 (16 years ago)
- Location:
- trunk/sources/HeuristicLab
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab/MainForm.cs
r242 r595 89 89 } else { 90 90 ApplicationInfo app = (ApplicationInfo)applicationsListView.SelectedItems[0].Tag; 91 SplashScreen splashScreen = new SplashScreen( 1000, "Loading " + app.Name);91 SplashScreen splashScreen = new SplashScreen(3000, "Loading " + app.Name); 92 92 splashScreen.Owner = this; 93 93 splashScreen.Show(); -
trunk/sources/HeuristicLab/SplashScreen.Designer.cs
r2 r595 50 50 this.components = new System.ComponentModel.Container(); 51 51 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SplashScreen)); 52 this.waitTimer = new System.Windows.Forms.Timer(this.components);53 52 this.panel = new System.Windows.Forms.Panel(); 54 53 this.closeButton = new System.Windows.Forms.Button(); … … 62 61 this.copyrightLabel = new System.Windows.Forms.Label(); 63 62 this.pictureBox = new System.Windows.Forms.PictureBox(); 64 this.fadeTimer = new System.Windows.Forms.Timer(this.components);65 63 this.panel.SuspendLayout(); 66 64 ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); 67 65 this.SuspendLayout(); 68 //69 // waitTimer70 //71 this.waitTimer.Interval = 1000;72 this.waitTimer.Tick += new System.EventHandler(this.waitTimer_Tick);73 66 // 74 67 // panel … … 205 198 this.pictureBox.TabIndex = 0; 206 199 this.pictureBox.TabStop = false; 207 //208 // fadeTimer209 //210 this.fadeTimer.Interval = 50;211 this.fadeTimer.Tick += new System.EventHandler(this.fadeTimer_Tick);212 200 // 213 201 // SplashScreen … … 235 223 #endregion 236 224 237 private System.Windows.Forms.Timer waitTimer;238 225 private System.Windows.Forms.Panel panel; 239 226 private System.Windows.Forms.PictureBox pictureBox; … … 247 234 private System.Windows.Forms.ImageList imageList; 248 235 private System.Windows.Forms.Button closeButton; 249 private System.Windows.Forms.Timer fadeTimer;250 236 } 251 237 } -
trunk/sources/HeuristicLab/SplashScreen.cs
r17 r595 30 30 namespace HeuristicLab { 31 31 public partial class SplashScreen : Form { 32 private int myDisplayTime = 1000; 32 private const int FADE_INTERVAL = 50; 33 private System.Timers.Timer waitTimer; 34 private System.Timers.Timer fadeTimer; 35 private object bigLock = new object(); 36 37 private int displayTime = 1000; 33 38 public int DisplayTime { 34 get { return ( myDisplayTime); }39 get { return (displayTime); } 35 40 set { 36 41 if(value > 0) { 37 myDisplayTime = value; 38 waitTimer.Interval = value; 42 displayTime = value; 39 43 } 40 44 } … … 77 81 companyLabel.Text = "-"; 78 82 } 79 waitTimer.Start();80 83 } 81 84 82 85 public SplashScreen(int displayTime, string initialText) 83 86 : this() { 84 waitTimer.Stop();85 87 DisplayTime = displayTime; 86 waitTimer.Start();87 88 infoLabel.Text = initialText; 88 89 } … … 93 94 94 95 public void Manager_Action(object sender, PluginManagerActionEventArgs e) { 95 if(!this.Disposing && !this.IsDisposed) { 96 waitTimer.Stop(); 97 string info; 98 if(e.Action == PluginManagerAction.Initializing) info = "Initializing ..."; 99 else if(e.Action == PluginManagerAction.InitializingPlugin) info = "Initializing Plugin " + e.Id + " ..."; 100 else if(e.Action == PluginManagerAction.InitializedPlugin) info = "Initializing Plugin " + e.Id + " ... Initialized"; 101 else if(e.Action == PluginManagerAction.Initialized) info = "Initialization Completed"; 102 else { 103 if(e.Id != null) info = e.Action.ToString() + " (" + e.Id + ")"; 104 else info = e.Action.ToString(); 105 } 106 SetInfoText(info); 107 Application.DoEvents(); 108 waitTimer.Start(); 109 } 110 } 111 112 private void waitTimer_Tick(object sender, System.EventArgs e) { 113 if(!this.Disposing && !this.IsDisposed) { 114 waitTimer.Stop(); 115 fadeTimer.Start(); 116 } 117 } 118 119 private void fadeTimer_Tick(object sender, EventArgs e) { 120 if(InvokeRequired) { 121 Invoke((MethodInvoker)delegate() { 122 if(Opacity > 0.9) { 123 Opacity = 0.9; 124 } else if(this.Opacity > 0) { 125 Opacity -= 0.1; 126 } else { 127 Opacity = 0; 128 fadeTimer.Stop(); 129 Close(); 96 lock(bigLock) { 97 if(!this.Disposing && !this.IsDisposed) { 98 if(waitTimer == null) { 99 waitTimer = new System.Timers.Timer(); 100 waitTimer.SynchronizingObject = this; 101 waitTimer.Elapsed += new System.Timers.ElapsedEventHandler(waitTimer_Elapsed); 130 102 } 131 }); 132 } else { 133 if(Opacity > 0.9) { 134 Opacity = 0.9; 135 } else if(this.Opacity > 0) { 136 Opacity -= 0.1; 137 } else { 138 Opacity = 0; 139 fadeTimer.Stop(); 140 Close(); 103 waitTimer.Stop(); 104 waitTimer.Interval = DisplayTime; 105 waitTimer.AutoReset = true; 106 string info; 107 if(e.Action == PluginManagerAction.Initializing) info = "Initializing ..."; 108 else if(e.Action == PluginManagerAction.InitializingPlugin) info = "Initializing Plugin " + e.Id + " ..."; 109 else if(e.Action == PluginManagerAction.InitializedPlugin) info = "Initializing Plugin " + e.Id + " ... Initialized"; 110 else if(e.Action == PluginManagerAction.Initialized) info = "Initialization Completed"; 111 else { 112 if(e.Id != null) info = e.Action.ToString() + " (" + e.Id + ")"; 113 else info = e.Action.ToString(); 114 } 115 SetInfoText(info); 116 Application.DoEvents(); 117 waitTimer.Start(); 141 118 } 142 119 } 143 120 } 144 121 122 private void waitTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { 123 lock(bigLock) { 124 if(!this.Disposing && !this.IsDisposed) { 125 if(fadeTimer == null) { 126 fadeTimer = new System.Timers.Timer(); 127 fadeTimer.SynchronizingObject = this; 128 fadeTimer.Elapsed += new System.Timers.ElapsedEventHandler(fadeTimer_Elapsed); 129 fadeTimer.Interval = FADE_INTERVAL; 130 fadeTimer.AutoReset = true; 131 fadeTimer.Start(); 132 } 133 } 134 } 135 } 136 137 private void fadeTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { 138 lock(bigLock) { 139 if(!this.Disposing && !this.IsDisposed) { 140 fadeTimer.Stop(); 141 if(InvokeRequired) { 142 Invoke((MethodInvoker)UpdateOpacity); 143 } else { 144 UpdateOpacity(); 145 } 146 } 147 } 148 } 149 150 private void UpdateOpacity() { 151 if(Opacity > 0.9) { 152 Opacity = 0.9; 153 fadeTimer.Start(); 154 } else if(this.Opacity > 0) { 155 Opacity -= 0.1; 156 fadeTimer.Start(); 157 } else { 158 Opacity = 0; 159 Close(); 160 } 161 } 145 162 146 163 private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e) { … … 149 166 150 167 private void closeButton_Click(object sender, EventArgs e) { 151 waitTimer.Stop(); 152 Close(); 168 lock(bigLock) { 169 if(fadeTimer != null) fadeTimer.Stop(); 170 if(waitTimer != null) waitTimer.Stop(); 171 Close(); 172 } 153 173 } 154 174 } -
trunk/sources/HeuristicLab/SplashScreen.resx
r2 r595 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="waitTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">121 <value>16, 17</value>122 </metadata>123 120 <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 121 <value>219, 17</value> … … 136 133 </value> 137 134 </data> 138 <metadata name="fadeTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">139 <value>116, 17</value>140 </metadata>141 135 </root>
Note: See TracChangeset
for help on using the changeset viewer.