Exemple #1
0
        XmlElementSelector IElementSelector.Serialize()
        {
            XmlElementSelector xmlselctor = this.CreateSerializableInstance();

            this.SerializeProperties(xmlselctor);
            return(xmlselctor);
        }
        public PropertySettingGroup Deserialize()
        {
            PropertySettingGroup group = new PropertySettingGroup();

            group.BasedOn = this.basedOn;

            if (this.propertySettings != null)
            {
                for (int settingIndex = 0; settingIndex < this.PropertySettings.Count; settingIndex++)
                {
                    XmlPropertySetting xmlPropertySetting = this.PropertySettings[settingIndex];
                    IPropertySetting   setting            = xmlPropertySetting.Deserialize();
                    group.PropertySettings.Add(setting);
                }
            }

            if (this.selectors != null)
            {
                for (int selectorIndex = 0; selectorIndex < this.Selectors.Count; selectorIndex++)
                {
                    XmlElementSelector xmlSelector = this.Selectors[selectorIndex];
                    IElementSelector   selector    = xmlSelector.Deserialize();
                    group.Selectors.Add(selector);
                }
            }

            return(group);
        }
Exemple #3
0
 void AddSelector(TreeNode node, XmlElementSelector selector)
 {
     if (node != null && selector != null)
     {
         TreeNode newNode = new TreeNode(selector.ToString(), 3, 3);
         newNode.Tag = selector;
         node.Nodes.Add(newNode);
     }
 }
Exemple #4
0
        protected virtual void SerializeProperties(XmlElementSelector xmlselctor)
        {
            XmlSelectorBase instance = (XmlSelectorBase)xmlselctor;

            if (this.Condition != null)
            {
                instance.Condition = this.Condition.Serialize();
            }

            if (this.UnapplyCondition != null)
            {
                instance.UnapplyCondition = this.UnapplyCondition.Serialize();
            }

            if (this.ChildSelector != null)
            {
                instance.ChildSelector = this.ChildSelector.Serialize();
            }

            instance.AutoUnapply = this.AutoUnapply;
        }
Exemple #5
0
        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();
            }
        }
Exemple #6
0
        /// <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);
        }
Exemple #7
0
 /// <summary>
 ///    <para>Adds a <see cref='Telerik.WinControls.XmlElementSelector'/> with the specified value to the
 ///    <see cref='Telerik.WinControls.XmlSelectorCollection'/> .</para>
 /// </summary>
 /// <param name='value'>The <see cref='Telerik.WinControls.XmlElementSelector'/> to add.</param>
 /// <returns>
 ///    <para>The index at which the new element was inserted.</para>
 /// </returns>
 public int Add(XmlElementSelector value)
 {
     return(List.Add(value));
 }
Exemple #8
0
 /// <summary>
 ///    <para> Removes a specific <see cref='Telerik.WinControls.XmlElementSelector'/> from the
 ///    <see cref='Telerik.WinControls.XmlSelectorCollection'/> .</para>
 /// </summary>
 /// <param name='value'>The <see cref='Telerik.WinControls.XmlElementSelector'/> to remove from the <see cref='Telerik.WinControls.XmlSelectorCollection'/> .</param>
 /// <returns><para>None.</para></returns>
 /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
 public void Remove(XmlElementSelector value)
 {
     List.Remove(value);
 }
Exemple #9
0
 /// <summary>
 /// <para>Inserts a <see cref='Telerik.WinControls.XmlElementSelector'/> into the <see cref='Telerik.WinControls.XmlSelectorCollection'/> 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.XmlElementSelector'/> to insert.</param>
 public void Insert(int index, XmlElementSelector value)
 {
     List.Insert(index, value);
 }
Exemple #10
0
 /// <summary>
 ///    <para>Returns the index of a <see cref='Telerik.WinControls.XmlElementSelector'/> in
 ///       the <see cref='Telerik.WinControls.XmlSelectorCollection'/> .</para>
 /// </summary>
 /// <param name='value'>The <see cref='Telerik.WinControls.XmlElementSelector'/> to locate.</param>
 /// <returns>
 /// <para>The index of the <see cref='Telerik.WinControls.XmlElementSelector'/> of <paramref name='value'/> in the
 /// <see cref='Telerik.WinControls.XmlSelectorCollection'/>, if found; otherwise, -1.</para>
 /// </returns>
 public int IndexOf(XmlElementSelector value)
 {
     return(List.IndexOf(value));
 }
Exemple #11
0
 /// <summary>
 /// <para>Gets a value indicating whether the
 ///    <see cref='Telerik.WinControls.XmlSelectorCollection'/> contains the specified <see cref='Telerik.WinControls.XmlElementSelector'/>.</para>
 /// </summary>
 /// <param name='value'>The <see cref='Telerik.WinControls.XmlElementSelector'/> to locate.</param>
 /// <returns>
 /// <para><see langword='true'/> if the <see cref='Telerik.WinControls.XmlElementSelector'/> is contained in the collection;
 ///   otherwise, <see langword='false'/>.</para>
 /// </returns>
 public bool Contains(XmlElementSelector value)
 {
     return(List.Contains(value));
 }
Exemple #12
0
 public void Remove(XmlElementSelector value)
 {
     this.List.Remove((object)value);
 }
Exemple #13
0
 public void Insert(int index, XmlElementSelector value)
 {
     this.List.Insert(index, (object)value);
 }
Exemple #14
0
 public int IndexOf(XmlElementSelector value)
 {
     return(this.List.IndexOf((object)value));
 }
Exemple #15
0
 public bool Contains(XmlElementSelector value)
 {
     return(this.List.Contains((object)value));
 }
Exemple #16
0
 public int Add(XmlElementSelector value)
 {
     return(this.List.Add((object)value));
 }