-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProgram.cs
76 lines (64 loc) · 2.13 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace UO_EC_Super_Viewer
{
static class Program
{
public static Form SplashScreen;
public static Form MainForm;
/// <summary>
/// Punto di ingresso principale dell'applicazione.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
// create the splash screen
SplashScreen = new Splash();
// show the splash screen async
Thread splashThread = new Thread( new ThreadStart( () => Application.Run( SplashScreen ) ) );
splashThread.SetApartmentState( ApartmentState.STA );
splashThread.Start();
// create the main form
MainForm = new UOECSuperViewer();
// add the main form loading complete event
MainForm.Load += MainForm_LoadCompleted;
// open the main form
Application.Run( MainForm );
}
/// <summary>
/// Main form load complete
/// </summary>
private static void MainForm_LoadCompleted( object sender, EventArgs e )
{
// if the splash is still around, we close it
if ( SplashScreen != null && !SplashScreen.Disposing && !SplashScreen.IsDisposed )
SplashScreen.Invoke( new Action( () => SplashScreen.Close() ) );
// show the form
MainForm.Visible = true;
// activate the main form
MainForm.TopMost = true;
MainForm.Activate();
MainForm.TopMost = false;
}
/// <summary>
/// Hide the splash screen
/// </summary>
public static void HideSplash()
{
SplashScreen.Visible = false;
}
/// <summary>
/// Show the splash screen
/// </summary>
public static void ShowSplash()
{
SplashScreen.Visible = true;
}
}
}