forked from hackerzhou/GPATool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
73 lines (64 loc) · 1.85 KB
/
Form1.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
using System;
using DevComponents.DotNetBar;
using GPATool.Util;
using System.Threading;
using System.Net;
using System.Text;
using System.Xml;
using System.Windows.Forms;
using System.Web;
using System.IO;
namespace GPATool
{
public partial class Form1 :DevComponents.DotNetBar.Office2007RibbonForm
{
private static Form1 instance = null;
private static bool isAdmin = false;
private static Thread updateThread;
public static Form1 getInstance()
{
return instance;
}
public Form1()
{
instance = this;
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
XMLConfig.LoadConfig();
isAdmin = XMLConfig.isAdmin;
if (isAdmin)
{
this.Text = "复旦大学绩点查询工具 v1.10 专业版 by hackerzhou";
}
ribbonTabItem4.Checked = ribbonTabItem1.Checked = ribbonTabItem2.Checked = true;
updateThread = new Thread(new ThreadStart(UpdateUtil.CheckUpdate));
updateThread.Start();
}
public void ChangeStyle(eStyle style)
{
styleManager1.ManagerStyle = style;
}
void Form1_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
{
StopAllThreads();
scoreListView1.StopAllThreads();
userConfigView1.StopAllThreads();
scoreDistribution2.StopAllThreads();
}
public void StopAllThreads()
{
try
{
if (updateThread != null && updateThread.ThreadState != ThreadState.Stopped)
{
updateThread.Interrupt();
}
}
catch
{
}
}
}
}