示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DifferentTypeOperationState"/> class.
        /// </summary>
        /// <param name="initialSelectionType">Initial type of the selection.</param>
        /// <param name="dataSourceType">Type of the data source.</param>
        /// <param name="initialSelection">The initial selection.</param>
        /// <param name="dataSource">The data source.</param>
        /// <param name="sourceProperty">The source property.</param>
        /// <param name="valueProperty">The value property.</param>
        /// <param name="textProperty">The text property.</param>
        /// <param name="textFormat">The text format.</param>
        /// <param name="valueFormat">The value format.</param>
        /// <param name="isInitialSelectionASet">if set to <c>true</c> [is initial selection A set].</param>
        public DifferentTypeOperationState(Type initialSelectionType, Type dataSourceType,
                                           object initialSelection, IEnumerable dataSource,
                                           String sourceProperty, String valueProperty,
                                           String textProperty, String textFormat, String valueFormat, bool isInitialSelectionASet)
            : base(dataSourceType, dataSource, false, valueProperty, textProperty, textFormat, valueFormat)
        {
            this.initialSelection       = initialSelection;
            this.isInitialSelectionASet = isInitialSelectionASet;

            if (sourceProperty != null)
            {
                sourcePropInfo = FormHelper.ValueGetterAbstractFactory.Create(initialSelectionType, sourceProperty);                 // FormHelper.GetMethod(initialSelectionType, sourceProperty);
            }
            else if (valueProperty != null)
            {
                sourcePropInfo = FormHelper.ValueGetterAbstractFactory.Create(initialSelectionType, valueProperty);                 // FormHelper.GetMethod(initialSelectionType, valueProperty);
            }
        }
示例#2
-1
        /// <summary>
        /// Initializes a new instance of the <see cref="OperationState"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="dataSource">The data source.</param>
        /// <param name="emptyValueCase">if set to <c>true</c> [empty value case].</param>
        /// <param name="valueProperty">The value property.</param>
        /// <param name="textProperty">The text property.</param>
        /// <param name="textFormat">The text format.</param>
        /// <param name="valueFormat">The value format.</param>
        protected OperationState(Type type, IEnumerable dataSource,
                                 bool emptyValueCase, String valueProperty, String textProperty, String textFormat, String valueFormat)
        {
            if (dataSource != null)
            {
                enumerator = dataSource.GetEnumerator();
            }

            this.type        = type;
            this.textFormat  = textFormat;
            this.valueFormat = valueFormat;

            if (valueProperty != null || emptyValueCase)
            {
                valuePropInfo = FormHelper.ValueGetterAbstractFactory.Create(type, valueProperty);
            }

            if (textProperty != null)
            {
                textPropInfo = FormHelper.ValueGetterAbstractFactory.Create(type, textProperty);
            }
        }