protected void onPopupData(HsActionKey actionKey, T data) { this.PopupData?.Invoke(this, new HsEventArgs <HsActionKey, T>() { Data = actionKey, Data2 = data }); }
protected override async void callAction(HsActionKey actionKey, object item) { try { if (actionKey == SysActionKeys.UserDo1) { List <string> datas = new List <string>(); foreach (IControlValue control in _controls) { control?.Validate(); datas.Add(control == null ? string.Empty : control.ControlValue); } this.onPopupData(SysActionKeys.择数据, datas); await PopupNavigation.PopAsync(); } else if (actionKey == SysActionKeys.UserDo2) { await PopupNavigation.PopAsync(); } } catch (Exception ex) { HsToastHelper.ShowError(ex.Message); } }
protected override async Task callAction(HsActionKey actionKey, HsLabelValue item) { if (actionKey == SysActionKeys.UserDo1) //查看原始单据 { this.onOpenDJ(item, true); } else if (actionKey == SysActionKeys.UserDo2) //查看流程步骤 { await Navigation.PushAsync(new Form_HsLcspjl_Show(item)); } else if (actionKey == SysActionKeys.UserDo3) //审批 { Panel_HsLcspjl panel = new Panel_HsLcspjl(item); panel.UpdateComplete += new EventHandler <HsEventArgs <object> >(async(sender, e) => { try { await this.callRetrieve(false); } catch (Exception ex) { this.ShowError(ex.Message); } }); await Navigation.PushAsync(panel); } else { await base.callAction(actionKey, item); } }
protected override async void callAction(HsActionKey actionKey, object item) { try { if (actionKey == SysActionKeys.UserDo1) { ucOldPassword.Validate(); ucNewPassword.Validate(); ucNewPassword2.Validate(); if (ucNewPassword.ControlValue != ucNewPassword2.ControlValue) { throw new HsException("新密码与确认密码不一致"); } await GetWSUtil().ChangePassword( GetLoginData().ProgressId, ucOldPassword.ControlValue, ucNewPassword.ControlValue); await this.DisplayAlert("密码修改成功", "", "确定"); await PopupNavigation.PopAsync(); } else if (actionKey == SysActionKeys.UserDo2) { await PopupNavigation.PopAsync(); } } catch (Exception ex) { this.ShowError(ex.Message); } }
protected virtual void callAction(HsActionKey actionKey, object data) { switch (actionKey) { default: throw new HsException($"未知的命令参数【{actionKey}】"); } }
protected virtual async Task callAction(HsActionKey actionKey, HsLabelValue item) { if (actionKey == SysActionKeys.新建) { await callNew(); } else { await callDoData(actionKey, item); } }
protected override async Task callAction(HsActionKey actionKey, HsLabelValue item) { if (actionKey == SysActionKeys.UserDo1) { await Navigation.PushAsync(new Form_Sdrdlxr_Operation(item)); } else { await base.callAction(actionKey, item); } }
protected override async Task callAction(HsActionKey actionKey, HsLabelValue item) { if (actionKey == SysActionKeys.刷新) { await callRetrieve(true); } else { await base.callAction(actionKey, item); } }
protected override async Task <string> doDataItem(HsActionKey actionKey, HsLabelValue item) { if (actionKey == SysActionKeys.除) { return(await this.callRemoteDoData(item, "Delete_Kh")); } else { return(await base.doDataItem(actionKey, item)); } }
protected override async Task <string> doDataItem(HsActionKey actionKey, HsLabelValue item) { if (actionKey == SysActionKeys.除) { this.datas.Remove(item); return(""); } else { return(await base.doDataItem(actionKey, item)); } }
protected override async Task <string> callDoData(HsActionKey actionKey, HsLabelValue item) { string result = await base.callDoData(actionKey, item); if (!string.IsNullOrWhiteSpace(result)) { this.ShowInformation(result); await callRetrieve(false); } return(result); }
protected override async Task callAction(HsActionKey actionKey, HsLabelValue item) { if (actionKey == HsOAActionKeys.查看流程审批记录) //查看审批记录 { Form_HsLcspjl_Show form = new Form_HsLcspjl_Show(item.GetValueByLabel("Djlx"), item.GetValueByLabel("DjId")); await Navigation.PushAsync(form); } else { await base.callAction(actionKey, item); } }
protected override async void callAction(HsActionKey actionKey, object data) { try { if (actionKey == SysActionKeys.UserDo1) { await this.downloadAndOpen(data as HsFile); } } catch (Exception e) { this.ShowError(e.Message); } }
protected override async Task <string> doDataItem(HsActionKey actionKey, HsLabelValue item) { if (actionKey == SysActionKeys.UserDo1) { return(await this.callRemoteDoData(item, "Submit_Xm")); } else if (actionKey == SysActionKeys.UserDo2) { return(await this.callRemoteDoData(item, "UnSubmit_Xm")); } else { return(await base.doDataItem(actionKey, item)); } }
protected override void callAction(HsActionKey actionKey, object data) { if (actionKey == SysActionKeys.UserDo1) { this._takePhoto(); } else if (actionKey == SysActionKeys.UserDo2) { this._selectPhoto(); } else if (actionKey == SysActionKeys.除) { this.datas.Remove(data as HsImage); } }
protected override async Task callAction(HsActionKey actionKey, HsLabelValue item) { try { if (actionKey == SysActionKeys.UserDo3) //回款记录 { await Navigation.PushAsync(new Form_Sdrdhthkjl_Query2(item)); } else { await base.callAction(actionKey, item); } } catch (Exception e) { this.ShowError(e.Message); } }
protected virtual async Task <string> callDoData(HsActionKey actionKey, HsLabelValue item) { if (item == null) { throw new HsException("选中数据不是有效的HsLabelValue对象。"); } bool result = await this.DisplayAlert($"是否{actionKey.Label}数据?", "", "是", "否"); if (result) { return(await this.doDataItem(actionKey, item)); } else { return(await Task.FromResult("")); } }
protected override async void callAction(HsActionKey actionKey, object item) { try { if (actionKey == SysActionKeys.UserDo1) //重置 { this.onPopupData(SysActionKeys.择数据, string.Empty); await PopupNavigation.PopAsync(); } else if (actionKey == SysActionKeys.UserDo2) //取消 { await PopupNavigation.PopAsync(); } } catch (Exception ex) { this.ShowError(ex.Message); } }
protected override async void callAction(HsActionKey actionKey, object data) { try { if (actionKey == SysActionKeys.UserDo1) { Popup_Help helpPage = new Popup_Help(); helpPage.PopupData += new EventHandler <HsEventArgs <HsActionKey, object> >(async(sender, e) => { try { if (e.Data == SysActionKeys.注销) { await this._logout(); } else if (e.Data == SysActionKeys.修改密码) { await PopupNavigation.PushAsync(new Panel_ChangePassword()); } } catch (Exception ex) { this.ShowError(ex.Message); } }); await PopupNavigation.PushAsync(helpPage); } else { base.callAction(actionKey, data); } } catch (Exception e) { this.ShowError(e.Message); } }
protected abstract void callAction(HsActionKey actionKey, object item);
protected override async void callAction(HsActionKey actionKey, object item) { try { if (actionKey == SysActionKeys.关闭) { await PopupNavigation.PopAsync(); } else if (actionKey == SysActionKeys.修改密码) { callAction(SysActionKeys.关闭, null); this.onPopupData(actionKey, null); } else if (actionKey == SysActionKeys.UserDo1) { //清除缓存 long size = await HsDependencyService <IPlatformExtension> .Instance().DirectoryDelete("Cache"); await this.DisplayAlert("缓存删除成功。", size != 0?$"释放空间{size.GetFileSizeString()}" : "无缓存文件", "确定"); callAction(SysActionKeys.关闭, null); } else if (actionKey == SysActionKeys.UserDo2) { //获取新版本 HsLabelValue lvVersion = await getLastestIPAInfo(); //取版本号 HsVersion version = HsVersion.Parse(lvVersion.GetValueByLabel("Version")); string upgradeUri = lvVersion.GetValueByLabel("UpgradeURI"); //检查版本最后一位,如果是奇数表明是一般更新,偶数表明是强制更新 IPlatformExtension pe = DependencyService.Get <IPlatformExtension>(); HsVersion currentVersion = HsVersion.Parse(pe.GetApplicationVersion()); if (pe != null && version > currentVersion) //存在新版本 { if (version.Type == HsVersion.EType.Force) { await this.DisplayAlert($"发现新版本 {version},请立即更新", $"当前版本 {currentVersion}", "确定"); pe.OpenURL(upgradeUri); } else { if (await this.DisplayAlert($"发现新版本 {version},是否更新", $"当前版本 {currentVersion}", "是", "否")) { pe.OpenURL(upgradeUri); } } } else { await this.DisplayAlert("当前是最新版本", $"当前版本 {currentVersion}", "确定"); } callAction(SysActionKeys.关闭, null); } else if (actionKey == SysActionKeys.注销) { //注销 if (await this.DisplayAlert("是否要注销?", "", "是", "否")) { this.onPopupData(actionKey, null); callAction(SysActionKeys.关闭, null); } } } catch (Exception ex) { this.ShowError(ex.Message); } }
protected virtual async Task <string> doDataItem(HsActionKey actionKey, HsLabelValue item) { await Task.Delay(1); throw new HsException($"未知的ActionKey【{actionKey}】"); }
protected override async Task <string> doDataItem(HsActionKey actionKey, HsLabelValue item) { if (actionKey == HsOAActionKeys.发起自由流程) //发起自由流程 { throw new HsException("未实现发起自由流程逻辑"); } else if (actionKey == HsOAActionKeys.发起规则流程) //发起规则流程 { #region 发起规则流程 LoginData loginData = GetLoginData(); string fqr = item.GetValueByLabel("Fqr"); if (fqr != loginData.Username) { throw new HsException($"流程只能由【{fqr}】发起。"); } List <HsLabelValue> lcmbs = await((HsOAWSUtil)GetWSUtil()).GetHsLcmbs(loginData.ProgressId, this.djlx); if (lcmbs.Count < 1) { throw new HsException("未找到符合条件的流程模版"); } UcAutoCompleteInput.AutoCompleteDataPopupPage page = new UcAutoCompleteInput.AutoCompleteDataPopupPage("流程模版", lcmbs) { UserDo1Text = "确定" }; page.PopupData += new EventHandler <HsEventArgs <HsActionKey, string> >(async(sender, e) => { try { //通过获取的模版Id发起流程 if (!string.IsNullOrWhiteSpace(e.Data2)) { string result = await((HsOAWSUtil)GetWSUtil()).StartRegularHsLc(GetLoginData().ProgressId, e.Data2, item.GetValueByLabel("DjId")); this.ShowInformation(result); await callRetrieve(false); } } catch (Exception ex) { this.ShowError(ex.Message); } }); await PopupNavigation.PushAsync(page); return(await Task.FromResult("")); #endregion } else if (actionKey == HsOAActionKeys.终止流程) //终止流程 { #region 终止流程 LoginData loginData = GetLoginData(); string fqr = item.GetValueByLabel("Fqr"); if (fqr != loginData.Username) { throw new HsException($"流程只能由【{fqr}】终止。"); } string result = await((HsOAWSUtil)GetWSUtil()).OverHsLc(loginData.ProgressId, this.djlx, item.GetValueByLabel("DjId")); this.ShowInformation(result); await this.callRetrieve(false); return(await Task.FromResult("")); #endregion } else { return(await base.doDataItem(actionKey, item)); } }