/// <summary> /// 改变节点选择状态后 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeViewChannels_AfterCheck(object sender, TreeViewEventArgs e) { TreeNode node = e.Node; string channelId = node.Tag.ToString(); if (node.Checked) { NavigationPart nvPart = (NavigationPart)SnipPagePart.Create(SnipPageDesigner, SnipPartType.Navigation); nvPart.ChannelID = channelId; _navigations[channelId] = nvPart; nvPart.Width_Css = DEFAULTWIDTH; } else { _navigations.Remove(channelId); } if (_navigations.Values.Count <= 1) { checkBoxUsedSeparator.Checked = false; checkBoxUsedSeparator.Enabled = false; } else { checkBoxUsedSeparator.Enabled = true; } }
private void treeViewChannels_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Tag == null) { return; } string channelId = e.Node.Tag.ToString(); if (string.IsNullOrEmpty(channelId)) { return; } if (e.Node.Checked) { NavigationPart nvPart = _navigations[channelId]; PartSetupForm form = new PartSetupForm(nvPart); form.Owner = this; if (form.ShowDialog() == DialogResult.OK) { if (form.WidthChanged) { checkBoxWidth.Checked = false; } } } }
public PartSetupForm(NavigationPart part) { InitializeComponent(); Part = part; cssFieldUnitWidth.Value = part.Width_Css; _oldWidth = part.Width_Css; switch (part.DisplayType) { case DisplayType.Default: radioButtonDefault.Checked = true; break; case DisplayType.Title: radioButtonTitle.Checked = true; break; case DisplayType.Pictrue: radioButtonPic.Checked = true; break; case DisplayType.AppointedText: radioButtonText.Checked = true; break; default: break; } }
public EditChannelForm(NavigationPart part) { InitializeComponent(); Part = part; SelectedChannel = part.ChannelID; DisplayType = part.DisplayType; ChannelTitle = part.ChannelTitle; GetChannelNames(); }
/// <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); }