/// <summary> /// 添加listbox的子 /// </summary> /// <param name="listBoxPart"></param> /// <param name="styleEle"></param> private void AddListBoxPartChildrenParts(ListBoxPart listBoxPart, StyleXmlElement styleEle) { SnipPartsXmlElement partsEle = styleEle.GetPartsElement(); listBoxPart.ChildParts.Clear(); GetParts(listBoxPart.ChildParts, partsEle, listBoxPart.Designer); }
/// <summary> /// edit by zhenghao at 2008-06-18 11:13 /// 从listBoxPart里获得所有定制特性块的文本 /// </summary> private void GetAttriButeChildPartTextsFromListBoxPart() { _attriButeChildPartTexts.Clear(); foreach (SnipPagePart spPart in _part.ChildParts) { if (spPart.GetType() == typeof(ListBoxPart)) { ListBoxPart lbPart = spPart as ListBoxPart; _attriButeChildPartTexts.Add(lbPart.Text); } } }
private void checkBoxProject_CheckedChanged(object sender, EventArgs e) { comboBoxProject.Enabled = checkBoxProject.Checked; labelProject.Enabled = checkBoxProject.Checked; if (checkBoxProject.Checked) { ListBoxPart lbPart = (ListBoxPart)SnipPagePart.Create(_part.Designer, SnipPartType.ListBox); lbPart.StyleType = StyleType.ProjectPageListPart; _listBoxPartsDic[StyleType.ProjectPageListPart] = lbPart; } else { _listBoxPartsDic.Remove(StyleType.ProjectPageListPart); } }
public EditListBoxForm(ListBoxPart part) { InitializeComponent(); _part = part; Init(); }
/// <summary> /// 初始化所有控件 /// </summary> /// <param name="isAdd">是否是新建</param> private void InitControls() { _listBoxPartsDic.Clear(); numericUpDownAmount.Value = _part.MaxDisplayAmount; if (_part.ChannelIDs.Count > 0) { _channelIds = _part.ChannelIDs; foreach (string channelId in _channelIds) { SetCheckedNodes(channelId, treeViewChannels.Nodes); } } else { return; } if (_part.ChildParts.Count > 0) { #region 设置页面类型复选部分 foreach (SnipPagePart sPart in _part.ChildParts) { if (sPart.GetType() == typeof(ListBoxPart)) { ListBoxPart lbPart = sPart as ListBoxPart; _listBoxPartsDic[lbPart.StyleType] = lbPart; switch (lbPart.StyleType) { case StyleType.GeneralPageListPart: checkBoxGeneral.Checked = true; break; case StyleType.ProductPageListPart: checkBoxProduct.Checked = true; break; case StyleType.ProjectPageListPart: checkBoxProject.Checked = true; break; case StyleType.InviteBiddingPageListPart: checkBoxInviteBidding.Checked = true; break; case StyleType.KnowledgePageListPart: checkBoxKnowledge.Checked = true; break; case StyleType.HrPageListPart: checkBoxHr.Checked = true; break; case StyleType.HomePageListPart: checkBoxHomePage.Checked = true; break; default: break; } } } #endregion } else { return; } cmbSortType.SelectedIndex = (int)(_part.SequenceType); if (_part.SequenceType == SequenceType.CustomKeyWord) { textBoxKeyWords.Text = _part.CustomKeyWords; } }
/// <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); }
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); }