Beispiel #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);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 工厂模式创建控件:针对 [静态类] 的属性中是否设定定制特性创建
        /// </summary>
        static public AutoLayoutPanel CreatePanel(Type attributeType, Type staticClassType, bool needCache, bool singleObject)
        {
            TypeAndInterfaceArr typeAndInterface = new TypeAndInterfaceArr(staticClassType, attributeType.FullName);
            AutoLayoutPanel     tempPanel        = CreatePanelCore(attributeType, typeAndInterface, true, needCache, singleObject);

            return(tempPanel);
        }
Beispiel #3
0
        /// <summary>
        /// 工厂模式创建控件:针对 [对象] 的属性中是否设定定制特性创建
        /// </summary>
        static public AutoLayoutPanel CreatePanel(Type attributeType, object[] objs, bool needCache, bool singleObject)
        {
            Type[] listInterface;
            Type   objsType = Utility.Type.GetCommonTypeService(objs, out listInterface);
            TypeAndInterfaceArr typeAndInterface = new TypeAndInterfaceArr(objsType, listInterface, attributeType.FullName);
            AutoLayoutPanel     tempPanel        = CreatePanelCore(attributeType, typeAndInterface, false, needCache, singleObject);

            return(tempPanel);
        }
Beispiel #4
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();
            }
        }
Beispiel #5
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
Beispiel #6
0
 /// <summary>
 /// 根据定制特性增加ListBoxPart的子Part类型选项
 /// ZhengHao, 2008年3月11日16时29分
 /// </summary>
 private void BuildSnipAttributeCheckBoxes(PropertyInfo[] propertyInfos)
 {
     //遍历属性集合,propertyInfos含有当前模板类型所对应的页面类型的所有属性
     foreach (PropertyInfo info in propertyInfos)
     {
         object[] snipAttrs = info.GetCustomAttributes(typeof(SnipPartAttribute), false);
         if (snipAttrs.Length <= 0)
         {
             continue;//无定制属性
         }
         //SelectGroupItem sgi = new SelectGroupItem(checkBoxDisplayChannel.Name, checkBoxDisplayChannel.Text);
         //遍历定制特性
         foreach (SnipPartAttribute snipAttr in snipAttrs)
         {
             SelectGroupItem item = new SelectGroupItem(snipAttr.Name, AutoLayoutPanel.GetLanguageText(snipAttr.Text));
             item.Tag = snipAttr;
             selectGroup.Items.Add(item);
         }
     }
 }
Beispiel #7
0
        /// <summary>
        /// 根据定制特性增加扩展的页面片工具箱中的工具
        /// Lukan, 2008年2月20日11时29分
        /// </summary>
        private ToolBox.VSTreeNode BuildSnipAttributeTreeNode(PropertyInfo[] propertyInfos, Type type)
        {
            string name = "SnipAttributeToolsGroup" + type.FullName;
            KeyValuePair <int, ToolBox.VSTreeNode> pair = new KeyValuePair <int, ToolBox.VSTreeNode>();

            if (!ThisVSTreeNodeDic.TryGetValue(name, out pair))
            {
                //定义ToolBox的一个新的节点
                ToolBox.VSTreeNode treeNode = new ToolBox.VSTreeNode();
                treeNode.Name = name;
                treeNode.Text = StringParserService.Parse("${res:Pad.Wizard.snipText}");
                treeNode.Nodes.Clear();

                //遍历属性集合,propertyInfos含有当前模板类型所对应的页面类型的所有属性
                foreach (PropertyInfo info in propertyInfos)
                {
                    object[] snipAttrs = info.GetCustomAttributes(typeof(SnipPartAttribute), false);
                    if (snipAttrs.Length <= 0)
                    {
                        continue;//无定制属性
                    }
                    //遍历定制特性
                    foreach (SnipPartAttribute snipAttr in snipAttrs)
                    {
                        ToolBox.VSTreeNode subNode = new ToolBox.VSTreeNode();
                        subNode.Name           = snipAttr.Text;
                        subNode.Text           = AutoLayoutPanel.GetLanguageText(snipAttr.Text);
                        subNode.ToolTipCaption = snipAttr.ToolTipCaption;
                        subNode.ToolTipText    = snipAttr.ToolTipText;
                        subNode.ImageIndex     = snipAttr.Index;
                        subNode.Tag            = snipAttr;
                        treeNode.Nodes.Add(subNode);
                    }
                }
                pair = new KeyValuePair <int, ToolBox.VSTreeNode>(2, treeNode);
                ThisVSTreeNodeDic.Add(treeNode.Name, pair);
            }
            return(pair.Value);
        }
Beispiel #8
0
        void Treeview_AfterSelect(object sender, TreeViewEventArgs e)
        {
            AutoLayoutPanel panel = (AutoLayoutPanel)e.Node.Tag;

            panel.Dock = DockStyle.Fill;

            if (prePanel != null)
            {
                if (panel != prePanel)
                {
                    prePanel.Visible = false;
                    panel.Visible    = true;
                }
            }
            else
            {
                panel.Visible = true;
            }


            prePanel = panel;
        }
Beispiel #9
0
        /// <summary>
        /// edit by zhenhao at 2008-06-19 11:00
        /// 添加所有的专有类(定制特性)块的节点
        /// </summary>
        private void AddSpecialNodes()
        {
            specialNode.Nodes.Clear();

            Type pageType = null;

            switch (_styleType)
            {
                #region
            case StyleType.GeneralPageListPart:
            case StyleType.GeneralPageContent:
                pageType = typeof(GeneralPageXmlDocument);
                break;

            case StyleType.ProductPageListPart:
            case StyleType.ProductPageContent:
                pageType = typeof(ProductXmlDocument);
                break;

            case StyleType.ProjectPageListPart:
            case StyleType.ProjectPageContent:
                pageType = typeof(ProjectXmlDocument);
                break;

            case StyleType.InviteBiddingPageListPart:
            case StyleType.InviteBiddingPageContent:
                pageType = typeof(InviteBiddingXmlDocument);
                break;

            case StyleType.KnowledgePageListPart:
            case StyleType.KnowledgePageContent:
                pageType = typeof(KnowledgeXmlDocument);
                break;

            case StyleType.HrPageListPart:
            case StyleType.HrPageContent:
                pageType = typeof(HrXmlDocument);
                break;

            case StyleType.HomePageListPart:
                pageType = typeof(PageXmlDocument);
                break;

            default:
                break;
                #endregion
            }
            PropertyInfo[] pInfos = pageType.GetProperties();
            foreach (PropertyInfo info in pInfos)
            {
                object[] snipAttrs = info.GetCustomAttributes(typeof(SnipPartAttribute), false);
                if (snipAttrs.Length <= 0)
                {
                    continue;//无定制属性
                }
                //遍历定制特性
                foreach (SnipPartAttribute snipAttr in snipAttrs)
                {
                    TreeNode subNode = new TreeNode();
                    subNode.Name        = snipAttr.Text;
                    subNode.Text        = AutoLayoutPanel.GetLanguageText(snipAttr.Text);
                    subNode.ToolTipText = _toolTipText;
                    subNode.ImageIndex  = snipAttr.Index;
                    subNode.Tag         = snipAttr;
                    specialNode.Nodes.Add(subNode);
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// 初始化
        /// </summary>
        public static void Initialize(string sdsite)
        {
            System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException       += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            _willOpenFile = sdsite;

            CssResources.Initialize();

            //初始化的顺序是有一定规则的
            Service.Util.Initialize();
            Service.Property.Initialize();
            PathService.Initialize(Application.StartupPath);
            Utility.Pinyin.Initialize(Path.Combine(PathService.SoftwarePath, "pinyin.mb"));
            ResourceService.Initialize();
            StringParserService.Initialize(ResourceService.GetResourceText);
            SoftwareOption.Load();
            ResourcesReader.InitializeResources("Configuration", SoftwareOption.General.ApplicationLanguage, null);
            Service.FileBinding.Initialize();
            Service.DesignData.Load(PathService.Config_PadLayout);
            Service.RecentFiles.Initialize();
            Service.SiteDataManager.Initialize();
            Service.ListView.InitColumn();
            SiteResourceService.Initialize(SelectResource, GetResourcePath, GetResourceAbsPath, GetResourceUrl, ImportResourceFile);
            AutoLayoutPanel.Initialize(PathService.CL_DataSources_Folder);

            LayoutConfiguration.LoadLayoutConfiguration();
            _mainForm = new WorkbenchForm();

            CssUtility.Initialize(_mainForm.SelectImageResource);
            ////初始化的顺序是有一定规则的
            Service.User.Initialize(_mainForm.ShowLoginForm);
            Service.WebView.Initialize(_mainForm.SinglePagePublish);
            MessageService.Initialize(_mainForm);
            ToolbarManager.Initialize(_mainForm);
            MenuStripManager.Initialize(_mainForm);
            StatusBarManager.Initialize(_mainForm);
            FindAndReplaceForm.Initialize(_mainForm);
            //ResultsPad.Initialize(_mainForm);
            MenuStateManager.Initialize();

            Service.StatusBar.Initialize(StatusBarManager.CurrentStatusStrip);
            Service.Workbench.Initialize(
                _mainForm,
                _mainForm.OpenWorkDocument,
                _mainForm.NavigationUrl,
                _mainForm.MainTreePad.TreeViewExPad.RefreshSiteTreeData,
                ShowDialogForCreateProject,
                ShowDialogForOpenProject,
                _mainForm.GotoTree,
                _mainForm.ActivateForm);

            ///监听项目的打开事件
            Service.Project.ProjectOpened  += new EventHandler(ProjectService_ProjectOpened);
            Service.Project.ProjectClosing += new EventHandler(ProjectService_ProjectClosing);
            Service.Project.ProjectClosed  += new EventHandler(ProjectService_ProjectClosed);

            OnWorkbenchCreated();

            _mainForm.OnActiveWorkspaceTypeChanged(new WorkspaceTypeEventArgs(WorkspaceType.Default));
            _mainForm.MainDockPanel.ActiveDocumentChanged += new EventHandler(_mainForm.MainDockPanel_ActiveDocumentChanged);

            if (Initialized != null)
            {
                Initialized(null, EventArgs.Empty);
            }
        }