Exemplo n.º 1
0
 public EditPathPartForm(PathPart part)
 {
     InitializeComponent();
     _part                     = part;
     _displayType              = part.LinkDisplayType;
     _separtorCode             = part.SeparatorCode;
     textBoxSeparatorCode.Text = _separtorCode;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 简单工厂,创建不同SnipPartType的Part
        /// </summary>
        static public SnipPagePart Create(SnipPageDesigner designer, SnipPartType type)
        {
            SnipPagePart part;

            switch (type)
            {
            case SnipPartType.None:
            case SnipPartType.Static:
            {
                part       = new StaticPart(designer);
                part.Title = StringParserService.Parse("${res:snipDesign.text.staticPartText}");
                break;
            }

            case SnipPartType.Box:
            {
                part       = new SnipPagePart(designer);
                part.Title = StringParserService.Parse("${res:snipDesign.text.box}");
                break;
            }

            case SnipPartType.Navigation:
            {
                part       = new NavigationPart(designer);
                part.Title = StringParserService.Parse("${res:snipDesign.text.navigationPartText}");
                break;
            }

            case SnipPartType.List:
            {
                part       = ListPart.Create(designer);
                part.Title = StringParserService.Parse("${res:snipDesign.text.listPartText}");
                break;
            }

            case SnipPartType.ListBox:
            {
                part       = ListBoxPart.Create(designer);
                part.Title = StringParserService.Parse("${res:snipDesign.text.listBoxPartText}");
                break;
            }

            case SnipPartType.Attribute:
            {
                part       = AttributePart.Create(designer);
                part.Title = StringParserService.Parse("${res:snipDesign.text.attributePartText}");
                break;
            }

            case SnipPartType.Path:
            {
                part       = new PathPart(designer);
                part.Title = StringParserService.Parse("${res:snipDesign.text.pathPartText}");
                break;
            }

            default:
                throw new Exception("开发期异常。未知的SnipPartType:" + type);
            }
            part.PartID   = XmlUtilService.CreateIncreaseId();
            part.PartType = type;
            return(part);
        }
Exemplo n.º 3
0
        static public SnipPagePart Parse(SnipPartXmlElement ele, SnipPageDesigner designer)
        {
            SnipPartType type = ele.SnipPartType;
            SnipPagePart part = null;

            switch (type)
            {
            case SnipPartType.Static:
            {
                part = SnipPagePart.Create(designer, type);
                ((StaticPart)part).PageText = ele.CDataValue;
                break;
            }

            case SnipPartType.Box:
            {
                part = SnipPagePart.Create(designer, type);
                break;
            }

            case SnipPartType.List:
            {
                ListPart listPart = (ListPart)SnipPagePart.Create(designer, SnipPartType.List);
                part = listPart;
                break;
            }

            case SnipPartType.ListBox:
            {
                ListBoxPart listBoxPart = (ListBoxPart)SnipPagePart.Create(designer, SnipPartType.ListBox);
                listBoxPart.StyleType = ele.StyleType;
                part = listBoxPart;
                break;
            }

            case SnipPartType.Navigation:
            {
                NavigationPart nPart = (NavigationPart)SnipPagePart.Create(designer, SnipPartType.Navigation);
                nPart.ChannelID = ele.GetAttribute("channelId");
                nPart.Text      = ele.CDataValue;
                part            = nPart;
                break;
            }

            case SnipPartType.Attribute:
            {
                AttributePart attributepart = (AttributePart)SnipPagePart.Create(designer, SnipPartType.Attribute);
                attributepart.AttributeName = ele.AttributeName;
                attributepart.Text          = ele.CDataValue;
                part = attributepart;
                break;
            }

            case SnipPartType.Path:
            {
                PathPart pathPart = (PathPart)SnipPagePart.Create(designer, SnipPartType.Path);
                pathPart.LinkDisplayType = (DisplayType)Enum.Parse(typeof(DisplayType), ele.GetAttribute("linkDisplayType"));
                pathPart.SeparatorCode   = ele.GetAttribute("separatorCode");
                part = pathPart;
                break;
            }

            default:
                throw new Exception("开发期异常。未知的SnipPartType:" + type);
            }
            part.PartType = type;
            part.Css      = ele.SnipPartCss;
            part.PartID   = ele.SnipPartId;
            part.CustomID = ele.CustomId;
            part.AElement = ele.AElement;
            return(part);
        }