-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathMainWindow.xaml.cs
79 lines (67 loc) · 2.23 KB
/
MainWindow.xaml.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
77
78
79
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Windows;
namespace FastbootEnhance
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public static MainWindow THIS;
const string version = "1.4.0";
public MainWindow()
{
InitializeComponent();
THIS = this;
string mutexName = "FastbootEnhance";
bool createdNew;
Mutex singleInstanceWatcher = new Mutex(false, mutexName, out createdNew);
if (!createdNew)
{
MessageBox.Show(Properties.Resources.program_already_running, Properties.Resources.error, MessageBoxButton.OK, MessageBoxImage.Error);
Process.GetCurrentProcess().Kill();
}
try
{
new DirectoryInfo(PayloadUI.PAYLOAD_TMP).Delete(true);
}
catch (DirectoryNotFoundException) { }
try
{
new DirectoryInfo(FastbootUI.PAYLOAD_TMP).Delete(true);
}
catch (DirectoryNotFoundException) { }
PayloadUI.init();
FastbootUI.init();
Title += " v" + version;
Closed += delegate
{
if (PayloadUI.payload != null)
PayloadUI.payload.Dispose();
try
{
new DirectoryInfo(PayloadUI.PAYLOAD_TMP).Delete(true);
}
catch (DirectoryNotFoundException) { }
catch (IOException) { }
try
{
new DirectoryInfo(FastbootUI.PAYLOAD_TMP).Delete(true);
}
catch (DirectoryNotFoundException) { }
catch (IOException) { }
Process.GetCurrentProcess().Kill();
};
}
private void Thread_Click(object sender, RoutedEventArgs e)
{
Process.Start("https://www.akr-developers.com/d/506");
}
private void OSS_Click(object sender, RoutedEventArgs e)
{
Process.Start("https://github.com/libxzr/FastbootEnhance");
}
}
}