-
Notifications
You must be signed in to change notification settings - Fork 0
/
SetLinksForm.xaml.cs
139 lines (102 loc) · 4.44 KB
/
SetLinksForm.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
using System.Windows;
namespace MapleDesktop2._0
{
/// <summary>
/// Interaction logic for SetLinksForm.xaml
/// </summary>
public partial class SetLinksForm : Window
{
internal static int linkid = 0;
public SetLinksForm()
{
InitializeComponent();
}
internal void SetLinkId(int id)
{
linkid = id;
lbl_Name.Content = $"Set QuickLink{id}";
}
internal void SetLink()
{
string link = "";
string name = "";
if (linkid > 0)
{
switch (linkid)
{
case 1:
link = txb_QuickLinkPath.Text;
name = txb_QuicklinkName.Text;
Properties.Settings.Default.QuickLink1 = link;
Properties.Settings.Default.QuickLink1Name = name;
Properties.Settings.Default.Save();
MainWindow.currentLinksForm.btn_QuickLink1.Content = name;
MainWindow.currentLinksForm.lbl_QuickLink1Name.Content = name;
break;
case 2:
link = txb_QuickLinkPath.Text;
name = txb_QuicklinkName.Text;
Properties.Settings.Default.QuickLink2 = link;
Properties.Settings.Default.QuickLink2Name = name;
Properties.Settings.Default.Save();
MainWindow.currentLinksForm.btn_QuickLink2.Content = name;
MainWindow.currentLinksForm.lbl_QuickLink2Name.Content = name;
break;
case 3:
link = txb_QuickLinkPath.Text;
name = txb_QuicklinkName.Text;
Properties.Settings.Default.QuickLink3 = link;
Properties.Settings.Default.QuickLink3Name = name;
Properties.Settings.Default.Save();
MainWindow.currentLinksForm.btn_QuickLink3.Content = name;
MainWindow.currentLinksForm.lbl_QuickLink3Name.Content = name;
break;
case 4:
link = txb_QuickLinkPath.Text;
name = txb_QuicklinkName.Text;
Properties.Settings.Default.QuickLink4 = link;
Properties.Settings.Default.QuickLink4Name = name;
Properties.Settings.Default.Save();
MainWindow.currentLinksForm.btn_QuickLink4.Content = name;
MainWindow.currentLinksForm.lbl_QuickLink4Name.Content = name;
break;
case 5:
link = txb_QuickLinkPath.Text;
name = txb_QuicklinkName.Text;
Properties.Settings.Default.QuickLink5 = link;
Properties.Settings.Default.QuickLink5Name = name;
Properties.Settings.Default.Save();
MainWindow.currentLinksForm.btn_QuickLink5.Content = name;
MainWindow.currentLinksForm.lbl_QuickLink5Name.Content = name;
break;
case 6:
link = txb_QuickLinkPath.Text;
name = txb_QuicklinkName.Text;
Properties.Settings.Default.QuickLink6 = link;
Properties.Settings.Default.QuickLink6Name = name;
Properties.Settings.Default.Save();
MainWindow.currentLinksForm.btn_QuickLink6.Content = name;
MainWindow.currentLinksForm.lbl_QuickLink6Name.Content = name;
break;
}
CancelWindow();
}
}
internal void CancelWindow()
{
this.Close();
}
private void btn_QuickLinkSet_Click(object sender, RoutedEventArgs e)
{
SetLink();
}
private void btn_QuickLinkCancel_Click(object sender, RoutedEventArgs e)
{
CancelWindow();
}
private void SetLinksWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
MainWindow.currentSetLinksFormOpen = false;
}
}
}