forked from pmengal/MailSystem.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplashForm.cs
More file actions
85 lines (76 loc) · 2.15 KB
/
SplashForm.cs
File metadata and controls
85 lines (76 loc) · 2.15 KB
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
77
78
79
80
81
82
83
84
85
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace ActiveUp.MailSystem.DesktopClient
{
/// <summary>
/// This class represents a splash screen.
/// </summary>
public partial class SplashForm : Form
{
/// <summary>
/// Current thread attribute.
/// </summary>
private Thread thread;
/// <summary>
/// Splash Form constructor.
/// </summary>
public SplashForm()
{
this.InitializeComponent();
}
/// <summary>
/// Method for show splash screen.
/// Starts the thread.
/// </summary>
public void ShowSplashScreen()
{
this.thread = new Thread(new ThreadStart(SplashScreen));
this.thread.Start();
}
/// <summary>
/// Method for close splash screen.
/// Close the dialog and abort the thread.
/// </summary>
public void CloseSplashScreen()
{
Thread.Sleep(1000);
this.DialogResult = DialogResult.OK;
this.thread.Abort();
}
/// <summary>
/// Method for splash screen.
/// </summary>
private void SplashScreen()
{
this.ShowDialog();
}
/// <summary>
/// Event handler for timer tick.
/// Increment the Form opacity.
/// </summary>
/// <param name="sender">The timer sender object.</param>
/// <param name="e">The event arguments for timer.</param>
private void timer_Tick(object sender, EventArgs e)
{
if (this.Opacity < 1)
{
this.Opacity += 0.1;
}
}
/// <summary>
/// Event handler for splash form load.
/// </summary>
/// <param name="sender">The sender object.</param>
/// <param name="e">The event arguments.</param>
private void SplashForm_Load(object sender, EventArgs e)
{
this.timer.Start();
}
}
}