/// <summary> /// 构造函数。 /// </summary> /// <param name="operation">表示工序信息的实体对象。</param> public OperationViewContent(OperationEntity operation) : base() { if (null != operation && operation.OperationName.Length > 0) { this.TitleName = StringParser.Parse("${res:FanHai.Hemera.Addins.FMM.OperationViewContent.TitleName}") + "_" + operation.OperationName + "." + operation.OperationVersion; } else { this.TitleName = StringParser.Parse("${res:FanHai.Hemera.Addins.FMM.OperationViewContent.TitleName}"); } Panel panel = new Panel(); //set panel dock style panel.Dock = DockStyle.Fill; //set panel BorderStyle panel.BorderStyle = BorderStyle.FixedSingle; operationCtrl = new OperationCtrl(operation); operationCtrl.Dock = DockStyle.Fill; //将控件对象加入到Panel中。 //设置Panel为该视图对象的控件对象,用于在应用程序平台上显示可视化的视图界面。 panel.Controls.Add(operationCtrl); //set panel to view content this.control = panel; }
/// <summary> /// 新增按钮事件。 /// </summary> private void toolbarNew_Click(object sender, EventArgs e) { foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) { if (viewContent.TitleName == StringParser.Parse("${res:FanHai.Hemera.Addins.FMM.OperationViewContent.TitleName}")) { viewContent.WorkbenchWindow.SelectWindow(); OperationCtrl ctrl = (OperationCtrl)viewContent.Control.Controls.Find("OperationCtrl", true)[0]; if (ctrl.txtOperationName.Text.Trim() != "") { if (!MessageService.AskQuestion("${res:Global.ClearNoteMessage}", "${res:Global.SystemInfo}")) { return; } } ctrl.CtrlState = ControlState.New; return; } } OperationViewContent operationContent = new OperationViewContent(new OperationEntity()); WorkbenchSingleton.Workbench.ShowView(operationContent); }