private async void FindPassword(string email) { try { pr_Load.Visibility = Visibility.Visible; SignM lm = new SignM() { email = email, }; string results = await WebClientClass.PostResults_Login(new Uri(" https://picaapi.picacomic.com/auth/forgot-password"), JsonConvert.SerializeObject(lm)); LoginModel re = JsonConvert.DeserializeObject <LoginModel>(results); if (re.code == 200) { messShow.Show("已發送", 3000); } else { messShow.Show(re.message, 3000); pr_Load.Visibility = Visibility.Collapsed; } } catch (Exception ex) { pr_Load.Visibility = Visibility.Collapsed; if (ex.HResult == -2147012867) { messShow.Show("檢查你的網絡連接!", 3000); } else { messShow.Show("發送失敗了,挂個VPN試試?", 3000); } } }
private async void Sign(string email, string password, string name, string date, string gender) { try { pr_Load.Visibility = Visibility.Visible; SignM lm = new SignM() { email = email, password = password, birthday = date, name = name, gender = gender }; string results = await WebClientClass.PostResults_Login(new Uri("https://picaapi.picacomic.com/auth/register"), JsonConvert.SerializeObject(lm)); LoginModel re = JsonConvert.DeserializeObject <LoginModel>(results); if (re.code == 200) { SettingHelper.Set_Email(email); SettingHelper.Set_Password(password); p_Login.Visibility = Visibility.Visible; p_Sign.Visibility = Visibility.Collapsed; l_txt_email.Text = SettingHelper.Get_Email(); l_txt_password.Password = SettingHelper.Get_Password(); Login(l_txt_email.Text, l_txt_password.Password); } else { messShow.Show(re.message, 3000); pr_Load.Visibility = Visibility.Collapsed; } } catch (Exception ex) { pr_Load.Visibility = Visibility.Collapsed; if (ex.HResult == -2147012867) { messShow.Show("檢查你的網絡連接!", 3000); } else { messShow.Show("注冊失敗了,换个邮箱或挂個VPN試試?", 3000); } } }
private async void Login(string email, string password) { try { pr_Load.Visibility = Visibility.Visible; LoginM lm = new LoginM() { email = email, password = password }; string results = await WebClientClass.PostResults_Login(new Uri("https://picaapi.picacomic.com/auth/sign-in"), JsonConvert.SerializeObject(lm)); LoginModel re = JsonConvert.DeserializeObject <LoginModel>(results); if (re.code == 200) { SettingHelper.Set_Authorization(re.data.token); SettingHelper.Set_Email(email); SettingHelper.Set_Password(password); this.Frame.Navigate(typeof(MainPage)); } else { messShow.Show(re.message, 3000); } } catch (Exception ex) { if (ex.HResult == -2147012867) { messShow.Show("檢查你的網絡連接!", 3000); } else { messShow.Show("登錄失敗了,檢查下你的輸入?", 3000); } } finally { pr_Load.Visibility = Visibility.Collapsed; } }