Subversion Repositories Code-Repo

Rev

Rev 50 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 50 Rev 53
Line 11... Line 11...
11
 
11
 
12
namespace SWAT_Office_App
12
namespace SWAT_Office_App
13
{
13
{
14
    public partial class Settings_Form : Form
14
    public partial class Settings_Form : Form
15
    {
15
    {
-
 
16
        // Global static variables
-
 
17
        public static string globalAdminPassword = "tr33b3@rd";
16
        public static bool defaultSettings { get; set; }
18
        public static bool defaultSettings { get; set; }
17
        public static bool showFileSizes { get; set; }
19
        public static bool showFileSizes { get; set; }
18
        public static List<string> systemAccounts = new List<string>();
20
        public static List<string> systemAccounts = new List<string>();
19
        public static List<string> hiddenAccounts = new List<string>();
21
        public static List<string> hiddenAccounts = new List<string>();
20
        public static string sharedFolderLocation { get; set; }
22
        public static string sharedFolderLocation { get; set; }
Line 105... Line 107...
105
                    usbMasterx32CopyLocation = Settings.Element("ProgramSettings").Element("USBMasterCopyx32Location").Value;
107
                    usbMasterx32CopyLocation = Settings.Element("ProgramSettings").Element("USBMasterCopyx32Location").Value;
106
                    usbMasterx64CopyLocation = Settings.Element("ProgramSettings").Element("USBMasterCopyx64Location").Value;
108
                    usbMasterx64CopyLocation = Settings.Element("ProgramSettings").Element("USBMasterCopyx64Location").Value;
107
                }
109
                }
108
                else
110
                else
109
                {
111
                {
-
 
112
                    MessageBox.Show("No existing setting file detected. Using default settings");
-
 
113
                    DebugText.appendText("No existing setting file detected. Using default settings");
110
                    WriteDefaultConfigFile();
114
                    WriteDefaultConfigFile();
111
                }
115
                }
112
            }
116
            }
113
            catch (Exception e)
117
            catch (Exception e)
114
            {
118
            {
115
                MessageBox.Show(e.ToString());
119
                //MessageBox.Show(e.ToString(), "Error");
-
 
120
                DebugText.appendText(e.ToString());
-
 
121
                MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error");
116
            }
122
            }
117
        }
123
        }
118
        private static void OpenUpdateSettings()
124
        private static void OpenUpdateSettings()
119
        {
125
        {
120
            // Update the buttons on the form with the imported settings
126
            // Update the buttons on the form with the imported settings
Line 158... Line 164...
158
 
164
 
159
                Settings.Save("Settings.xml");
165
                Settings.Save("Settings.xml");
160
            }
166
            }
161
            catch (Exception e)
167
            catch (Exception e)
162
            {
168
            {
163
                MessageBox.Show(e.ToString());
169
                //MessageBox.Show(e.ToString(), "Error");
-
 
170
                DebugText.appendText(e.ToString());
-
 
171
                MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error");
164
            }
172
            }
165
        }
173
        }
166
        private static void WriteDefaultConfigFile()
174
        private static void WriteDefaultConfigFile()
167
        {
175
        {
168
            // Writes the default settings configuration
176
            // Writes the default settings configuration
Line 182... Line 190...
182
                    );
190
                    );
183
                Settings.Save("Settings.xml");
191
                Settings.Save("Settings.xml");
184
            }
192
            }
185
            catch (Exception e)
193
            catch (Exception e)
186
            {
194
            {
187
                MessageBox.Show(e.ToString());
195
                //MessageBox.Show(e.ToString(), "Error");
-
 
196
                DebugText.appendText(e.ToString());
-
 
197
                MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error");
188
            }
198
            }
189
        }
199
        }
190
        private static void PaintListBox()
200
        private static void PaintListBox()
191
        {
201
        {
192
            // Paints & Refreshes the listbox of system accounts
202
            // Paints & Refreshes the listbox of system and hidden accounts
193
            settings_Form_Instance.listBox_SystemAccounts.Items.Clear();
203
            settings_Form_Instance.listBox_SystemAccounts.Items.Clear();
194
            foreach (string user in systemAccounts)
204
            foreach (string user in systemAccounts)
195
                settings_Form_Instance.listBox_SystemAccounts.Items.Add(user);
205
                settings_Form_Instance.listBox_SystemAccounts.Items.Add(user);
196
            settings_Form_Instance.listBox_HiddenAccounts.Items.Clear();
206
            settings_Form_Instance.listBox_HiddenAccounts.Items.Clear();
197
            foreach (string user in hiddenAccounts)
207
            foreach (string user in hiddenAccounts)
Line 207... Line 217...
207
        {
217
        {
208
            this.Close();
218
            this.Close();
209
        }
219
        }
210
        private void btn_Default_Click(object sender, EventArgs e)
220
        private void btn_Default_Click(object sender, EventArgs e)
211
        {
221
        {
-
 
222
            // Resets settings to default settings
212
            try
223
            try
213
            {
224
            {
214
                if (MessageBox.Show("Reset configurations to the default settings?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
225
                if (MessageBox.Show("Reset configurations to the default settings?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
215
                {
226
                {
216
                    File.Delete("Settings.xml");
227
                    File.Delete("Settings.xml");
Line 219... Line 230...
219
                    OpenUpdateSettings();
230
                    OpenUpdateSettings();
220
                }
231
                }
221
            }
232
            }
222
            catch (Exception ex)
233
            catch (Exception ex)
223
            {
234
            {
224
                MessageBox.Show(ex.ToString());
235
                //MessageBox.Show(e.ToString(), "Error");
-
 
236
                DebugText.appendText(ex.ToString());
-
 
237
                MessageBox.Show("An error has occured. Please notify a supervisor to debug.", "Error");
225
            }
238
            }
226
        }
239
        }
227
        private void btn_SystemAdd_Click(object sender, EventArgs e)
240
        private void btn_SystemAdd_Click(object sender, EventArgs e)
228
        {
241
        {
229
            AddSystemAccount_Form newForm = new AddSystemAccount_Form();
242
            AddSystemAccount_Form newForm = new AddSystemAccount_Form();
Line 251... Line 264...
251
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
264
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
252
            {
265
            {
253
                this.txt_ShareLocation.Text = folderBrowserDialog.SelectedPath;
266
                this.txt_ShareLocation.Text = folderBrowserDialog.SelectedPath;
254
                sharedFolderLocation = folderBrowserDialog.SelectedPath;
267
                sharedFolderLocation = folderBrowserDialog.SelectedPath;
255
            }
268
            }
256
 
-
 
257
        }
269
        }
258
        private void btn_USBLocationx32Change_Click(object sender, EventArgs e)
270
        private void btn_USBLocationx32Change_Click(object sender, EventArgs e)
259
        {
271
        {
260
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
272
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
261
            {
273
            {