private void Save() { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; Organization vItem = this.Organization; if (this.Organization == null) { vItem = new Organization(); vItem.Guid = Guid.NewGuid().ToString().ToUpper(); vItem.ParentID = this.ParentOrgan.Guid; vItem.DataID = 0; vItem.Name = this.tbName.Text; vItem.Explain = this.tbExplain.Text; vItem.Module = Guid.Empty.ToString(); } vItem.Name = this.tbName.Text; vItem.Explain = this.tbExplain.Text; //vItem.Module = this.tbModule.Tag.ToString(); vItem.Address = this.tbAddress.Text; vItem.Contact = this.tbContact.Text; vItem.Tel = this.tbTel.Text; vItem.Fax = this.tbFax.Text; vItem.Email = this.tbEMail.Text; vItem.Homepage = this.tbHomePage.Text; vItem.Remarks = this.tbRemarks.Text; DataPortal <Organization> dp = new DataPortal <Organization>(); InvokeTask task = null; if (this.Organization == null) { task = dp.BeginInsert(vItem); } else { task = dp.BeginUpdate(vItem); } task.Completed += (s, e) => { this.Cursor = c; this.btnOK.IsEnabled = true; if (task.Error != null) { MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.DataEntity = vItem; this.DialogResult = true; //this.Close(); } }; }
public override void StartModule(object module) { if (!ModuleManager.DemandPrivileges(module)) { return; } SLContext.Instance.Shell.LoadModule(module); //记录日志 string loginID = this.Account.LoginID; string ip = string.Empty; string mName = ModuleManager.GetModuleName(module); try { ip = System.Windows.Application.Current.Host.InitParams["ClientIP"]; } catch { } InvokeTask task2 = new InvokeTask(); ILogService logService = ServiceContainer.GetService <ILogService>(task2); logService.Log(loginID, string.Format("{0}-打开模块{1}", loginID, mName), string.Empty, ip); task2.Completed += (s2, e2) => { }; }
void UpdateItem() { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; this.AppSetting.Key = this.tbName.Text; this.AppSetting.Category = this.tbCategory.Text; this.AppSetting.Value = this.tbValue.Text; this.AppSetting.Description = this.tbDescription.Text; DataPortal <AppSetting> dp = new DataPortal <AppSetting>(); dp.BeginUpdate(this.AppSetting).Completed += (s, e2) => { InvokeTask task = s as InvokeTask; if (task.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.Cursor = c; this.btnOK.IsEnabled = true; this.DialogResult = true; this.Close(); } }; }
private void btnKill_Click(object sender, RoutedEventArgs e) { IList <WFInstance> vList = this.dgFlow.ItemsSource as IList <WFInstance>; IList <WFInstance> xList = vList.Where(p => p.Checked).ToList(); if (xList.Count > 0) { MsgBoxWindow.MsgBoxCloseCallBack callback = (s, e2) => { MsgBoxWindow.MsgBoxCloseCallBackArgs ex = e2 as MsgBoxWindow.MsgBoxCloseCallBackArgs; int index = 0; string cause = string.Format("{0}手动终止", ContextHelper.Account.LoginID); InvokeTask task = new InvokeTask(); IWorkflowService service = ServiceContainer.GetService <IWorkflowService>(task); service.Terminate(new Guid(xList[index].ID), cause); task.Completed += (s3, e3) => { if (task.Error != null) { MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { if (index == xList.Count - 1) { this.dgFlow.ItemsSource = vList; } else { vList.Remove(xList[index]); index++; service.Terminate(new Guid(xList[index].ID), cause); } } }; for (int i = 0; i < xList.Count; i++) { service.Terminate(new Guid(xList[i].ID), cause); vList.Remove(xList[i]); } foreach (var item in xList) { service.Terminate(new Guid(item.ID), cause); vList.Remove(item); } }; MsgBoxWindow msgBox = new MsgBoxWindow(); msgBox.Show("操作提示", "确定要终止选中的流程实例?", MsgBoxWindow.MsgIcon.Question, MsgBoxWindow.MsgBtns.YesNo, callback); } }
void UpdateAccount() { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; this.Account.Name = this.tbName.Text; this.Account.Description = this.tbDescription.Text; this.Account.Leader = this.cbLeader.IsChecked.HasValue ? (this.cbLeader.IsChecked.Value ? 1 : 0) : 0; List <string> members = new List <string>(this.memberList.Count); foreach (var item in this.memberList) { members.Add(item.RoleName); } List <ACL> pList = new List <ACL>(); foreach (var item in this.permissionList) { pList.Add(new ACL { PObject = item.PObject, PType = item.PType, Privileger = item.Privileger, PValue = item.PValue }); } InvokeTask task = new InvokeTask(); IAccountService service = ServiceContainer.GetService <IAccountService>(task); service.UpdateAccount(this.Account, this.tbPassword.Text, members, pList); task.Completed += (s, e2) => { if (task.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.Cursor = c; this.btnOK.IsEnabled = true; this.DialogResult = true; this.Close(); } }; }
void UpdateRole() { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; this.Role.Name = this.tbName.Text; this.Role.Description = this.tbDescription.Text; List <string> members = new List <string>(this.memberList.Count); foreach (var item in this.memberList) { members.Add(item.LoginID); } List <ACL> pList = new List <ACL>(); foreach (var item in this.permissionList) { pList.Add(new ACL { PObject = item.PObject.ToUpper(), PType = item.PType, Privileger = item.Privileger, PValue = item.PValue }); } InvokeTask task = new InvokeTask(); IRoleService service = ServiceContainer.GetService <IRoleService>(task); service.UpdateRole(this.Role, members, pList); task.Completed += (s, e2) => { if (task.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.Cursor = c; this.btnOK.IsEnabled = true; this.DialogResult = true; this.Close(); } }; }
private void OnDelete(object sender, MouseButtonEventArgs e) { var deletes = this.accountList.Where(p => p.Checked).ToList(); if (deletes.Count == 0) { MessageBox.Show("请先选择要删除的帐号!"); } else { if (MessageBox.Show("是否确定删除所选择的帐号?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { EAS.Controls.Window.ShowLoading("正在删除帐号.."); int index = 0; foreach (Account item in deletes) { InvokeTask task = new InvokeTask(); IAccountService service = ServiceContainer.GetService <IAccountService>(task); service.Delete(item); task.Completed += (s, e2) => { if (task.Error != null) { EAS.Controls.Window.HideLoading(); MessageBox.Show("删除帐号时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { index++; if (index == deletes.Count) { foreach (Account pItem in deletes) { this.accountList.Remove(pItem); } this.dataAccounts.ItemsSource = null; this.dataAccounts.ItemsSource = this.accountList; EAS.Controls.Window.HideLoading(); } } }; } } } }
private void OnUnstall(object sender, MouseButtonEventArgs e) { var deletes = moduleList.Where(p => p.Checked).ToList(); if (deletes.Count == 0) { MessageBox.Show("请先选择要卸载的模块!"); } else { if (MessageBox.Show("是否确定卸载所选择的模块?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { EAS.Controls.Window.ShowLoading("正在卸载模块..."); int index = 0; foreach (Module item in deletes) { InvokeTask task = new InvokeTask(); IModuleService service = ServiceContainer.GetService <IModuleService>(task); service.UnstallModule(item); task.Completed += (s, e2) => { if (task.Error != null) { EAS.Controls.Window.HideLoading(); MessageBox.Show("卸载模块时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { index++; if (index == deletes.Count) { foreach (Module pItem in deletes) { this.moduleList.Remove(pItem); } this.dataList.ItemsSource = null; this.dataList.ItemsSource = this.moduleList; EAS.Controls.Window.HideLoading(); } } }; } } } }
private void Apply() { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; if (this.selectACL != null) { this.selectACL.PValue = this.GetPermissionValue(); } if (this.tbName.Text.Trim() == string.Empty) { MessageBox.Show("模块名称不能为空", "提示", MessageBoxButton.OK); this.tcMain.SelectedIndex = 0; this.tbName.Focus(); return; } this.Module.Name = this.tbName.Text; this.Module.Description = this.tbDescription.Text; this.Module.Url = this.tbUrl.Text; InvokeTask task = new InvokeTask(); IModuleService service = ServiceContainer.GetService <IModuleService>(task); service.UpdateModule(this.Module, (List <ACL>) this.permissionList); task.Completed += (s, e2) => { if (task.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.Cursor = c; this.btnOK.IsEnabled = true; this.DialogResult = true; this.Close(); } }; }
public InvokeTask GetCleanTask() { InvokeTask task; if ((task = _invokeTasks.FirstOrDefault(t => t.active == false)) == null) { task = new InvokeTask(); _invokeTasks.Add(task); } else { task.Reset(); } return(task); }
private void btnOK_Click(object sender, RoutedEventArgs e) { if (this.tbPass1.Password != this.tbPass1.Password) { MessageBox.Show("您两次输入的密码不一致,请重新确定密码。"); this.tbPass1.Focus(); return; } if (this.tbPass1.Password == string.Empty) { if (MessageBox.Show("您要将密码设置为空密码,这样会使您的工作和数据很容易被窃取。\n系统强烈建议您不要将密码设置为空密码,是否要设定密码为空密码?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) { this.tbPass1.Focus(); return; } } Cursor c = this.Cursor; this.Cursor = Cursors.Wait; InvokeTask task = new InvokeTask(); IAccountService service = ServiceContainer.GetService <IAccountService>(task); service.UpdatePassword(this.loginid, this.tbPass1.Password); task.Completed += (s, e2) => { this.Cursor = c; if (task.Error != null) { if (task.Error.InnerException != null) { MessageBox.Show(task.Error.InnerException.Message, "密码修改过程中出现未知错误,请记录下面的异常信息,并通知您的系统管理员", MessageBoxButton.OK); } else { MessageBox.Show("密码修改过程中出现未知错误,请记录下面的异常信息,并通知您的系统管理员。\n\n" + task.Error.Message, "错误", MessageBoxButton.OK); } } else { MessageBox.Show("您已经成功的修改了“" + this.loginid + "”的登录密码,请牢记您刚刚设置的密码!", "提示", MessageBoxButton.OK); this.DialogResult = true; } }; }
private void OnDelete(object sender, MouseButtonEventArgs e) { var deletes = appSettingList.Where(p => p.Checked).ToList(); if (deletes.Count == 0) { MessageBox.Show("请先选择要删除的参数!"); } else { if (MessageBox.Show("是否确定删除所选择的参数?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { EAS.Controls.Window.ShowLoading("正在删除参数..."); int index = 0; foreach (AppSetting item in deletes) { DataPortal <AppSetting> dp = new DataPortal <AppSetting>(); dp.BeginDelete(item).Completed += (s, e2) => { InvokeTask task = s as InvokeTask; if (task.Error != null) { EAS.Controls.Window.HideLoading(); MessageBox.Show("删除参数时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { index++; if (index == deletes.Count) { foreach (AppSetting pItem in deletes) { this.appSettingList.Remove(pItem); } this.dataList.ItemsSource = null; this.dataList.ItemsSource = this.appSettingList; EAS.Controls.Window.HideLoading(); } } }; } } } }
private void btnOK_Click(object sender, RoutedEventArgs e) { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; IList <Module> installers = this.modules.Where(p => p.Checked).ToList(); if (installers.Count == 0) { installers = this.modules; } int index = 0; foreach (Module item in installers) { InvokeTask task = new InvokeTask(); IModuleService service = ServiceContainer.GetService <IModuleService>(task); service.InstallModule(item); task.Completed += (s, e2) => { if (task.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { index++; if (index == installers.Count) { this.Cursor = c; this.btnOK.IsEnabled = true; this.DialogResult = true; this.Close(); } } }; } }
void Selector_Closed(object sender, EventArgs e) { ModuleSelector Selector = sender as ModuleSelector; if (Selector.DialogResult ?? false) { IList <Module> selectList = Selector.SelectedModules; if (selectList.Count <= 0) { return; } List <string> sList = new List <string>(); foreach (var item in selectList) { int count = this.moduleList.Where(p => (p.Guid == item.Guid)).Count(); if (count < 1) { sList.Add(item.Guid.ToUpper()); this.moduleList.Add(item); } } InvokeTask task = new InvokeTask(); IGroupService service = ServiceContainer.GetService <IGroupService>(task); service.AddMember(this.selectGroup, sList); task.Completed += (s, e2) => { if (task.Error != null) { MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } }; this.dataList.ItemsSource = null; this.dataList.ItemsSource = this.moduleList; } }
void UpdateGroup() { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; this.Group.Name = this.tbName.Text; this.Group.Description = this.tbDescription.Text; List <string> members = new List <string>(this.memberList.Count); foreach (var item in this.memberList) { members.Add(item.Guid); } InvokeTask task = new InvokeTask(); IGroupService service = ServiceContainer.GetService <IGroupService>(task); service.UpdateGroup(this.Group, members); task.Completed += (s, e2) => { if (task.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.Cursor = c; this.btnOK.IsEnabled = true; this.DialogResult = true; this.Close(); } }; }
private void miDelete_Click(object sender, RoutedEventArgs e) { if (this.Tree.SelectedItem != null) { TreeItem xItem = this.Tree.SelectedItem as TreeItem; GroupEditor editor = new GroupEditor(); if (xItem.Tag is NavigateGroup) { IList <Module> selectList = this.moduleList.Where(p => p.Checked).ToList(); if (selectList.Count <= 0) { return; } List <string> sList = new List <string>(); foreach (var item in selectList) { sList.Add(item.Guid); } InvokeTask task = new InvokeTask(); IGroupService service = ServiceContainer.GetService <IGroupService>(task); service.RemoveMember(this.selectGroup, sList); task.Completed += (s, e2) => { if (task.Error != null) { MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } }; foreach (var item in selectList) { this.moduleList.Remove(item); } } } }
private void miDelete_Click(object sender, RoutedEventArgs e) { if (this.Tree.SelectedItem == null) { return; } TreeItem xItem = this.Tree.SelectedItem as TreeItem; if (xItem == null) { return; } Organization category = xItem.Tag as Organization; if (category == null) { return; } if (MessageBox.Show("您选择了要删除组织机构“" + category.Name + "”以及该组织机构中的所有帐户!\n\n是否确定要删除系统组织机构“" + category.Name + "”?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { EAS.Controls.Window.ShowLoading("正在组织机构..."); InvokeTask task = new InvokeTask(); IAccountService service = ServiceContainer.GetService <IAccountService>(task); service.DeleteOrganization(category.Guid); task.Completed += (s, e2) => { EAS.Controls.Window.HideLoading(); if (task.Error != null) { MessageBox.Show("删除组织机构时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); } else { this.LoadACategory(); } }; } }
private void OnDelete(object sender, MouseButtonEventArgs e) { if (this.Tree.SelectedItem != null) { TreeItem item = this.Tree.SelectedItem as TreeItem; if (item.Tag is NavigateGroup) { if (MessageBox.Show("是否确定卸载所选择的导航?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { NavigateGroup xItem = item.Tag as NavigateGroup; EAS.Controls.Window.ShowLoading("正在删除导航..."); InvokeTask task = new InvokeTask(); IGroupService service = ServiceContainer.GetService <IGroupService>(task); service.DeleteGroup(xItem); task.Completed += (s, e2) => { EAS.Controls.Window.HideLoading(); if (task.Error != null) { MessageBox.Show("删除导航时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); } else { item.Parent.Items.Remove(item); List <TreeItem> items = new List <TreeItem>(); items.Add(this.rootItem); this.Tree.ItemsSource = null; this.Tree.ItemsSource = items; } }; } } } }
public void StopTask(InvokeTask task) { task.active = false; }
private void StopTask(InvokeTask task) { _tasks.Remove(task); _tasksCache.StopTask(task); }
void NewRole() { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; Role vRole = new Role(); vRole.Name = this.tbName.Text; vRole.Description = this.tbDescription.Text; DataPortal <Role> dp = new DataPortal <Explorer.Entities.Role>(); dp.BeginExistsInDb(vRole).Completed += (s, e) => { FuncTask funcTask = s as FuncTask; if (funcTask.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("检查角色信息时发生错误:" + funcTask.Error.Message, "错误", MessageBoxButton.OK); return; } else { List <string> members = new List <string>(this.memberList.Count); foreach (var item in this.memberList) { members.Add(item.LoginID); } List <ACL> pList = new List <ACL>(); foreach (var item in this.permissionList) { pList.Add(new ACL { PObject = item.PObject.ToUpper(), PType = item.PType, Privileger = item.Privileger, PValue = item.PValue }); } InvokeTask task = new InvokeTask(); IRoleService service = ServiceContainer.GetService <IRoleService>(task); service.UpdateRole(vRole, members, pList); task.Completed += (s2, e2) => { if (task.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.Cursor = c; this.btnOK.IsEnabled = true; this.iclose = true; this.DataEntity = vRole; this.DialogResult = true; this.Close(); } }; } }; }
void NewAccount() { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; Account vItem = new Account(); vItem.LoginID = this.tbLoginID.Text; vItem.OrganID = this.tbCategory.Tag.ToString(); vItem.OrganName = this.tbCategory.Text; vItem.Name = this.tbName.Text; vItem.Description = this.tbDescription.Text; vItem.Leader = this.cbLeader.IsChecked.HasValue ? (this.cbLeader.IsChecked.Value ? 1:0) : 0; DataPortal <Account> dp = new DataPortal <Explorer.Entities.Account>(); dp.BeginExistsInDb(vItem).Completed += (s, e) => { FuncTask funcTask = s as FuncTask; if (funcTask.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("检查账号信息时发生错误:" + funcTask.Error.Message, "错误", MessageBoxButton.OK); return; } else { List <string> members = new List <string>(this.memberList.Count); foreach (var item in this.memberList) { members.Add(item.RoleName); } List <ACL> pList = new List <ACL>(); foreach (var item in this.permissionList) { pList.Add(new ACL { PObject = item.PObject, PType = item.PType, Privileger = item.Privileger, PValue = item.PValue }); } InvokeTask task = new InvokeTask(); IAccountService service = ServiceContainer.GetService <IAccountService>(task); service.UpdateAccount(vItem, this.tbPassword.Text, members, pList); task.Completed += (s2, e2) => { if (task.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.Cursor = c; this.btnOK.IsEnabled = true; this.iclose = true; this.DataEntity = vItem; this.DialogResult = true; this.Close(); } }; } }; }
public override void Login(string organization, string loginID, string password) { Session session = this.Session as Session; session.Organization = organization; EAS.Controls.Window.ShowLoading("正在登录..."); LoginProxy proxy = new LoginProxy(); proxy.GetAccountLoginInfo(loginID, password).Completed += (s, e1) => { EAS.Controls.Window.HideLoading(); FuncTask task = s as FuncTask; if (task.Error != null) { if (task.Error.InnerException != null) { MessageBox.Show(task.Error.InnerException.Message, "未能通过验证", MessageBoxButton.OK); } else { MessageBox.Show("用户验证过程中出现未知错误,请记录下面的异常信息,并通知您的系统管理员。\n\n" + task.Error.Message, "错误", MessageBoxButton.OK); } } else { LoginResult lr = task.Result as LoginResult; if ((!lr.Passed) & (string.Compare(loginID, "Guest", StringComparison.CurrentCultureIgnoreCase) != 0)) { MessageBox.Show("登录验证时发现未知错误", "未能通过验证", MessageBoxButton.OK); } string ip = string.Empty; try { ip = System.Windows.Application.Current.Host.InitParams["ClientIP"]; }catch {} InvokeTask task2 = new InvokeTask(); ILogService logService = ServiceContainer.GetService <ILogService>(task2); logService.Log(loginID, "登录系统", string.Empty, ip); task2.Completed += (s2, e2) => { }; session.Account = lr.Account; if (LoginContext.Singleton.IsolatedStorage) { LoginContext.Singleton.Account = lr.Account; App.Navigation(new UpdateLoader()); } else { App.StartMain(); //开始主页 } } }; int x = 2; }
void NewItem() { Cursor c = this.Cursor; this.Cursor = Cursors.Wait; this.btnOK.IsEnabled = false; AppSetting vItem = new AppSetting(); vItem.Category = this.tbCategory.Text; vItem.Key = this.tbName.Text; vItem.Description = this.tbDescription.Text; vItem.Value = this.tbValue.Text; DataPortal <AppSetting> dp = new DataPortal <AppSetting>(); dp.BeginExistsInDb(vItem).Completed += (s, e) => { FuncTask funcTask = s as FuncTask; if (funcTask.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("检查参数信息时发生错误:" + funcTask.Error.Message, "错误", MessageBoxButton.OK); return; } else { bool exists = (bool)funcTask.Result; if (exists) { this.Cursor = c; this.btnOK.IsEnabled = true; this.tbName.Focus(); MessageBox.Show("已存在同名的账户类型,请重新定义账户类型信息!" + funcTask.Error.Message, "错误", MessageBoxButton.OK); return; } dp.BeginInsert(vItem).Completed += (s2, e2) => { InvokeTask task = s2 as InvokeTask; if (task.Error != null) { this.Cursor = c; this.btnOK.IsEnabled = true; MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.Cursor = c; this.btnOK.IsEnabled = true; this.iclose = true; this.DataEntity = vItem; this.DialogResult = true; this.Close(); } }; } }; }
public static void InvokeAsUI(InvokeTask del) { Application.Current.Dispatcher.Invoke(del); }