1 |
william |
612 |
using System; |
2 |
|
|
using System.Drawing; |
3 |
|
|
using System.Windows.Forms; |
4 |
|
|
using EmuXPortal.Api; |
5 |
|
|
using Enterprise.Logging; |
6 |
|
|
using Utilities.TransparentControls; |
7 |
|
|
|
8 |
|
|
namespace EmuXPortal { |
9 |
|
|
public class Splash : UserControl { |
10 |
|
|
const float PROGRESS_BAR_FONT_SIZE = 24; |
11 |
|
|
private CustomProgressBar progress_bar; |
12 |
|
|
public Splash () |
13 |
|
|
{ |
14 |
|
|
InitializeComponent (); |
15 |
|
|
} |
16 |
|
|
|
17 |
|
|
public FormBorderStyle FormBorderStyle { get; private set; } |
18 |
|
|
|
19 |
|
|
private void InitializeComponent () |
20 |
|
|
{ |
21 |
|
|
progress_bar = new CustomProgressBar (); |
22 |
|
|
this.SuspendLayout (); |
23 |
|
|
// |
24 |
|
|
// progress_bar |
25 |
|
|
// |
26 |
|
|
progress_bar.Dock = DockStyle.Top; |
27 |
|
|
progress_bar.ProgressColor = Color.Lime; |
28 |
|
|
progress_bar.Font = new Font (this.Font.FontFamily, PROGRESS_BAR_FONT_SIZE); |
29 |
|
|
this.Controls.Add (progress_bar); |
30 |
|
|
// |
31 |
|
|
// this |
32 |
|
|
// |
33 |
|
|
this.BackColor = Color.Black; |
34 |
|
|
this.ForeColor = Color.Lime; |
35 |
|
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; |
36 |
|
|
this.Load += Splash_Load; |
37 |
|
|
gLog.ReportProgressEvent += Splash_ReportProgress; |
38 |
|
|
this.ResumeLayout (false); |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
private void Splash_Load (object sender, EventArgs e) |
42 |
|
|
{ |
43 |
|
|
#if !DISABLE_CURSOR_HIDE |
44 |
|
|
Cursor.Hide (); |
45 |
|
|
#else |
46 |
|
|
Cursor.Show(); |
47 |
|
|
#endif |
48 |
|
|
progress_bar.Margin = new System.Windows.Forms.Padding (0); |
49 |
|
|
progress_bar.Size = new Size (this.Width - 25, 100); |
50 |
|
|
} |
51 |
|
|
private void Splash_ReportProgress (object sender, ReportProgressEventArgs e) |
52 |
|
|
{ |
53 |
|
|
|
54 |
|
|
int progress = e.Progress; |
55 |
|
|
string message = e.UserState == null ? "" : e.UserState.ToString (); |
56 |
|
|
progress_bar.Message = message; |
57 |
|
|
progress_bar.Value = progress; |
58 |
|
|
//progress_bar.Refresh (); |
59 |
|
|
} |
60 |
|
|
} |
61 |
|
|
} |