示例#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.SampViewContent}"))
                {
                    viewContent.WorkbenchWindow.SelectWindow();
                    SampManageCtl ctrl = (SampManageCtl)viewContent.Control.Controls.Find("SampManageCtl", true)[0];
                    if (ctrl.txtSpName.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;
                }
            }

            SampViewContent sampContent = new SampViewContent(new SampManage());

            WorkbenchSingleton.Workbench.ShowView(sampContent);
        }
示例#2
0
        /// <summary>
        /// 执行命令。
        /// </summary>
        public override void Run()
        {
            //遍历工作台中已经打开的视图对象。
            foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection)
            {
                //如果已打开该视图,则选中该视图显示,返回以结束该方法的运行。
                if (viewContent.TitleName == StringParser.Parse("${res:FanHai.Hemera.Addins.EDC.SampViewContent}"))
                {
                    viewContent.WorkbenchWindow.SelectWindow();
                    return;
                }
            }
            //创建新的视图对象,并显示该视图界面。
            SampViewContent view = new SampViewContent(null);

            WorkbenchSingleton.Workbench.ShowView(view);
        }