public RegistrationViewModel(RegistrationWindow ThisWindow) { RegistraitionCommand = new RelayCommand(o => { ThisWindow.Close(); new UserWindow().ShowDialog(); }); AutoriseCommand = new RelayCommand(o => { ThisWindow.Close(); }); }
private void OnRegistrationWindowCommandExecuted(object p) { if (Enter != null) { Enter.Close(); } if (Registration != null) { Registration.Close(); } Registration = new RegistrationWindow(); Registration.Show(); }
private void RegistrationViewModel_RegisterConfirmed(User user) { _currentUser = user; _dialogResult = 1; _authenticationWindow.ShowDialog(); _registrationWindow.Close(); }
public void DoRegister(String password, String repassword) { if (password != repassword) { return; } Person person = null; if (IsClient) { person = new Client(); } else { person = new Author(); } person.Login = Login; person.Password = password; person.Name = Name; person.SName = SName; person.Email = Email; person.TimeZone = SelectedTimeZone; PersonRepository.Instance.Register(person); new LogInWindow().Show(); _window.Close(); }
private void Close() { _registrationWindow.Close(); _mainWindow.Show(); }
public RegistrationViewModel(RegistrationWindow ThisWindow) { RegistraitionCommand = new RelayCommand(o => { var passwordBox = o as PasswordBox; if (passwordBox == null) { return; } Password = passwordBox.Password; try { if (Login != null) { if (Password != null) { if (Name != null) { var uow = UnitOfWorkSingleton.Instance; User user = new User(Login, Password, Name); uow.Users.Create(user); uow.SaveChanges(); MainWindow mainWindow = new MainWindow() { DataContext = new MainViewModel(new MonthControlViewModel(user), user) }; mainWindow.Show(); ThisWindow.Close(); } else { MessageBox.Show("Введите имя!"); } } else { MessageBox.Show("Введите пароль"); } } else { MessageBox.Show("Введите имя пользователя!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }); AutoriseCommand = new RelayCommand(o => { var passwordBox = o as PasswordBox; if (passwordBox == null) { return; } LoginPassword = passwordBox.Password; try { if (LoginUN != null)//вылетает { if (LoginPassword != null) { var uow = UnitOfWorkSingleton.Instance; User user = uow.Users.GetElement(LoginUN); if (user != null)//протащить юзера как-нибудь умнее { if (user.Password == LoginPassword) { MainWindow mainWindow = new MainWindow() { DataContext = new MainViewModel(new MonthControlViewModel(user), user) }; mainWindow.Show();// nullReferensExeption за шо ThisWindow.Close(); } else { MessageBox.Show("Неверный пароль!"); } } else { MessageBox.Show("Пользователь не найден!"); } } else { MessageBox.Show("Введите пароль"); } } else { MessageBox.Show("Введите имя пользователя!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }); }
private void ShowRegistrationWindow() { RegistrationWindow registrationWindow = new RegistrationWindow(); DialogResult result = registrationWindow.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { if (RegisterUser(registrationWindow.RegUsername, registrationWindow.RegPassword)) { TryLogin(registrationWindow.RegUsername, registrationWindow.RegPassword); } else { ShowPopUp("Registrierung fehlgeschlagen"); } } else { DisableSidebarOnLogout(); DisableSidebarOnFactoryCleared(); } registrationWindow.Close(); }
/// <summary> /// Конструктор по умолчнию /// </summary> /// <param name="link">ссылка на окно регистрации для зарытия</param> public RegistrationViewModel(RegistrationWindow link) { //Команды AddPhotoCommand = new BaseCommandRelay(AddPhoto); CloseWindowCommand = new BaseCommandRelay(parameter => link.Close()); }