mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 08:47:14 +00:00
Tidy up splash screen code
Clearer to just have a spinning thread instead of a timer.
This commit is contained in:
parent
578aeb66b0
commit
cced16dff4
1 changed files with 10 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
using System.Timers;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PKHeX
|
||||
|
@ -8,20 +8,16 @@ namespace PKHeX
|
|||
public SplashScreen()
|
||||
{
|
||||
InitializeComponent();
|
||||
System.Timers.Timer myTimer = new System.Timers.Timer();
|
||||
myTimer.Elapsed += DisplayTimeEvent;
|
||||
myTimer.Interval = 50; // milliseconds per trigger interval
|
||||
myTimer.Start();
|
||||
}
|
||||
public void DisplayTimeEvent(object source, ElapsedEventArgs e)
|
||||
{
|
||||
if (!Main.init)
|
||||
if (L_Status.InvokeRequired) L_Status.Invoke((MethodInvoker)delegate { L_Status.Text = Main.Status; });
|
||||
else { L_Status.Text = Main.Status; }
|
||||
else
|
||||
if (InvokeRequired && IsHandleCreated)
|
||||
try { Invoke((MethodInvoker)Close); } catch { Close(); }
|
||||
new Thread(() =>
|
||||
{
|
||||
while (!Main.init)
|
||||
Thread.Sleep(50);
|
||||
|
||||
if (InvokeRequired)
|
||||
try { Invoke((MethodInvoker)Close); }
|
||||
catch { Close(); }
|
||||
else Close();
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue