private void adminScreenButtonEvent(Object Sender, RoutedEventArgs e)
        {
            PasswordPopup popup = new PasswordPopup(MainWindowControl);

            popup.ShowDialog();
        }
示例#2
0
        private void keyEventHandler(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.F2:
                Invoice     invoice;
                MongoClient dbClient = new MongoClient("mongodb://*****:*****@127.0.0.1:27017?authSource=tutorial&readPreference=primary&appname=MongoDB%20Compass&ssl=false");
                try
                {
                    if (App.currentInvoice != null)
                    {
                        invoice = App.currentInvoice;
                    }
                    else
                    {
                        invoice = new Invoice()
                        {
                            Date = DateTime.Now.ToString("dd/M/yyyy")
                        };
                        App.currentInvoice = invoice;
                    }
                    MainWindowControl.Content = new BillingControl(invoice, MainWindowControl, false);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                MainWindowControl.Content = new BillingControl(App.currentInvoice, MainWindowControl, false);
                break;

            case Key.F3:
                MainWindowControl.Content = new InvoiceControl(MainWindowControl);
                break;

            case Key.F4:
                PasswordPopup popup = new PasswordPopup(MainWindowControl);
                popup.ShowDialog();
                break;

            case Key.Escape:
                if (MainWindowControl.Content is BillingControl)
                {
                    BillingControl billingControl = MainWindowControl.Content as BillingControl;
                    bool           result         = billingControl.exitBilling();
                    if (result)
                    {
                        MainWindowControl.Content = new HomeControl(MainWindowControl);
                    }
                }
                else
                {
                    MainWindowControl.Content = new HomeControl(MainWindowControl);
                }
                break;

            case Key.Insert:
                if (MainWindowControl.Content is ViewItemsControl)
                {
                    Product product = new Product()
                    {
                        Barcode      = "",
                        Name         = "",
                        SellingPrice = "",
                        Cost         = "",
                        MRP          = "",
                        stock        = 0,
                    };
                    ViewItemsControl control = MainWindowControl.Content as ViewItemsControl;
                    control.AdminControl.Content = new AddItemsControl(product);
                }
                break;
            }
        }