Example #1
0
        public override void ToConfiguration(IConfigurationElement config)
        {
            if (null == config) throw new ArgumentNullException("config");

            IConfigurationElement sourceElement = config.AddElement("source");
            WriteConfiguration(sourceElement);
        }
Example #2
0
        public override void ToConfiguration(IConfigurationElement config)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }

            IConfigurationElement sourceElement = config.AddElement("source");

            WriteConfiguration(sourceElement);
        }
Example #3
0
        public override void ToConfiguration(IConfigurationElement config)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }

            IConfigurationElement sourceElement = config.AddElement("source");

            sourceElement.AddAttribute("parameter").Value = this.ParameterName;
        }
Example #4
0
        public static void ToConfiguration(this IToken token, IConfigurationElement config)
        {
            if (!config.Attributes.ContainsKey("type"))
                config.AddAttribute("type").Value = token.Key;
            else if ((string)config.GetAttributeReference("type").Value != token.Key)
                config.GetAttributeReference("type").Value = token.Key;

            IExpression expression = token as IExpression;
            if (null != expression)
            {
                IConfigurationElement operandsElement = config.AddElement("operands");
                int index = 0;
                foreach (IToken operand in expression.Operands.Where(o => null != o))
                {
                    IConfigurationElement operandElement = operandsElement.AddElement(index.ToString());
                    operand.ToConfiguration(operandElement);
                    index++;
                }
            }
            else
            {
                IBasicToken basicToken = token as IBasicToken;
                if (null != basicToken)
                {
                    IConfigurationElement sourceElement = config.AddElement("source");
                    if (null != basicToken.Source)
                    {
                        if (basicToken.Source is Control)
                            sourceElement.AddAttribute("id").Value = ((Control)basicToken.Source).ID;
                        else
                            sourceElement.AddAttribute("id").Value = basicToken.Source;

                        if (!String.IsNullOrEmpty(basicToken.Member))
                            sourceElement.AddAttribute("member").Value = basicToken.Member;
                    }
                    else if (null != basicToken.Value)
                        sourceElement.AddAttribute("value").Value = basicToken.Source;
                }
                else
                {
                    System.Reflection.MethodInfo concreteMethod = token.GetType().GetMethod("ToConfiguration", new Type[] { typeof(IConfigurationElement) });
                    if (null != concreteMethod)
                        concreteMethod.Invoke(token, new object[] { config });
                }
            }
        }
Example #5
0
 protected virtual void SaveConfiguration()
 {
     if (null != this.ConfigurationSaving)
     {
         this.ConfigurationSaving(this, new EventArgs());
     }
     if (this.EnableConfigurationProvider)
     {
         if (null == this._table)
         {
             throw new InvalidOperationException("Table is null");
         }
         IConfigurationSection configSection = this.GetConfigurationReference();
         if (null != configSection)
         {
             configSection.Elements.Clear();
             foreach (TableRow row in this._table.Rows)
             {
                 int num = this._table.Rows.GetRowIndex(row);
                 IConfigurationElement configRow = configSection.AddElement(num.ToString());
                 foreach (TableCell cell in row.Cells)
                 {
                     num = row.Cells.GetCellIndex(cell);
                     IConfigurationElement configCell = configRow.AddElement(num.ToString());
                     configCell.AddAttribute("span").Value    = ((cell.ColumnSpan == 0) ? 1 : cell.ColumnSpan);
                     configCell.AddAttribute("rowspan").Value = ((cell.RowSpan == 0) ? 1 : cell.RowSpan);
                     string containerID = this.CreateContainerID(cell.ID);
                     if (this._containersParts.ContainsKey(containerID))
                     {
                         configCell.AddAttribute("part").Value = this._containersParts[containerID];
                     }
                     else
                     {
                         configCell.AddAttribute("part").Value = string.Empty;
                     }
                     this.SaveCellProperties(cell, configCell);
                 }
             }
         }
     }
     if (null != this.ConfigurationSaved)
     {
         this.ConfigurationSaved(this, new EventArgs());
     }
 }
Example #6
0
        public static void ToConfiguration(this IToken token, IConfigurationElement config)
        {
            if (!config.Attributes.ContainsKey("type"))
            {
                config.AddAttribute("type").Value = token.Key;
            }
            else if ((string)config.GetAttributeReference("type").Value != token.Key)
            {
                config.GetAttributeReference("type").Value = token.Key;
            }

            IExpression expression = token as IExpression;

            if (null != expression)
            {
                IConfigurationElement operandsElement = config.AddElement("operands");
                int index = 0;
                foreach (IToken operand in expression.Operands.Where(o => null != o))
                {
                    IConfigurationElement operandElement = operandsElement.AddElement(index.ToString());
                    operand.ToConfiguration(operandElement);
                    index++;
                }
            }
            else
            {
                IBasicToken basicToken = token as IBasicToken;
                if (null != basicToken)
                {
                    IConfigurationElement sourceElement = config.AddElement("source");
                    if (null != basicToken.Source)
                    {
                        if (basicToken.Source is Control)
                        {
                            sourceElement.AddAttribute("id").Value = ((Control)basicToken.Source).ID;
                        }
                        else
                        {
                            sourceElement.AddAttribute("id").Value = basicToken.Source;
                        }

                        if (!String.IsNullOrEmpty(basicToken.Member))
                        {
                            sourceElement.AddAttribute("member").Value = basicToken.Member;
                        }
                    }
                    else if (null != basicToken.Value)
                    {
                        sourceElement.AddAttribute("value").Value = basicToken.Source;
                    }
                }
                else
                {
                    System.Reflection.MethodInfo concreteMethod = token.GetType().GetMethod("ToConfiguration", new Type[] { typeof(IConfigurationElement) });
                    if (null != concreteMethod)
                    {
                        concreteMethod.Invoke(token, new object[] { config });
                    }
                }
            }
        }
Example #7
0
        public override void ToConfiguration(IConfigurationElement config)
        {
            if (null == config) throw new ArgumentNullException("config");

            IConfigurationElement sourceElement = config.AddElement("source");
            sourceElement.AddAttribute("parameter").Value = this.ParameterName;
        }