Subversion Repositories Code-Repo

Rev

Rev 63 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9 Kevin 1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Linq;
7
using System.Text;
8
using System.Windows.Forms;
9
 
10
namespace SWAT_Office_App
11
{
63 Kevin 12
    public partial class Menu_Main_Form : Form
9 Kevin 13
    {
63 Kevin 14
        public Menu_Main_Form()
9 Kevin 15
        {
63 Kevin 16
            Debug.startNewSession();
57 Kevin 17
            Settings_Form.ImportSettings();
63 Kevin 18
            Stat_Logging.ImportSettings();
9 Kevin 19
            InitializeComponent();
50 Kevin 20
            this.KeyPress += new KeyPressEventHandler(Menu_Main_KeyPress);
57 Kevin 21
            this.FormClosing += new FormClosingEventHandler(Menu_Main_FormClosing);
9 Kevin 22
        }
15 Kevin 23
 
57 Kevin 24
        void Menu_Main_FormClosing(object sender, FormClosingEventArgs e)
25
        {
63 Kevin 26
            Stat_Logging.ExportSettings();
57 Kevin 27
        }
50 Kevin 28
        void Menu_Main_KeyPress(object sender, KeyPressEventArgs e)
15 Kevin 29
        {
45 Kevin 30
            // Monitors for keypresses
15 Kevin 31
            switch (e.KeyChar)
32
            {
53 Kevin 33
                case '1':   // Manage User Accounts and Shares
63 Kevin 34
                    Manage_User_Accounts_Form user_Mgmt = new Manage_User_Accounts_Form();
41 Kevin 35
                    user_Mgmt.ShowDialog();
36
                    break;
53 Kevin 37
                case '2':   // DriveLogger
38
                    // Check to make sure that an instance of DriveLogger isnt already running
41 Kevin 39
                    if (!DriveLogger_Form.instanceAlreadyRunning)
40
                    {
63 Kevin 41
                        Debug.appendText("Starting instance of DriveLogger");
41 Kevin 42
                        DriveLogger_Form driveForm = new DriveLogger_Form();
43
                        driveForm.Show();
44
                    }
45
                    else
46
                    {
47
                        MessageBox.Show("An instance of DriveLogger is already running");
48
                    }
49
                    break;
53 Kevin 50
                case '3':   // Reimage USB Drives
51
                    // Check to make sure that another imaging thread isnt running
41 Kevin 52
                    if (!Reimage_USB_Drives.threadsRunning)
53 Kevin 53
                    {
63 Kevin 54
                        Debug.appendText("Starting reimaging of USB drives");
15 Kevin 55
                        Reimage_USB_Drives.reimageUSBDrives();
53 Kevin 56
                    }
15 Kevin 57
                    else
58
                        MessageBox.Show("Another file copy operation is currently in progress.\n" +
59
                                        "Please wait for transfer to finish before starting another");
60
                    break;
53 Kevin 61
                case '4':   // Program Settings
63 Kevin 62
                    Settings_Verify_Form settingsForm = new Settings_Verify_Form();
15 Kevin 63
                    settingsForm.ShowDialog();
64
                    break;
53 Kevin 65
                case '?':   // About
63 Kevin 66
                    About_Box_Form aboutForm = new About_Box_Form();
15 Kevin 67
                    aboutForm.ShowDialog();
68
                    break;
69
            }
70
        }
9 Kevin 71
        private void btn_Main_UserMgmt_Click(object sender, EventArgs e)
72
        {
53 Kevin 73
            // Manage User Accounts and Shares
63 Kevin 74
            Manage_User_Accounts_Form userMgmtForm = new Manage_User_Accounts_Form();
15 Kevin 75
            userMgmtForm.ShowDialog();
9 Kevin 76
        }
41 Kevin 77
        private void btn_DriveLogger_Click(object sender, EventArgs e)
78
        {
53 Kevin 79
            // DriveLogger
41 Kevin 80
            if (!DriveLogger_Form.instanceAlreadyRunning)
81
            {
63 Kevin 82
                Debug.appendText("Starting instance of DriveLogger");
41 Kevin 83
                DriveLogger_Form driveForm = new DriveLogger_Form();
84
                driveForm.Show();
85
            }
86
            else
87
                MessageBox.Show("An instance of DriveLogger is already running");
88
        }
9 Kevin 89
        private void btn_Reimage_USB_Drives_Click(object sender, EventArgs e)
90
        {
53 Kevin 91
            // Reimage USB Drives
92
            if (!Reimage_USB_Drives.threadsRunning)
93
            {
63 Kevin 94
                Debug.appendText("Starting reimaging of USB drives");
9 Kevin 95
                Reimage_USB_Drives.reimageUSBDrives();
53 Kevin 96
            }
9 Kevin 97
            else
98
                MessageBox.Show("Another file copy operation is currently in progress.\n" +
99
                                "Please wait for transfer to finish before starting another");
100
        }
53 Kevin 101
        private void btn_Main_Settings_Click(object sender, EventArgs e)
102
        {
103
            // Program Settings
63 Kevin 104
            Settings_Verify_Form settingsForm = new Settings_Verify_Form();
53 Kevin 105
            settingsForm.ShowDialog();
106
        }
9 Kevin 107
    }
108
}