- Timestamp:
- 09/26/08 11:32:58 (16 years ago)
- Location:
- branches/3.1/sources/HeuristicLab
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/sources/HeuristicLab/MainForm.cs
r242 r599 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(2000, "Loading " + app.Name); 92 92 splashScreen.Owner = this; 93 93 splashScreen.Show(); -
branches/3.1/sources/HeuristicLab/SplashScreen.Designer.cs
r2 r599 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 } -
branches/3.1/sources/HeuristicLab/SplashScreen.cs
r17 r599 30 30 namespace HeuristicLab { 31 31 public partial class SplashScreen : Form { 32 private int myDisplayTime = 1000; 33 public int DisplayTime { 34 get { return (myDisplayTime); } 35 set { 36 if(value > 0) { 37 myDisplayTime = value; 38 waitTimer.Interval = value; 39 } 40 } 41 } 32 private const int FADE_INTERVAL = 50; 33 private System.Timers.Timer fadeTimer; 34 private int initialInterval; 35 private object bigLock = new object(); 36 private bool closing = false; 42 37 43 38 public SplashScreen() { … … 77 72 companyLabel.Text = "-"; 78 73 } 79 waitTimer.Start();80 74 } 81 75 82 public SplashScreen(int displayTime, string initialText)76 public SplashScreen(int initialInterval, string initialText) 83 77 : this() { 84 waitTimer.Stop(); 85 DisplayTime = displayTime; 86 waitTimer.Start(); 78 this.initialInterval = initialInterval; 87 79 infoLabel.Text = initialText; 88 80 } … … 93 85 94 86 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(); 87 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 info = "Initialization Completed"; 93 fadeTimer = new System.Timers.Timer(); 94 fadeTimer.SynchronizingObject = this; 95 fadeTimer.Elapsed += new System.Timers.ElapsedEventHandler(fadeTimer_Elapsed); 96 fadeTimer.Interval = initialInterval; 97 fadeTimer.AutoReset = true; 98 fadeTimer.Start(); 99 } else { 100 if(e.Id != null) info = e.Action.ToString() + " (" + e.Id + ")"; 101 else info = e.Action.ToString(); 102 } 103 SetInfoText(info); 104 Application.DoEvents(); 105 } 106 107 private void fadeTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { 108 fadeTimer.Stop(); 109 if(InvokeRequired) { 110 Invoke((MethodInvoker)UpdateOpacity); 111 } else { 112 UpdateOpacity(); 109 113 } 110 114 } 111 115 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(); 130 } 131 }); 132 } else { 116 private void UpdateOpacity() { 117 lock(bigLock) { 118 if(closing) return; 133 119 if(Opacity > 0.9) { 134 120 Opacity = 0.9; 121 fadeTimer.Interval = FADE_INTERVAL; 122 fadeTimer.Start(); 135 123 } else if(this.Opacity > 0) { 136 124 Opacity -= 0.1; 125 fadeTimer.Start(); 137 126 } else { 138 127 Opacity = 0; 139 fadeTimer.Stop();140 128 Close(); 141 129 } 142 130 } 143 131 } 144 145 132 146 133 private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e) { … … 149 136 150 137 private void closeButton_Click(object sender, EventArgs e) { 151 waitTimer.Stop(); 152 Close(); 138 lock(bigLock) { 139 closing = true; 140 if(fadeTimer != null) fadeTimer.Stop(); 141 Close(); 142 } 153 143 } 154 144 } -
branches/3.1/sources/HeuristicLab/SplashScreen.resx
r2 r599 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.