コード例 #1
0
        private void BuildStripTabPages()
        {
            _sitePropertyEle = Service.Sdsite.CurrentDocument.SiteProperty;

            PropertyInfo[] propertys = _sitePropertyEle.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

            foreach (PropertyInfo item in propertys)
            {
                if (item.GetGetMethod().ReturnType.BaseType == typeof(AnyXmlElement))
                {
                    StripTabPage page = new StripTabPage();
                    object       obj  = item.GetValue(_sitePropertyEle, null);

                    AutoLayoutPanel panel = AutoLayoutPanelEx.CreatePanel(typeof(PropertyPadAttribute), obj, false, true);
                    page.Controls.Add(panel);
                    panel.FillValue(new[] { obj });

                    panel.Dock = DockStyle.Fill;
                    page.Text  = ResourceService.GetResourceText(string.Concat("siteProperty.", item.Name));

                    this._stripTab.TabPages.Add(page);

                    //将新添加的项置入_panelList列表中,缓存起来
                    _panelList.Add(page.Text, panel);
                }
            }
        }
コード例 #2
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();
            }
        }
コード例 #3
0
        /// <summary>
        /// 上两个重载方法的内部子方法:创建Panel
        /// </summary>
        static private AutoLayoutPanelEx CreatePanelCore(Type attributeType, TypeAndInterfaceArr typeAndInterface, bool isStatic, bool needCache, bool singleObject)
        {
            ///不需要缓存,直接chuanjiang创建
            if (!needCache)
            {
                return(new AutoLayoutPanelEx(attributeType, typeAndInterface, isStatic, singleObject));
            }

            AutoLayoutPanelEx tempPanel = null;

            ///单建模式AutoLayoutPanel,
            if (!autoPanelDictionary.TryGetValue(typeAndInterface, out tempPanel) || tempPanel.IsDisposed)
            {
                tempPanel = new AutoLayoutPanelEx(attributeType, typeAndInterface, isStatic, singleObject);
                autoPanelDictionary[typeAndInterface] = tempPanel;
            }
            return(tempPanel);
        }
コード例 #4
0
        /// <summary>
        /// 读取文件中的选项内容,主用于显示树视图
        /// </summary>
        private void ReadOptionNode(XmlElement element, TreeNode parentTreeNode)
        {
            if (element.HasChildNodes)
            {
                foreach (XmlNode node in element.ChildNodes)
                {
                    if (node.Name == "option" || node.Name == "items")
                    {
                        string panelName = node.Attributes["name"].Value;
                        string nodeName  = node.Attributes["text"].Value;

                        TreeNode treeNode = new TreeNode(nodeName);
                        treeNode.Name = panelName;

                        AutoLayoutPanel autoPanel = null;
                        if (!OptionPanelDic.TryGetValue(panelName, out autoPanel))
                        {
                            foreach (Type type in types)
                            {
                                if (type.IsClass)
                                {
                                    object[] atts = type.GetCustomAttributes(typeof(SoftOptionClassAttribute), false);
                                    if (atts.Length > 0 && ((SoftOptionClassAttribute)atts[0]).PanelName == panelName)
                                    {
                                        // autoPanel = AutoLayoutPanel.CreatePanel(typeof(SoftOptionClassAttribute), PathService.CL_DataSources_Folder, type);
                                        autoPanel = AutoLayoutPanelEx.CreatePanel(typeof(PropertyPadAttribute), type, false, true);
                                        OptionPanelDic.Add(panelName, autoPanel);
                                    }
                                }
                            }
                        }
                        treeNode.Tag = autoPanel;

                        ///添加节点
                        parentTreeNode.Nodes.Add(treeNode);
                        if (node.HasChildNodes)
                        {
                            ReadOptionNode((XmlElement)node, treeNode);
                        }
                    }
                }
            }
        }//ReadOptionNode