private void itemToolStripMenuItem_Click(object sender, EventArgs e) { XmlPropertySettingGroup group = new XmlPropertySettingGroup(); CurrentStyle.PropertySettingGroups.Add(group); AddPropertySettingGroup(group); }
public void DeserializePropertySettingGroups(PropertySettingGroupCollection resGroups) { for (int i = 0; i < this.PropertySettingGroups.Count; i++) { XmlPropertySettingGroup xmlGroup = this.PropertySettingGroups[i]; if (xmlGroup.PropertySettings == null || xmlGroup.Selectors == null) { continue; } try { PropertySettingGroup group = xmlGroup.Deserialize(); resGroups.Add(group); } catch (Exception ex) { string message = "Exception occured while deserializing PropertySettingGroup: " + ex.ToString(); Trace.WriteLine(message); Debug.Fail(message); } } }
public XmlPropertySettingGroup Serialize() { XmlPropertySettingGroup xmlGroup = new XmlPropertySettingGroup(); xmlGroup.BasedOn = this.basedOn; for (int settingIndex = 0; settingIndex < this.PropertySettings.OriginalPropertySettings.Count; settingIndex++) { IPropertySetting setting = this.PropertySettings.OriginalPropertySettings[settingIndex]; //serialize value; XmlPropertySetting xmlSetting = setting.Serialize(); xmlGroup.PropertySettings.Add(xmlSetting); } if (this.Selectors.Count > 0) { for (int selectorIndex = 0; selectorIndex < this.Selectors.Count; selectorIndex++) { IElementSelector selector = this.Selectors[selectorIndex]; xmlGroup.Selectors.Add(selector.Serialize()); } } return(xmlGroup); }
/// <summary> /// <para> Removes a specific <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> from the /// <see cref='Telerik.WinControls.XmlPropertySettingGroupCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> to remove from the <see cref='Telerik.WinControls.XmlPropertySettingGroupCollection'/> .</param> /// <returns><para>None.</para></returns> /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception> public void Remove(XmlPropertySettingGroup value) { //List.Remove(value); int index = List.IndexOf(value); if (index >= 0) { List.RemoveAt(index); } }
public void Remove(XmlPropertySettingGroup value) { int index = this.List.IndexOf((object)value); if (index < 0) { return; } this.List.RemoveAt(index); }
private void addPropertySettingToolStripMenuItem_Click(object sender, EventArgs e) { XmlPropertySetting setting = null; switch (((ToolStripMenuItem)sender).Name) { case "AnimatedPropertySetting": setting = new XmlAnimatedPropertySetting(); break; case "PropertySetting": setting = new XmlPropertySetting(); break; } if (tvPropertySettingGroups.SelectedNode != null) { AddSetting(tvPropertySettingGroups.SelectedNode, setting); XmlPropertySettingGroup group = (XmlPropertySettingGroup)tvPropertySettingGroups.SelectedNode.Parent.Tag; group.PropertySettings.Add(setting); tvPropertySettingGroups.SelectedNode.Expand(); } }
private void removeToolStripMenuItem_Click(object sender, EventArgs e) { if (tvPropertySettingGroups.SelectedNode != null) { if (tvPropertySettingGroups.SelectedNode.Tag is IPropertySetting) { XmlPropertySettingGroup group = tvPropertySettingGroups.SelectedNode.Parent.Parent.Tag as XmlPropertySettingGroup; group.PropertySettings.Remove((XmlPropertySetting)tvPropertySettingGroups.SelectedNode.Tag); } else if (tvPropertySettingGroups.SelectedNode.Tag is XmlElementSelector) { XmlPropertySettingGroup group = tvPropertySettingGroups.SelectedNode.Parent.Parent.Tag as XmlPropertySettingGroup; group.Selectors.Remove((XmlElementSelector)tvPropertySettingGroups.SelectedNode.Tag); } else if (tvPropertySettingGroups.SelectedNode.Tag is XmlPropertySettingGroup) { CurrentStyle.PropertySettingGroups.Remove((XmlPropertySettingGroup)tvPropertySettingGroups.SelectedNode.Tag); } tvPropertySettingGroups.SelectedNode.Remove(); } }
private void addSelectorToolStripMenuItem_Click(object sender, EventArgs e) { XmlElementSelector selector = null; switch ((sender as ToolStripMenuItem).Name) { case "TypeSelector": selector = new XmlTypeSelector(); break; case "NameSelector": selector = new XmlNameSelector(); break; //case "GeneralSelector": selector = new XmlGeneralSelector(); break; case "ClassSelector": selector = new XmlClassSelector(); break; } if (tvPropertySettingGroups.SelectedNode != null) { AddSelector(tvPropertySettingGroups.SelectedNode, selector); XmlPropertySettingGroup group = tvPropertySettingGroups.SelectedNode.Parent.Tag as XmlPropertySettingGroup; group.Selectors.Add(selector); tvPropertySettingGroups.SelectedNode.Expand(); } }
TreeNode AddPropertySettingGroup(XmlPropertySettingGroup group) { TreeNode node = new TreeNode(group.ToString(), 1, 1); node.Tag = group; TreeNode selectorsNode = new TreeNode("Selectors", 2, 2); selectorsNode.Name = "Selectors"; selectorsNode.Tag = group.Selectors; node.Nodes.Add(selectorsNode); TreeNode settingsNode = new TreeNode("Settings", 4, 4); settingsNode.Name = "Settings"; settingsNode.Tag = group.PropertySettings; node.Nodes.Add(settingsNode); tvPropertySettingGroups.Nodes.Add(node); return(node); }
/// <summary> /// <para>Gets a value indicating whether the /// <see cref='Telerik.WinControls.XmlPropertySettingGroupCollection'/> contains the specified <see cref='Telerik.WinControls.XmlPropertySettingGroup'/>.</para> /// </summary> /// <param name='value'>The <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> to locate.</param> /// <returns> /// <para><see langword='true'/> if the <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> is contained in the collection; /// otherwise, <see langword='false'/>.</para> /// </returns> public bool Contains(XmlPropertySettingGroup value) { return(List.Contains(value)); }
/// <summary> /// <para>Inserts a <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> into the <see cref='Telerik.WinControls.XmlPropertySettingGroupCollection'/> at the specified index.</para> /// </summary> /// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param> /// <param name=' value'>The <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> to insert.</param> /// <returns><para>None.</para></returns> public void Insert(int index, XmlPropertySettingGroup value) { List.Insert(index, value); }
/// <summary> /// This method supports TPF infrastructure and is intended for internal use only. /// </summary> /// <param name="applyUnconditional"></param> /// <param name="groups"></param> /// <returns></returns> public StyleSheet GetStyleSheet(XmlSelectorBase applyUnconditional, XmlPropertySettingGroup[] groups) { StyleSheet res = new StyleSheet(); SelectorBase applySelector = null; if (this.PropertySettingGroups == null) { return(res); } for (int i = 0; i < this.PropertySettingGroups.Count; i++) { XmlPropertySettingGroup xmlGroup = this.PropertySettingGroups[i]; if (xmlGroup.Selectors != null) { for (int selectorIndex = 0; selectorIndex < xmlGroup.Selectors.Count; selectorIndex++) { XmlElementSelector xmlSelector = xmlGroup.Selectors[selectorIndex]; if (xmlSelector == applyUnconditional) { applySelector = (SelectorBase)xmlSelector.Deserialize(); break; } } } } for (int i = 0; i < this.PropertySettingGroups.Count; i++) { XmlPropertySettingGroup xmlGroup = this.PropertySettingGroups[i]; PropertySettingGroup group = new PropertySettingGroup(); if (xmlGroup.PropertySettings == null || xmlGroup.Selectors == null) { continue; } bool disable = false; if (applyUnconditional != null) { for (int groupIndex = 0; groupIndex < groups.Length; groupIndex++) { XmlPropertySettingGroup g = groups[groupIndex]; if (g == xmlGroup) { disable = true; break; } } } for (int settingIndex = 0; settingIndex < xmlGroup.PropertySettings.Count; settingIndex++) { XmlPropertySetting xmlPropertySetting = xmlGroup.PropertySettings[settingIndex]; IPropertySetting setting = xmlPropertySetting.Deserialize(); group.PropertySettings.Add(setting); } //IElementSelector activeSelector = null; for (int selectorIndex = 0; selectorIndex < xmlGroup.Selectors.Count; selectorIndex++) { XmlElementSelector xmlSelector = xmlGroup.Selectors[selectorIndex]; IElementSelector selector = null; selector = xmlSelector.Deserialize(); if (xmlSelector == applyUnconditional) { applySelector.IsActiveSelectorInStyleBuilder = true; selector = applySelector; //continue; } else if (disable) { ((SelectorBase)selector).DisableStyle = true; //((SelectorBase)selector).ExcludeSelector = applySelector; } group.Selectors.Add(selector); } //if (activeSelector != null) // group.Selectors.Insert(0, activeSelector); res.PropertySettingGroups.Add(group); } return(res); }
/// <summary> /// <para>Adds a <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> with the specified value to the /// <see cref='Telerik.WinControls.XmlPropertySettingGroupCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> to add.</param> /// <returns> /// <para>The index at which the new element was inserted.</para> /// </returns> public int Add(XmlPropertySettingGroup value) { return(List.Add(value)); }
/// <summary> /// <para>Returns the index of a <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> in /// the <see cref='Telerik.WinControls.XmlPropertySettingGroupCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> to locate.</param> /// <returns> /// <para>The index of the <see cref='Telerik.WinControls.XmlPropertySettingGroup'/> of <paramref name='value'/> in the /// <see cref='Telerik.WinControls.XmlPropertySettingGroupCollection'/>, if found; otherwise, -1.</para> /// </returns> public int IndexOf(XmlPropertySettingGroup value) { return(List.IndexOf(value)); }
public void Insert(int index, XmlPropertySettingGroup value) { this.List.Insert(index, (object)value); }
public int IndexOf(XmlPropertySettingGroup value) { return(this.List.IndexOf((object)value)); }
public bool Contains(XmlPropertySettingGroup value) { return(this.List.Contains((object)value)); }
public int Add(XmlPropertySettingGroup value) { return(this.List.Add((object)value)); }