public void LogIn() { try { Channel.Instance.logProxy.LogMessage(Enums.LOGTYPE.INFO, "Log In is clicked."); User user = Channel.Instance.userProxy.Get(UserName); if (user != null) { if (user.Password == Password) { new MainWindow(user).Show(); Window.Close(); } else { MessageBox.Show("Password is incorect!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("User does not exist!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } catch { MessageBox.Show("Connection failed", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } ContentHandler.StartContent(); }
public MainWindowViewModel() { #region starting view content logHandler = LogHandler.Instance; logHandler.MainWindowViewModel = this; ContentHandler.StartContent(); Refresh(); #endregion #region Commands AddUserCommand = new AddUserCommand(this); ViewProfilInfoCommand = new ViewProfilInfoCommand(this); AddTelephoneCommand = new AddTelephoneCommand(this); AddShopCommand = new AddShopCommand(this); ChangeTelephoneCommand = new ChangeTelephoneInfoCommand(this); DeleteTelephoneCommand = new DeleteTelephoneCommand(this); DuplicateTelephoneCommand = new DuplicateTelephoneCommand(this); ChangeShopCommand = new ChangeShopInfoCommand(this); DeleteShopCommand = new DeleteShopCommand(this); LogOutCommand = new LogOutCommand(this); BuyTelephoneCommand = new BuyTelephoneCommand(this); ClearCommand = new ClearCommand(this); UndoCommand = new UndoCommand(this); RedoCommand = new RedoCommand(this); FilterCommand = new FilterCommand(this); RefreshCommand = new RefreshCommand(this); #endregion }