private void tsbDelete_Click(object sender, EventArgs e) { //系统提示“确定要删除吗” if (MessageService.AskQuestion(StringParser.Parse("${res:FanHai.Hemera.Addins.Msg.DeleteRemind}"), StringParser.Parse("${res:Global.SystemInfo}"))) { //判定LocationKey是否为空 if (_locationEntity.LocationKey == "") { return; } else { _locationEntity.DeleteLocation(); if (_locationEntity.ErrorMsg == "") { //foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) //{ // //如果视图名称为“区域管理”执行 // if (viewContent.TitleName == StringParser.Parse("${res:FanHai.Hemera.Addins.EMS.LocationCtrl.ViewContentPartTile}")) // { // //参数值为true则关闭当前操作视图 // WorkbenchSingleton.Workbench.ActiveViewContent.WorkbenchWindow.CloseWindow(true); // viewContent.WorkbenchWindow.SelectWindow(); // return; // } //} ////if there are no window named "区域管理" is opened ////set control state //State = ControlState.New; ////change title 区域管理 //WorkbenchSingleton.Workbench.ActiveViewContent.TitleName = StringParser.Parse("${res:FanHai.Hemera.Addins.EMS.LocationCtrl.ViewContentPartTile}"); //提示“删除成功” MessageBox.Show(StringParser.Parse("${res:FanHai.Hemera.Addins.EMS.LocationCtrl.MsgDeleteDataSuccessfully}")); LocationViewContent locationViewContent = new LocationViewContent("", null); WorkbenchSingleton.Workbench.ShowView(locationViewContent); } else { MessageBox.Show(StringParser.Parse(_locationEntity.ErrorMsg)); } } } }