Exemple #1
0
        /// <summary>
        /// Creates a new state which is based on current state and has given value for given property.
        /// </summary>
        /// <typeparam name="PropertyType">Type of value represented by property.</typeparam>
        /// <param name="property">Property which value will be set.</param>
        /// <param name="value">Value which will be set to the property.</param>
        /// <returns>The new dialog state.</returns>
        private DialogState newStateWithValue <PropertyType>(StateProperty <PropertyType> property, PropertyType value)
        {
            var propertyToValueCopy = new Dictionary <object, object>(_propertyToValue);

            property.SetValue(propertyToValueCopy, value);

            return(new DialogState(propertyToValueCopy));
        }
Exemple #2
0
        /// <summary>
        /// Initialize given property reference with new property of given name.
        /// </summary>
        /// <typeparam name="PropertyType">Type of value represented by property.</typeparam>
        /// <param name="property">Initialized property.</param>
        /// <param name="propertyName">Name of initialized property.</param>
        private static void initialize <PropertyType>(ref StateProperty <PropertyType> property, string propertyName)
        {
            if (property != null)
            {
                throw new NotSupportedException("Cannot initialize same property twice");
            }

            property = new StateProperty <PropertyType>(propertyName);
        }
Exemple #3
0
 /// <summary>
 /// Gets value that is stored by given property.
 /// </summary>
 /// <typeparam name="PropertyType">Type of value represented by property.</typeparam>
 /// <param name="property">Property which value is requested.</param>
 /// <returns>Value of the property if available <c>default</c> otherwise.</returns>
 private PropertyType getValue <PropertyType>(StateProperty <PropertyType> property)
 {
     return(property.GetValue(_propertyToValue));
 }