예제 #1
0
        private void Menupanel_LogoutEventHandler(object sender, EventArgs e)
        {
            LoginWindown windown = new LoginWindown();

            windown.Show();
            this.Close();
        }
예제 #2
0
        private void btnSignUp_Click(object sender, RoutedEventArgs e)
        {
            string password   = PasswordBox.Password;
            string repassword = RePasswordBox.Password;

            if (password.Equals(repassword))
            {
                string user = usernameBox.Text.Trim();
                if (!user.Equals(""))
                {
                    //chưa authorized
                    string     fullname = fullnameBox.Text;
                    UserSignup signup   = new UserSignup()
                    {
                        FullName = fullname,
                        Password = password,
                        Username = user,
                        Avatar   = 0
                    };
                    using (HttpClient client = new HttpClient())
                    {
                        client.BaseAddress = new Uri(Ultis.Ultils.url);
                        client.DefaultRequestHeaders.Accept.Clear();
                        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                        HttpResponseMessage response = client.PostAsJsonAsync("/api/Users/Register", signup).Result;
                        if (response.IsSuccessStatusCode)
                        {
                            LoginWindown windown = new LoginWindown();
                            windown.SetAccount(user, password);
                            windown.Show();
                            this.Close();
                        }
                        else
                        {
                            _404Mess mess = response.Content.ReadAsAsync <_404Mess>().Result;
                            ErrLable.Content = mess.Message;
                        }
                    }
                }
                else
                {
                    ErrLable.Content = "Username not empty";
                }
            }
            else
            {
                ErrLable.Content = "Password is not match";
            }
        }
예제 #3
0
        private void loginbt_Click(object sender, RoutedEventArgs e)
        {
            LoginWindown lgwindown = new LoginWindown();

            lgwindown.Show();
        }