Subversion Repositories Code-Repo

Rev

Rev 45 | Rev 53 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SWAT_Office_App
{
    public partial class Menu_Main : Form
    {
        public Menu_Main()
        {
            InitializeComponent();
            Settings_Form.ImportSettings();
            this.KeyPress += new KeyPressEventHandler(Menu_Main_KeyPress);
        }

        void Menu_Main_KeyPress(object sender, KeyPressEventArgs e)
        {
            // Monitors for keypresses
            switch (e.KeyChar)
            {
                case '1':
                    ManageUserAccounts_Form user_Mgmt = new ManageUserAccounts_Form();
                    user_Mgmt.ShowDialog();
                    break;
                case '2':
                    if (!DriveLogger_Form.instanceAlreadyRunning)
                    {
                        DriveLogger_Form driveForm = new DriveLogger_Form();
                        driveForm.Show();
                    }
                    else
                    {
                        MessageBox.Show("An instance of DriveLogger is already running");
                    }
                    break;
                case '3':
                    if (!Reimage_USB_Drives.threadsRunning)
                        Reimage_USB_Drives.reimageUSBDrives();
                    else
                    {
                        MessageBox.Show("Another file copy operation is currently in progress.\n" +
                                        "Please wait for transfer to finish before starting another");
                    }
                    break;
                case '4':
                    SettingsVerify_Form settingsForm = new SettingsVerify_Form();
                    settingsForm.ShowDialog();
                    break;
                case '?':
                    AboutBox aboutForm = new AboutBox();
                    aboutForm.ShowDialog();
                    break;
            }
        }
        private void btn_Main_UserMgmt_Click(object sender, EventArgs e)
        {
            ManageUserAccounts_Form userMgmtForm = new ManageUserAccounts_Form();
            userMgmtForm.ShowDialog();
        }
        private void btn_DriveLogger_Click(object sender, EventArgs e)
        {
            if (!DriveLogger_Form.instanceAlreadyRunning)
            {
                DriveLogger_Form driveForm = new DriveLogger_Form();
                driveForm.Show();
            }
            else
            {
                MessageBox.Show("An instance of DriveLogger is already running");
            }
        }
        private void btn_Main_Settings_Click(object sender, EventArgs e)
        {
            SettingsVerify_Form settingsForm = new SettingsVerify_Form();
            settingsForm.ShowDialog();
        }
        private void btn_Reimage_USB_Drives_Click(object sender, EventArgs e)
        {
            if (!DriveLogger_Form.instanceAlreadyRunning)
                Reimage_USB_Drives.reimageUSBDrives();
            else
            {
                MessageBox.Show("Another file copy operation is currently in progress.\n" +
                                "Please wait for transfer to finish before starting another");
            }
        }
    }
}