private void Button_Click(object sender, RoutedEventArgs e) { var client = new PutBoxServiceClient(); currentUser = new UserInfo() { Email = loginInput.Text, Password = passwordInput.Password }; AccessGranted = client.Login(currentUser); if (AccessGranted) { loginMessage.Content = "Success"; this.Close(); } else { loginMessage.Content = "Check your credentials"; loginInput.Text = string.Empty; passwordInput.Password = string.Empty; } }
private void Button_Click(object sender, RoutedEventArgs e) { var client = new PutBoxServiceClient(); currentUser = new UserInfo() { Email = loginInput.Text, Password = passwordInput.Password }; Registered = client.Registration(currentUser); if (Registered) { registrationMessage.Content = "Success"; this.Close(); } else { registrationMessage.Content = "Already exist"; loginInput.Text = string.Empty; passwordInput.Password = string.Empty; passwordRepeatInput.Password = string.Empty; } }
public MainWindow() { InitializeComponent(); Hide(); client = new PutBoxServiceClient(); taskBar.Icon = Properties.Resources.pbIcon; var bitmap = Properties.Resources.pbIcon.ToBitmap(); var hBitmap = bitmap.GetHbitmap(); ImageSource wpfBitmap = Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); Icon = wpfBitmap; var registrationWnd = new RegistrationWindow(); var loginWnd = new LoginWindow(); loginWnd.ShowDialog(); if (loginWnd.AccessToRegistration) { registrationWnd.ShowDialog(); if (registrationWnd.Registered) { currentUser = registrationWnd.currentUser; currentUser.Path = Settings.Default.PutBoxDirectory; } } else if (loginWnd.AccessGranted) { currentUser = loginWnd.currentUser; currentUser.Path = Settings.Default.PutBoxDirectory; } else { Close(); } Watch(); }