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

namespace HT_SKT_Stock
{
    public partial class FrmStockMenu : Form
    {
        public static FrmStockMenu _Form_StockMenuInstance;
        public String AppPath = "";


        public FrmStockMenu()
        {
            InitializeComponent();

            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FrmStockMenu_KeyDown);

            btnBack.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FrmStockMenu_KeyDown);

            btnMenu.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FrmStockMenu_KeyDown);

            btnStockCheck.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FrmStockMenu_KeyDown);

            btnStocktaking.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FrmStockMenu_KeyDown);

            btnChangeLocation.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FrmStockMenu_KeyDown);
                        
        }

        private void FrmStockMenu_Load(object sender, EventArgs e)
        {
            if (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width == 240)
            {
                resolution.ScreenSize.VGAtoQVGA(this);
            }

            this.MaximizeBox = !this.MaximizeBox;
            this.MinimizeBox = !this.MinimizeBox;

            _Form_StockMenuInstance = this;


            String path = this.GetType().Assembly.GetModules()[0].FullyQualifiedName;
            Int32 en = path.LastIndexOf("\\");
            AppPath = path.Substring(0, en);

            lblUser.Text = "User : " + FrmLogin._Form_LoginInstance.userName;

        }

        private void btnBack_Click(object sender, EventArgs e)
        {
            FrmMainMenu._Form_MainMenuInstance.Show();
            //Bt.ScanLib.Control.btScanDisable();
            //this.Hide();
            this.Close();
        }

        private void btnMenu_Click(object sender, EventArgs e)
        {
            FrmMainMenu._Form_MainMenuInstance.Show();
            //Bt.ScanLib.Control.btScanDisable();
            //this.Hide();
            this.Close();
        }

        private void FrmStockMenu_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode.ToString())
            {

                case "F1":
                    btnBack_Click(sender, e);
                    break;

                case "F4":
                    btnMenu_Click(sender, e);
                    break;
            }
        }

        private void btnBack_KeyDown(object sender, KeyEventArgs e)
        {
            
        }

        private void btnBack_LostFocus(object sender, EventArgs e)
        {
        }

        private void btnStockCheck_Click(object sender, EventArgs e)
        {
            Form frmE = new FrmStockCheck();
            frmE.Show();
            this.Hide();
        }

        private void btnStocktaking_Click(object sender, EventArgs e)
        {
            Form frmE = new FrmStockTaking();
            frmE.Show();
            this.Hide();
        }

        private void btnChangeLocation_Click(object sender, EventArgs e)
        {
            Form frmE = new FrmChangeLocation();
            frmE.Show();
            this.Hide();
        }
    }
}