Ejemplo n.º 1
0
 public SignInUpWindow()
 {
     InitializeComponent();
     rememberMe.IsChecked = false;
     client = new ZaolisServiceClient.ZaolisServiceClient(new InstanceContext(handler));
     if (File.Exists(remembered_path))
     {
         logginedUsers = Load();
         if (logginedUsers.Count > 0)
         {
             MainMenuZaolis mnz = new MainMenuZaolis(logginedUsers, client);
             mnz.Show();
             this.Close();
         }
     }
     registerModel       = new RegisterViewModel(client);
     SignUP.DataContext  = registerModel;
     pgLoading           = loginProgressBar;
     buttonLogin.Content = "LOGIN";
     Task.Run(() => { this.client.Request(); });
 }
Ejemplo n.º 2
0
        private void ButtonLogin_Click(object sender, RoutedEventArgs e)
        {
            Task.Run(() => { this.client.Request(); });
            string login    = logTxtBox_login.Text;
            string password = passwdbox.Password;

            buttonLogin.Content   = pgLoading;
            buttonLogin.IsEnabled = false;
            Task.Run(() =>
            {
                if (client.IsExistsUserByLoginPassword(login, password))
                {
                    client.Connect(login, password); //isActive change
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        UserDTO user = new UserDTO();
                        user         = client.GetUserByLogin(logTxtBox_login.Text);
                        logginedUsers.Add(user);
                        if (rememberMe.IsChecked == true)
                        {
                            Save(logginedUsers);
                        }
                        MainMenuZaolis mnz = new MainMenuZaolis(logginedUsers, client);
                        mnz.Show();
                        this.Close();
                    });
                }
                else
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        buttonLogin.Content   = "LOGIN";
                        buttonLogin.IsEnabled = true;
                        ShowMsg("Error!", "There is no user with such login or password");
                    });
                }
            });
        }