Exemplo n.º 1
0
        void Choice_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter && InputTextBox("CHOICE").Text.StartsWith("."))
            {
                shortcutString = InputTextBox("CHOICE").Text.Substring(2, InputTextBox("CHOICE").Text.Length - 2);
                InputTextBox("CHOICE").Text = InputTextBox("CHOICE").Text[1].ToString();
            }
            else if ((e.KeyCode == Keys.OemPeriod || InputTextBox("CHOICE").Text.Length >= 2))
            {
                return;
            }
            switch (InputTextBox("CHOICE").Text.ToUpper())
            {
            case "1":
                frmSubMenu fStockMenu = new frmSubMenu(frmSubMenu.SubMenuType.Stock, ref sEngine);
                fStockMenu.shortcutString = shortcutString;
                fStockMenu.ShowDialog();
                fStockMenu.Dispose();
                break;

            case "2":
                frmSubMenu fReportMenu = new frmSubMenu(frmSubMenu.SubMenuType.Reports, ref sEngine);
                fReportMenu.shortcutString = shortcutString;
                fReportMenu.ShowDialog();
                fReportMenu.Dispose();
                break;

            case "3":
                frmSubMenu frmOrderMenu = new frmSubMenu(frmSubMenu.SubMenuType.Orders, ref sEngine);
                frmOrderMenu.shortcutString = shortcutString;
                frmOrderMenu.ShowDialog();
                break;

            case "4":
                frmViewTillTransactions fvtt = new frmViewTillTransactions(ref sEngine);
                fvtt.ShowDialog();
                break;

            case "5":
                frmSubMenu fSettingsMenu = new frmSubMenu(frmSubMenu.SubMenuType.Setup, ref sEngine);
                fSettingsMenu.ShowDialog();
                break;

            case "Q":
                this.Close();
                break;

            case "=":
                frmCollect fCollect = new frmCollect(ref sEngine);
                this.Visible = false;
                fCollect.ShowDialog();
                this.Show();
                break;

            case "6":
                frmWeeklySalesSummary fwss = new frmWeeklySalesSummary(ref sEngine);
                fwss.ShowDialog();
                break;

            case "Z":
                if (MessageBox.Show("Insert the USB drive to back up to now.", "Backup", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    FileManagementEngine.BackupToUSBPen(sEngine.CompanyName);
                }
                break;

            case "U":
                frmUpdater fu = new frmUpdater(ref sEngine);
                fu.ShowDialog();
                break;

            case "-1":
                sEngine.SendCommandToTill("OpenTillDrawer");
                break;
            }
            if (InputTextBox("CHOICE").Text != "-")
            {
                InputTextBox("CHOICE").Text = "";
            }
            this.shortcutString = null;
        }