private async void button_identCode_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(lineEdit_account.Text)) { try { if (!IsHandset(lineEdit_account.Text)) { errorProvider.ErrorAlignment = ErrorAlignment.Top; errorProvider.SetError(account_Layout, "手机号格式错误"); return; } int userFlag = await RequestHandle.SendIdentCode(lineEdit_account.Text); button_identCode.Enabled = false; m_TotalTime = 0; m_timer.Start(); button_identCode.BackgroundImage = Properties.Resources.nor_btn; if (userFlag == 0)//未注册 { invite_Layout.Visible = true; } else if (userFlag == 1) { //none } else//2 出错 { errorProvider.ErrorAlignment = ErrorAlignment.Top; errorProvider.SetError(account_Layout, "手机号输入错误"); return; } } catch (Exception ex) { PromptBox.Error(ex.Message); } } else { errorProvider.ErrorAlignment = ErrorAlignment.Top; errorProvider.SetError(account_Layout, "请输入手机号"); } }
private async void button_login_Click(object sender, RibbonControlEventArgs e) { DialogResult result = DialogResult.None; if (String.IsNullOrEmpty(Rigel.UserID)) { LoginWidget loginWidget = new LoginWidget(); result = loginWidget.ShowDialog(); if (result == DialogResult.OK) { if (String.IsNullOrEmpty(Rigel.UserID)) { PromptBox.Error("登录失败!"); return; } else { Regditer.WriteReg(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, StrUserName, Rigel.UserName); Regditer.WriteReg(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, StrUserToken, Rigel.UserToken); button_login.Label = Rigel.UserName; button_login.Image = Properties.Resources.Login; ResetButtonEnable(true); } } } else { result = PromptBox.Prompt("确认退出登录?"); if (result == DialogResult.OK) { await RequestHandle.Logout(Rigel.UserName); Rigel.UserID = ""; Rigel.UserToken = ""; Regditer.WriteReg(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, StrUserToken, String.Empty); button_login.Label = "登录\r\n"; button_login.Image = Properties.Resources.Logout; Globals.ThisAddIn.TaskWidget.Visible = false; ResetButtonEnable(false); } } }
private async Task <bool> LoadUserInfo() { String strUserName = Regditer.GetValue(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, StrUserName); if (!String.IsNullOrEmpty(strUserName)) { String strUserToken = Regditer.GetValue(Regditer.RootKey.CurrentUser, Rigel.UserRegKey, StrUserToken); if (await RequestHandle.TokenValidity(strUserToken)) { Rigel.UserID = strUserName; Rigel.UserName = strUserName; Rigel.UserToken = strUserToken; button_login.Label = Rigel.UserName; ResetButtonEnable(true); return(true); } return(false); } return(false); }
private async void button_login_Click(object sender, EventArgs e) { String strAccount = ""; String identCode = ""; String inviteCode = ""; if (string.IsNullOrEmpty(lineEdit_account.Text)) { errorProvider.ErrorAlignment = ErrorAlignment.Top; errorProvider.SetError(account_Layout, "手机号为空"); return; } if (string.IsNullOrEmpty(lineEdit_identCode.Text)) { errorProvider.ErrorAlignment = ErrorAlignment.Top; errorProvider.SetError(ident_Layout, "验证码为空"); return; } strAccount = lineEdit_account.Text; identCode = lineEdit_identCode.Text; inviteCode = lineEdit_inviteCode.Text; try { bool isLogin = await RequestHandle.Login(strAccount, identCode, inviteCode); if (isLogin) { DialogResult = DialogResult.OK; this.Close(); } } catch (Exception ex) { PromptBox.Error(ex.Message); } }
private async Task <ResourceModel> GetResource() { ResourceModel resModel = null; switch (App.ResourceType) { case ResourceType.Template: case ResourceType.Product: case ResourceType.Predict: case ResourceType.Macro: case ResourceType.Market: case ResourceType.Policy: case ResourceType.Enterprise: case ResourceType.Technology: case ResourceType.Wxreport: case ResourceType.Lsbg: if (App.ItemType == ResourceType.Wdsc) { resModel = await RequestHandle.GetWdscList(CurrentIndex, PrePageCount, "", FilterText); } else if (App.ItemType == ResourceType.Lsjl) { resModel = await RequestHandle.GetLsjlList(CurrentIndex, PrePageCount, "", FilterText); } else if (App.ItemType == ResourceType.Lsbg) { resModel = await RequestHandle.GetLsbgList(CurrentIndex, PrePageCount, "", FilterText); } else { resModel = await RequestHandle.GetTempList(CurrentIndex, PrePageCount, "", FilterText); } break; case ResourceType.Icon: if (App.ItemType == ResourceType.Wdsc) { resModel = await RequestHandle.GetWdscList(CurrentIndex, PrePageCount, "", FilterText); } else if (App.ItemType == ResourceType.Lsjl) { resModel = await RequestHandle.GetLsjlList(CurrentIndex, PrePageCount, "", FilterText); } else { resModel = await RequestHandle.GetIconList(CurrentIndex, PrePageCount, "", FilterText); } break; case ResourceType.Legend: if (App.ItemType == ResourceType.Wdsc) { resModel = await RequestHandle.GetWdscList(CurrentIndex, PrePageCount, "", FilterText); } else if (App.ItemType == ResourceType.Lsjl) { resModel = await RequestHandle.GetLsjlList(CurrentIndex, PrePageCount, "", FilterText); } else { resModel = await RequestHandle.GetLegendList(CurrentIndex, PrePageCount, "", FilterText); } break; /* case ResourceType.Policy: * if (App.ItemType == ResourceType.Wdsc) * { * resModel = await RequestHandle.GetWdscList(CurrentIndex, PrePageCount, "", FilterText); * } * else if (App.ItemType == ResourceType.Lsjl) * { * resModel = await RequestHandle.GetLsjlList(CurrentIndex, PrePageCount, "", FilterText); * } * else * { * resModel = await RequestHandle.GetPolicyList(CurrentIndex, PrePageCount, "", FilterText); * } * break; * case ResourceType.Market: * if (App.ItemType == ResourceType.Wdsc) * { * resModel = await RequestHandle.GetWdscList(CurrentIndex, PrePageCount, "", FilterText); * } * else if (App.ItemType == ResourceType.Lsjl) * { * resModel = await RequestHandle.GetLsjlList(CurrentIndex, PrePageCount, "", FilterText); * } * else * { * resModel = await RequestHandle.GetMarketList(CurrentIndex, PrePageCount, "", FilterText); * } * break; * case ResourceType.Product: * if (App.ItemType == ResourceType.Wdsc) * { * resModel = await RequestHandle.GetWdscList(CurrentIndex, PrePageCount, "", FilterText); * } * else if (App.ItemType == ResourceType.Lsjl) * { * resModel = await RequestHandle.GetLsjlList(CurrentIndex, PrePageCount, "", FilterText); * } * else * { * resModel = await RequestHandle.GetProductList(CurrentIndex, PrePageCount, "产品", FilterText); * } * break; * case ResourceType.Predict: * if (App.ItemType == ResourceType.Wdsc) * { * resModel = await RequestHandle.GetWdscList(CurrentIndex, PrePageCount, "", FilterText); * } * else if (App.ItemType == ResourceType.Lsjl) * { * resModel = await RequestHandle.GetLsjlList(CurrentIndex, PrePageCount, "", FilterText); * } * else * { * resModel = await RequestHandle.GetPredictList(CurrentIndex, PrePageCount, "预测", FilterText); * } * break; * case ResourceType.Macro: * if (App.ItemType == ResourceType.Wdsc) * { * resModel = await RequestHandle.GetWdscList(CurrentIndex, PrePageCount, "", FilterText); * } * else if (App.ItemType == ResourceType.Lsjl) * { * resModel = await RequestHandle.GetLsjlList(CurrentIndex, PrePageCount, "", FilterText); * } * else * { * resModel = await RequestHandle.GetMacroList(CurrentIndex, PrePageCount, "宏观", FilterText); * } * break;*/ case ResourceType.Upload_template: resModel = await RequestHandle.GetUploadTemplateList(CurrentIndex, PrePageCount, "", FilterText); this.label_All.Text = "模板"; this.label_Mark.Text = "图例"; this.label_Records.Text = "图标"; break; case ResourceType.Upload_icon: resModel = await RequestHandle.GetUploadIconList(CurrentIndex, PrePageCount, "", FilterText); break; case ResourceType.Upload_legend: resModel = await RequestHandle.GetUploadTlList(CurrentIndex, PrePageCount, "", FilterText); break; } PageCount = (int)Math.Ceiling((double)resModel.ResCount / PrePageCount); ///*if (resModel.PageCount % PrePageCount > 0) //{ // PageCount++; //}*/ /*PageCount = resModel.ResCount / PrePageCount; * if (resModel.PageCount % PrePageCount > 0) * { * PageCount++; * }*/ if (PageCount == 0) { pageBox.Text = "1"; } else { pageBox.Text = CurrentIndex + "/" + PageCount; } return(resModel); }
private void button_filter_Click(object sender, EventArgs e) { Button button = sender as Button; FilterWidget filterWidget = new FilterWidget(); filterWidget.Location = button.PointToScreen( new Point(button.Location.X - filterWidget.Width, button.Location.Y)); List <GroupItem> group = null; if (App.ResourceType == ResourceType.Template) { group = RequestHandle.GetTempFilter(); } else if (App.ResourceType == ResourceType.Legend) { group = RequestHandle.GetLegendFilter(); } else if (App.ResourceType == ResourceType.Icon) { group = RequestHandle.GetIconFilter(); } else if (App.ResourceType == ResourceType.Macro) { group = RequestHandle.GetMacroFilter(); } else if (App.ResourceType == ResourceType.Market) { group = RequestHandle.GetMarketFilter(); } else if (App.ResourceType == ResourceType.Product) { group = RequestHandle.GetProductFilter(); } else if (App.ResourceType == ResourceType.Predict) { group = RequestHandle.GetPredictFilter(); } else if (App.ResourceType == ResourceType.Technology) { group = RequestHandle.GetTechnologyFilter(); } else if (App.ResourceType == ResourceType.Policy) { group = RequestHandle.GetPolicyFilter(); } else if (App.ResourceType == ResourceType.Enterprise) { group = RequestHandle.GetEnterpriseFilter(); } if (group != null) { filterWidget.AddFilterItem(group); filterWidget.ShowDialog(); List <String> filterList = filterWidget.Selection; FilterText = string.Join(",", filterList); CurrentIndex = 1; UpdateResourceList(); if (PageCount == 0) { pageBox.Text = "1"; } else { pageBox.Text = CurrentIndex + "/" + PageCount; } } }