private async void BtnSave_Clicked(object sender, EventArgs e) { if (!(this.lblTipsOldPwd.Text == "√" && this.lblTipsNewPwd.Text == "√" && this.lblTipsReNewPwd.Text == "√")) { return; } List <Models.UserInfo> list = new List <Models.UserInfo>(); Models.UserInfo ui = new Models.UserInfo(); ui.Account = OptionText_Helper.ReadAllText("Account"); ui.PassWord = MD5_Helper.MD5Encrypt16(this.etyNewPwd.Text); string url = $"/{Version_Helper.versionNumber}/user_/update?Option=PassWord&Account={ui.Account}"; list.Add(ui); var result = await WebApiService_Helper.PostConnectHelperAsync(url, list); if (result[0].Flag) { OptionText_Helper.WriteText("PassWord", ui.PassWord); await DisplayAlert("提示!", "修改成功!", "确认"); await Navigation.PopAsync(); } else { await DisplayAlert("提示!", "修改失败!", "确认"); } }
private async void VcGender_Tapped(object sender, EventArgs e) { string Gender = await DisplayActionSheet("请选择您的性别:", "取消", null, "男", "女", "保密"); if (Gender != "取消" && Gender != null) { this.lblGender.Text = Gender; Models.UserInfo ui = new Models.UserInfo(); ui.Account = OptionText_Helper.ReadAllText("Account"); ui.Gender = Gender; List <Models.UserInfo> list = new List <Models.UserInfo>(); string url = $"/{Version_Helper.versionNumber}/user_/update?Option=Gender&Account={ui.Account}"; list.Add(ui); var result = await WebApiService_Helper.PostConnectHelperAsync(url, list); if (result[0].Flag) { OptionText_Helper.WriteText("Gender", Gender); } else { await DisplayAlert("提示!", "保存失败!", "确认"); } } }
async private void BtnLogin_Clicked(object sender, EventArgs e) { if (this.etyAccount.Text == "" || this.etyAccount.Text == null || this.etyPassWord.Text == "" || this.etyPassWord.Text == null) { this.lblTips.IsVisible = true; this.lblTips.Text = "账号或密码不能为空!"; return; } UserInfo user = new UserInfo(); user.Account = this.etyAccount.Text; user.PassWord = MD5_Helper.MD5Encrypt16(this.etyPassWord.Text); List <UserInfo> list = new List <UserInfo>(); list.Add(user); string url = $"/{Version_Helper.versionNumber}/user_/verification"; var result = await WebApiService_Helper.PostConnectHelperAsync(url, list); TopSeries = new ObservableCollection <UserInfo>(result); Debug.WriteLine(TopSeries[0].Flag); if (TopSeries[0].Flag) { OptionText_Helper.WriteAllText(result[0]); switch (judge) { case "MyPage": await Navigation.PopAsync(); //await Navigation.PushAsync(new MainPage(judge)); break; case "register": await Navigation.PushAsync(new MainPage("")); break; default: await Navigation.PushAsync(new MainPage("")); break; } } }
async private void BtnRegister_Clicked(object sender, EventArgs e) { string account = this.etyAccount.Text; string nickeName = this.etyNickName.Text; string passWord = this.etyPassWord.Text; string rePassWord = this.etyRePassWord.Text; bool Valid = this.lblTipsAccount.IsVisible || this.lblTipsNickName.IsVisible || this.lblTipsPassWord.IsVisible || this.lblTipsNickName.IsVisible; if (Valid) { return; } if (!EmptyValid(account, nickeName, passWord, rePassWord)) { return; } UserInfo user = new UserInfo(); user.Account = account; user.NickName = nickeName; user.PassWord = MD5_Helper.MD5Encrypt16(passWord); List <UserInfo> list = new List <UserInfo>(); list.Add(user); string url = $"/{Version_Helper.versionNumber}/user_/add"; var result = await WebApiService_Helper.PostConnectHelperAsync(url, list); ObservableCollection <UserInfo> Series = new ObservableCollection <UserInfo>(result); Debug.WriteLine(Series[0].Flag); if (Series[0].Flag) { await Navigation.PushAsync(new LoginFile.Login("register", account)); } }
private async void OnDelete_Clicked(object sender, EventArgs e) { var item = (MenuItem)sender; string artNo = item.CommandParameter.ToString(); string uAccount= OptionText_Helper.ReadAllText("Account"); ArticleInfo ai = StoreSeries.Where(a => a.artNo == artNo).FirstOrDefault(); string url = $"/{Version_Helper.versionNumber}/article_/delete?uAccount={uAccount}&artNo={artNo}"; string result = await WebApiService_Helper.PostConnectHelperAsync(url, ""); Debug.WriteLine(result); if (result.Contains("true")) { StoreSeries.Remove(ai); } else { await DisplayAlert("提示:", "删除失败!", "是"); } }
private async void ImgBtnDeleteBlog_Clicked(object sender, EventArgs e) { bool answer = await DisplayAlert("提示:", "确定要删除!", "是", "否"); if (answer) { string uAccount = OptionText_Helper.ReadAllText("Account"); string url = $"/{Version_Helper.versionNumber}/article_/delete?uAccount={uAccount}&artNo={artNo_G}"; string result = await WebApiService_Helper.PostConnectHelperAsync(url, ""); Debug.WriteLine(result); if (result.Contains("true")) { await Navigation.PopAsync(); } else { await DisplayAlert("提示:", "删除失败!", "是"); } } }
private async void BtnSave_Clicked(object sender, EventArgs e) { Models.UserInfo ui = new Models.UserInfo(); #region ui.Account = OptionText_Helper.ReadAllText("Account"); ui.Guid = OptionText_Helper.ReadAllText("Guid"); ui.NickName = OptionText_Helper.ReadAllText("NickName"); ui.Phone = OptionText_Helper.ReadAllText("Phone"); ui.Describe = OptionText_Helper.ReadAllText("Describe"); ui.Introduce = OptionText_Helper.ReadAllText("Introduce"); string Birthday = OptionText_Helper.ReadAllText("Birthday"); if (Birthday != "") { ui.Birthday = Convert.ToDateTime(Birthday); } else { ui.Birthday = DateTime.Now; } #endregion List <Models.UserInfo> list = new List <Models.UserInfo>(); string url = $"/{Version_Helper.versionNumber}/user_/update?Option={judge}&Account={ui.Account}"; switch (judge) { case "NickName": ui.NickName = this.edtString.Text; break; case "Phone": ui.Phone = this.edtString.Text; break; case "Introduce": ui.Introduce = this.edtString.Text; break; case "Describe": ui.Describe = this.edtString.Text; break; case "Birthday": ui.Birthday = this.DPBirthday.Date; ui.Age = DateTime.Now.Year - this.DPBirthday.Date.Year; this.edtString.Text = this.DPBirthday.Date.ToString("yyyy/MM/dd"); break; } list.Add(ui); var result = await WebApiService_Helper.PostConnectHelperAsync(url, list); if (result[0].Flag) { //OptionText_Helper.WriteAllText(list[0]); OptionText_Helper.WriteText(judge, this.edtString.Text); await Navigation.PopAsync(); } else { await DisplayAlert("提示!", "保存失败!", "确认"); } }