コード例 #1
0
        public MainViewModel()
        {
            ThoatCommand = new RelayCommand <Window>((p) =>
            {
                return(true);
            },
                                                     (p) =>
            {
                p.Hide();
                DangNhapWindow window = new DangNhapWindow();
                window.ShowDialog();
                p.Close();
            });

            KhachHangCommand = new RelayCommand <Window>((p) =>
            {
                return(true);
            },
                                                         (p) =>
            {
                KhachHangWindow window = new KhachHangWindow();
                window.ShowDialog();
            });
        }
        public MainViewModel()
        {
            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 LoginViewModel;

                if (loginVM.IsLogin)
                {
                    p.Show();
                }
                else
                {
                    p.Close();
                }
            }
                                                            );

            LogoutCommand = new RelayCommand <object>((p) => { return(true); }, (p) => {
                System.Windows.Application.Current.Shutdown();
            });
            ProductCommand   = new RelayCommand <object>((p) => { return(true); }, (p) => { ProductDetailPage wd = new ProductDetailPage(); wd.ShowDialog(); });
            SettingsCommand  = new RelayCommand <object>((p) => { return(true); }, (p) => { SettingsWindow wd = new SettingsWindow(); wd.ShowDialog(); });
            EmployeeCommand  = new RelayCommand <object>((p) => { return(true); }, (p) => { NhanVienWindow wd = new NhanVienWindow(); wd.ShowDialog(); });
            KhuyenMaiCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { KhuyenMaiWindow wd = new KhuyenMaiWindow(); wd.ShowDialog(); });
            StoreCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { StoreWindow wd = new StoreWindow(); wd.ShowDialog(); });
            KhachHangCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { KhachHangWindow wd = new KhachHangWindow(); wd.ShowDialog(); });
            ProducerCommand  = new RelayCommand <object>((p) => { return(true); }, (p) => { NSXWindow wd = new NSXWindow(); wd.ShowDialog(); });
            OrderCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { BillWindow wd = new BillWindow(); wd.ShowDialog(); });
        }