public void Initialize() { var view = new MainWindow(); mViewModel = new MainWindowViewModel() { StartCommand = new RelayCommand(ExecuteStartCommand), CostMonthCommand = new RelayCommand(ExecuteCostMonthCommand), CostUnitCommand = new RelayCommand(ExecuteCostUnitCommand), VehiclesCommand = new RelayCommand(ExecuteVehiclesCommand), EmployeesCommand = new RelayCommand(ExecuteEmployeesCommand), UnitsCommand = new RelayCommand(ExecuteUnitsCommand), UsersCommand = new RelayCommand(ExecuteUsersCommand), NewItemCommand = new RelayCommand(ExecuteNewItemCommand), SaveItemCommand = new RelayCommand(ExecuteSaveItemCommand), DeleteItemCommand = new RelayCommand(ExecuteDeleteItemCommand) }; mViewModel.Visibility = Visibility.Hidden; if (CurrentUser.isAdmin) { mViewModel.Visibility = Visibility.Visible; } view.DataContext = mViewModel; startControlController = new StartControlController(); mViewModel.ActiveViewModel = startControlController.Initialize(); startControlViewModel = (StartControlViewModel)mViewModel.ActiveViewModel; view.Show(); }
public void ExecuteStartCommand(object obj) { startControlController = new StartControlController(); mViewModel.ActiveViewModel = startControlController.Initialize(); startControlViewModel = (StartControlViewModel)mViewModel.ActiveViewModel; startControlController.CurrentUser = CurrentUser; mViewModel.ButtonsEnabled = false; mViewModel.StartCurrentBackColor = new SolidColorBrush(Colors.DodgerBlue); mViewModel.StartCurrentForeColor = new SolidColorBrush(Colors.White); mViewModel.CostMonthCurrentBackColor = new SolidColorBrush(Colors.White); mViewModel.CostMonthCurrentForeColor = new SolidColorBrush(Colors.Black); mViewModel.CostBusinessUnitCurrentBackColor = new SolidColorBrush(Colors.White); mViewModel.CostBusinessUnitCurrentForeColor = new SolidColorBrush(Colors.Black); mViewModel.VehiclesCurrentBackColor = new SolidColorBrush(Colors.White); mViewModel.VehiclesCurrentForeColor = new SolidColorBrush(Colors.Black); mViewModel.EmployeeCurrentBackColor = new SolidColorBrush(Colors.White); mViewModel.EmployeeCurrentForeColor = new SolidColorBrush(Colors.Black); mViewModel.BusinessUnitCurrentBackColor = new SolidColorBrush(Colors.White); mViewModel.BusinessUnitCurrentForeColor = new SolidColorBrush(Colors.Black); mViewModel.UserCurrentBackColor = new SolidColorBrush(Colors.White); mViewModel.UserCurrentForeColor = new SolidColorBrush(Colors.Black); }