示例#1
0
        public void Initialize()
        {
            _viewModel = new MainWindowViewModel();
            _view      = new MainWindow {
                DataContext = _viewModel
            };
            MainWindowNavigator.NavFrame     = _view.NavigationFrame;
            MainWindowNavigator.ButtonMethod = SetButtons;

            _viewModel.NavChange     = new RelayCommand(ExecuteNavChangeCommand);
            _viewModel.NewCommand    = new RelayCommand(MainWindowNavigator.OnNew);
            _viewModel.EditCommand   = new RelayCommand(MainWindowNavigator.OnEdit);
            _viewModel.SaveCommand   = new RelayCommand(MainWindowNavigator.OnSave);
            _viewModel.DeleteCommand = new RelayCommand(MainWindowNavigator.OnDelete);
            _viewModel.IsAdmin       = ApplicationData.User.IsAdmin;

            RegisterControllers();

            MainWindowNavigator.InitializePages();
            _viewModel.UserPages  = MainWindowNavigator.UserPages;
            _viewModel.AdminPages = MainWindowNavigator.AdminPages;

            MainWindowNavigator.NavigateToFirstPage();
            _view.ShowDialog();
        }