Exemple #1
0
        /// <summary>
        /// Tool Bar New Click
        /// </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.EDC.EDCManageViewContent}"))
                {
                    viewContent.WorkbenchWindow.SelectWindow();
                    EDCManageCtl ctrl = (EDCManageCtl)viewContent.Control.Controls.Find("EDCManageCtl", true)[0];
                    if (ctrl.txtEdcName.Text.Trim() != "")
                    {
                        if (MessageBox.Show(StringParser.Parse("${res:Global.ClearNoteMessage}"),
                                            StringParser.Parse("${res:Global.SystemInfo}"), MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                        {
                            return;
                        }
                    }

                    ctrl.CtrlState = ControlState.New;
                    return;
                }
            }

            EDCManageViewContent edcManageContent = new EDCManageViewContent(new EdcManage());

            WorkbenchSingleton.Workbench.ShowView(edcManageContent);
            btnAdd.Enabled    = true;
            btnDelete.Enabled = true;
        }
Exemple #2
0
        /// <summary>
        /// 执行命令。
        /// </summary>
        public override void Run()
        {
            //遍历工作台中已经打开的视图对象。
            foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection)
            {
                //如果已打开该视图,则选中该视图显示,返回以结束该方法的运行。
                EDCManageViewContent openView = viewContent as EDCManageViewContent;
                if (openView != null)
                {
                    openView.WorkbenchWindow.SelectWindow();
                    return;
                }
            }
            //创建新的视图对象,并显示该视图界面。
            EDCManageViewContent view = new EDCManageViewContent(null);

            WorkbenchSingleton.Workbench.ShowView(view);
        }