public AuthenticationControlVM(Model.IDutyOfficerRepository _dutyOfficerRepository) { dutyOfficerRepository = _dutyOfficerRepository; UnLoadedCommand = new RelayCommand(() => { ViewModelLocator.Cleanup(); }); LoginCommand = new RelayCommand <object>((commandParameter) => { d = dutyOfficerRepository.GetByLogin(Login); this.Password = ((PasswordBox)commandParameter).Password; if (d == null) { MyMessageBox _myMessageBox = new MyMessageBox(); Messenger.Default.Send("Неверный логин"); _myMessageBox.Show(); } else { if (this.Password == d.PasswordDutyOfficer) { MainWindow mainWindow = new MainWindow(); Messenger.Default.Send(d); mainWindow.Show(); foreach (Window window in Application.Current.Windows) { if ((window as DialogWindow) != null) { window.Close(); } } } else { MyMessageBox _myMessageBox = new MyMessageBox(); Messenger.Default.Send("Неверный пароль"); _myMessageBox.Show(); } } }); CancelCommand = new RelayCommand(() => { Environment.Exit(0); }); }
private void HandleDutyOfficer(Model.DutyOfficer d) { DutyOfficer = d; }
private void HandleDutyOfficer(Model.DutyOfficer d) { CurrentDutyOfficer = d; }