Example #1
0
        /// <summary>
        /// 查询按钮事件。
        /// </summary>
        private void toolbarQuery_Click(object sender, EventArgs e)
        {
            OperationSearchDialog dlg = new OperationSearchDialog();

            if (DialogResult.OK == dlg.ShowDialog())
            {
                if (string.Empty == dlg.OperationKey || dlg.OperationKey.Length < 1)
                {
                    return;
                }
                if (string.Empty == dlg.OperationName || dlg.OperationName.Length < 1)
                {
                    return;
                }
                if (string.Empty == dlg.OperationVersion || dlg.OperationVersion.Length < 1)
                {
                    return;
                }
                string title = StringParser.Parse("${res:FanHai.Hemera.Addins.FMM.OperationViewContent.TitleName}") + "_" + dlg.OperationName + "." + dlg.OperationVersion;
                foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection)
                {
                    if (viewContent.TitleName == title)
                    {
                        viewContent.WorkbenchWindow.SelectWindow();
                        return;
                    }
                }
                OperationViewContent vContent = new OperationViewContent(new OperationEntity(dlg.OperationKey));
                WorkbenchSingleton.Workbench.ShowView(vContent);
            }
        }
Example #2
0
        /// <summary>
        /// 执行命令。
        /// </summary>
        public override void Run()
        {
            //遍历工作台中已经打开的视图对象。
            foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection)
            {
                //如果已打开该视图,则选中该视图显示,返回以结束该方法的运行。
                OperationViewContent openView = viewContent as OperationViewContent;
                if (openView != null &&
                    StringParser.Parse("${res:FanHai.Hemera.Addins.FMM.OperationViewContent.TitleName}") == openView.TitleName)
                {
                    openView.WorkbenchWindow.SelectWindow();
                    return;
                }
            }
            //创建新的视图对象,并显示该视图界面。
            OperationViewContent view = new OperationViewContent(new OperationEntity());

            WorkbenchSingleton.Workbench.ShowView(view);
        }
Example #3
0
        /// <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);
        }