Free cookie consent management tool by TermsFeed Policy Generator

Changeset 598 for branches/3.0/sources


Ignore:
Timestamp:
09/26/08 11:29:50 (16 years ago)
Author:
gkronber
Message:

fixed #138 (Starting multiple applications concurrently causes some of the splashscreens to stay visible) in 3.0 branch

Location:
branches/3.0/sources/HeuristicLab
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/sources/HeuristicLab/MainForm.cs

    r279 r598  
    8989        } else {
    9090          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);
    9292          splashScreen.Owner = this;
    9393          splashScreen.Show();
  • branches/3.0/sources/HeuristicLab/SplashScreen.Designer.cs

    r2 r598  
    5050      this.components = new System.ComponentModel.Container();
    5151      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SplashScreen));
    52       this.waitTimer = new System.Windows.Forms.Timer(this.components);
    5352      this.panel = new System.Windows.Forms.Panel();
    5453      this.closeButton = new System.Windows.Forms.Button();
     
    6261      this.copyrightLabel = new System.Windows.Forms.Label();
    6362      this.pictureBox = new System.Windows.Forms.PictureBox();
    64       this.fadeTimer = new System.Windows.Forms.Timer(this.components);
    6563      this.panel.SuspendLayout();
    6664      ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
    6765      this.SuspendLayout();
    68       //
    69       // waitTimer
    70       //
    71       this.waitTimer.Interval = 1000;
    72       this.waitTimer.Tick += new System.EventHandler(this.waitTimer_Tick);
    7366      //
    7467      // panel
     
    205198      this.pictureBox.TabIndex = 0;
    206199      this.pictureBox.TabStop = false;
    207       //
    208       // fadeTimer
    209       //
    210       this.fadeTimer.Interval = 50;
    211       this.fadeTimer.Tick += new System.EventHandler(this.fadeTimer_Tick);
    212200      //
    213201      // SplashScreen
     
    235223    #endregion
    236224
    237     private System.Windows.Forms.Timer waitTimer;
    238225    private System.Windows.Forms.Panel panel;
    239226    private System.Windows.Forms.PictureBox pictureBox;
     
    247234    private System.Windows.Forms.ImageList imageList;
    248235    private System.Windows.Forms.Button closeButton;
    249     private System.Windows.Forms.Timer fadeTimer;
    250236  }
    251237}
  • branches/3.0/sources/HeuristicLab/SplashScreen.cs

    r17 r598  
    3030namespace HeuristicLab {
    3131  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;
    4237
    4338    public SplashScreen() {
     
    7772        companyLabel.Text = "-";
    7873      }
    79       waitTimer.Start();
    8074    }
    8175
    82     public SplashScreen(int displayTime, string initialText)
     76    public SplashScreen(int initialInterval, string initialText)
    8377      : this() {
    84       waitTimer.Stop();
    85       DisplayTime = displayTime;
    86       waitTimer.Start();
     78      this.initialInterval = initialInterval;
    8779      infoLabel.Text = initialText;
    8880    }
     
    9385
    9486    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();
    109113      }
    110114    }
    111115
    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;
    133119        if(Opacity > 0.9) {
    134120          Opacity = 0.9;
     121          fadeTimer.Interval = FADE_INTERVAL;
     122          fadeTimer.Start();
    135123        } else if(this.Opacity > 0) {
    136124          Opacity -= 0.1;
     125          fadeTimer.Start();
    137126        } else {
    138127          Opacity = 0;
    139           fadeTimer.Stop();
    140128          Close();
    141129        }
    142130      }
    143131    }
    144 
    145132
    146133    private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e) {
     
    149136
    150137    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      }
    153143    }
    154144  }
  • branches/3.0/sources/HeuristicLab/SplashScreen.resx

    r2 r598  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </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>
    123120  <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124121    <value>219, 17</value>
     
    136133</value>
    137134  </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>
    141135</root>
Note: See TracChangeset for help on using the changeset viewer.