コード例 #1
0
        void _contextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (this is BaseEditViewForm)
            {
                BaseEditViewForm editViewThis = (BaseEditViewForm)this;
                saveMenuItem.Enabled = editViewThis.IsModified;
            }
            else
            {
                saveMenuItem.Enabled = false;
            }

            switch (this.WorkDocumentType)
            {
            case WorkDocumentType.TmpltDesigner:
            case WorkDocumentType.HtmlDesigner:
            //case WorkDocumentType.Manager:
            case WorkDocumentType.SnipDesigner:
            case WorkDocumentType.Edit:
                gotoTreeMenuItem.Enabled = true;
                break;

            default:
                gotoTreeMenuItem.Enabled = false;
                break;
            }
        }
コード例 #2
0
        static private void Save(IDockContent form)
        {
            if (form is BaseEditViewForm)
            {
                BaseEditViewForm view = (BaseEditViewForm)form;
                if (view.IsModified)
                {
                    view.Save();

                    ///两个文件触发这个事件,还有个地方是EditView.cs
                    InternalService.OnWorkDocumentSaved(
                        new WorkDocumentEventArgs(view.WorkDocumentType, view.Id));
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 更新AutoLayoutPanel
        /// </summary>
        public void RefreshAutoPanel()
        {
            if (WorkbenchForm.MainForm.MainDockPanel.ActiveDocument == null)
            {
                ///设置为新的AutoLayoutPanel
                InnerPropertyPanel = null;
                AutoLayoutPanel    = null;
                return;
            }

            ///特殊处理Html设计器
            if (Service.Workbench.ActiveWorkDocumentType == WorkDocumentType.HtmlDesigner)
            {
                BaseEditViewForm view = (BaseEditViewForm)WorkbenchForm.MainForm.MainDockPanel.ActiveDocument;

                ///设置为新的InnerPropertyPanel by lisuye on 2008年5月27日
                AutoLayoutPanel    = null;
                InnerPropertyPanel = view.PropertyPanel;
            }
            ///其他的根据IGetPropertiesForPanelable显示 by lisuye on 2008年5月27日
            else
            {
                ///根据当前工作区获取AutoLayoutPanel by lisuye on 2008年5月27日
                IGetProps = WorkbenchForm.MainForm.MainDockPanel.ActiveDocument as IGetPropertiesForPanelable;
                AutoLayoutPanel newAutoPanel = null;
                if (_igetprops != null)
                {
                    object[] props = _igetprops.GetPropertiesForPanel();
                    if (props != null && props.Length > 0)
                    {
                        newAutoPanel = AutoLayoutPanelEx.CreatePanel(typeof(PropertyPadAttribute), props, true, false);
                        newAutoPanel.RealTimeSave = true;
                        newAutoPanel.FillValue(props);

                        if (Service.Workbench.ActiveWorkDocumentType == WorkDocumentType.None)
                        {
                            newAutoPanel.Saved += new EventHandler <ValueSaveEventArgs>(newAutoPanel_Saved);
                        }
                    }
                }

                ///设置为新的AutoLayoutPanel
                InnerPropertyPanel = null;
                AutoLayoutPanel    = newAutoPanel;
                //Show();
            }
        }
コード例 #4
0
        protected BaseViewForm()
        {
            //顶部的上下文菜单
            saveMenuItem            = new ToolStripMenuItem("保存");
            closeMenuItem           = new ToolStripMenuItem("关闭");
            closeAllWithoutThisMenu = new ToolStripMenuItem("除此之外全部关闭");
            gotoTreeMenuItem        = new ToolStripMenuItem("定位到树中");

            _contextMenuStrip.Items.Add(saveMenuItem);
            _contextMenuStrip.Items.Add(closeMenuItem);
            _contextMenuStrip.Items.Add(closeAllWithoutThisMenu);
            _contextMenuStrip.Items.Add(gotoTreeMenuItem);

            this.TabPageContextMenuStrip = _contextMenuStrip;

            saveMenuItem.Click += delegate
            {
                if (this is BaseEditViewForm)
                {
                    BaseEditViewForm editViewThis = (BaseEditViewForm)this;
                    if (editViewThis.IsModified)
                    {
                        editViewThis.Save();
                    }
                }
            };
            closeMenuItem.Click += delegate
            {
                this.Close();
            };
            closeAllWithoutThisMenu.Click += delegate
            {
                Service.Workbench.CloseAllForm(this);
            };
            gotoTreeMenuItem.Click += delegate
            {
                Service.Workbench.GotoTree(this);
            };

            this.DockAreas             = DockAreas.Document;
            _contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(_contextMenuStrip_Opening);
        }