Subversion Repositories Code-Repo

Rev

Details | 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
{
50 Kevin 12
    public partial class Menu_Main : Form
9 Kevin 13
    {
50 Kevin 14
        public Menu_Main()
9 Kevin 15
        {
53 Kevin 16
            DebugText.startNewSession();
9 Kevin 17
            InitializeComponent();
18
            Settings_Form.ImportSettings();
50 Kevin 19
            this.KeyPress += new KeyPressEventHandler(Menu_Main_KeyPress);
9 Kevin 20
        }
15 Kevin 21
 
50 Kevin 22
        void Menu_Main_KeyPress(object sender, KeyPressEventArgs e)
15 Kevin 23
        {
45 Kevin 24
            // Monitors for keypresses
15 Kevin 25
            switch (e.KeyChar)
26
            {
53 Kevin 27
                case '1':   // Manage User Accounts and Shares
41 Kevin 28
                    ManageUserAccounts_Form user_Mgmt = new ManageUserAccounts_Form();
29
                    user_Mgmt.ShowDialog();
30
                    break;
53 Kevin 31
                case '2':   // DriveLogger
32
                    // Check to make sure that an instance of DriveLogger isnt already running
41 Kevin 33
                    if (!DriveLogger_Form.instanceAlreadyRunning)
34
                    {
53 Kevin 35
                        DebugText.appendText("Starting instance of DriveLogger");
41 Kevin 36
                        DriveLogger_Form driveForm = new DriveLogger_Form();
37
                        driveForm.Show();
38
                    }
39
                    else
40
                    {
41
                        MessageBox.Show("An instance of DriveLogger is already running");
42
                    }
43
                    break;
53 Kevin 44
                case '3':   // Reimage USB Drives
45
                    // Check to make sure that another imaging thread isnt running
41 Kevin 46
                    if (!Reimage_USB_Drives.threadsRunning)
53 Kevin 47
                    {
48
                        DebugText.appendText("Starting reimaging of USB drives");
15 Kevin 49
                        Reimage_USB_Drives.reimageUSBDrives();
53 Kevin 50
                    }
15 Kevin 51
                    else
52
                        MessageBox.Show("Another file copy operation is currently in progress.\n" +
53
                                        "Please wait for transfer to finish before starting another");
54
                    break;
53 Kevin 55
                case '4':   // Program Settings
15 Kevin 56
                    SettingsVerify_Form settingsForm = new SettingsVerify_Form();
57
                    settingsForm.ShowDialog();
58
                    break;
53 Kevin 59
                case '?':   // About
15 Kevin 60
                    AboutBox aboutForm = new AboutBox();
61
                    aboutForm.ShowDialog();
62
                    break;
63
            }
64
        }
9 Kevin 65
        private void btn_Main_UserMgmt_Click(object sender, EventArgs e)
66
        {
53 Kevin 67
            // Manage User Accounts and Shares
15 Kevin 68
            ManageUserAccounts_Form userMgmtForm = new ManageUserAccounts_Form();
69
            userMgmtForm.ShowDialog();
9 Kevin 70
        }
41 Kevin 71
        private void btn_DriveLogger_Click(object sender, EventArgs e)
72
        {
53 Kevin 73
            // DriveLogger
41 Kevin 74
            if (!DriveLogger_Form.instanceAlreadyRunning)
75
            {
53 Kevin 76
                DebugText.appendText("Starting instance of DriveLogger");
41 Kevin 77
                DriveLogger_Form driveForm = new DriveLogger_Form();
78
                driveForm.Show();
79
            }
80
            else
81
                MessageBox.Show("An instance of DriveLogger is already running");
82
        }
9 Kevin 83
        private void btn_Reimage_USB_Drives_Click(object sender, EventArgs e)
84
        {
53 Kevin 85
            // Reimage USB Drives
86
            if (!Reimage_USB_Drives.threadsRunning)
87
            {
88
                DebugText.appendText("Starting reimaging of USB drives");
9 Kevin 89
                Reimage_USB_Drives.reimageUSBDrives();
53 Kevin 90
            }
9 Kevin 91
            else
92
                MessageBox.Show("Another file copy operation is currently in progress.\n" +
93
                                "Please wait for transfer to finish before starting another");
94
        }
53 Kevin 95
        private void btn_Main_Settings_Click(object sender, EventArgs e)
96
        {
97
            // Program Settings
98
            SettingsVerify_Form settingsForm = new SettingsVerify_Form();
99
            settingsForm.ShowDialog();
100
        }
9 Kevin 101
    }
102
}