public MainWindowViewModel()
        {
            LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                isLoaded = true;
                if (p == null)
                {
                    return;
                }
                p.Hide();
                LoginWindow loginWindow = new LoginWindow();
                loginWindow.ShowDialog();

                if (loginWindow.DataContext == null)
                {
                    return;
                }
                var loginVM = loginWindow.DataContext as LoginWindowViewModel;
                if (loginVM.IsLogin)
                {
                    p.Show();
                }
                else
                {
                    p.Close();
                }
            });

            OpenUnitWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
            {
                UnitWindow unitWindow = new UnitWindow();
                unitWindow.ShowDialog();
            });

            OpenSuppliersWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { SuppliersWindow sW = new SuppliersWindow(); sW.ShowDialog(); });
            OpenCustomersWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CustomersWindow cW = new CustomersWindow(); cW.ShowDialog(); });
            OpenProductsWindowCommand  = new RelayCommand <object>((p) => { return(true); }, (p) => { ProductsWindow pW = new ProductsWindow(); pW.ShowDialog(); });
            OpenUsersWindowCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { UsersWindow pW = new UsersWindow(); pW.ShowDialog(); });
            OpenInputWindowCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { InputWindow pW = new InputWindow(); pW.ShowDialog(); });
            OpenOutputWindowCommand    = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow pW = new OutputWindow(); pW.ShowDialog(); });
        }
예제 #2
0
        private void btnAddProducts_Click(object sender, RoutedEventArgs e)
        {
            ProductsWindow ppw = new ProductsWindow();

            ppw.ShowDialog();
        }