Ejemplo n.º 1
0
        private void NewButton_Click(object sender, RoutedEventArgs e)
        {
            AccountCreationWindow accountCreationWindow = new AccountCreationWindow();

            accountCreationWindow.ShowDialog();
            Close();
        }
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (LoginManager.LoginSession.ConnectionState == false)
            {
                if (e.Key == Key.F6)
                {
                    ShowLoginWindow();
                }
                else if (e.Key == Key.Escape)
                {
                    if (MessageBox.Show("Voulez-vous quitter l'application?", "Gestionnaire de stock", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        Application.Current.Shutdown();
                    }
                }
                else
                {
                    MessageBox.Show("Veuillez vous connecter.");
                }
            }
            else
            {
                if (e.Key == Key.Escape)
                {
                    if (MessageBox.Show("Voulez-vous quitter l'application?", "Gestionnaire de stock", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        Application.Current.Shutdown();
                    }
                }

                if (e.Key == Key.F1)
                {
                    MainFrame.Content = new ArticlesListManagementPage();
                }

                if (e.Key == Key.F2)
                {
                    MainFrame.Content = new SalesManagementPage();
                }

                if (e.Key == Key.F3)
                {
                    MainFrame.Content = new InventoryManagementPage();
                }

                if (e.Key == Key.F5)
                {
                    AlertWindow alertWindow = new AlertWindow();
                    alertWindow.Show();
                }

                if (e.Key == Key.F6)
                {
                    ShowLoginWindow();
                }

                if (e.Key == Key.F7)
                {
                    AccountCreationWindow accountCreationWindow = new AccountCreationWindow();
                    accountCreationWindow.ShowDialog();
                }
            }
        }