static void CallbackOptions(this DependencyObjectProperty objectProperty, LocalizationCallback callback, string stringFormat = null, string resourceKey = null)
 {
     Localize(objectProperty, new LocalizationOptions()
     {
         Callback = callback, StringFormat = stringFormat, Key = resourceKey
     });
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MethodLocalizedValue"/> class.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="method">The method.</param>
        /// <param name="parameter">The parameter to pass to the method.</param>
        /// <exception cref="ArgumentNullException"><paramref name="property"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="method"/> is null.</exception>
        public MethodLocalizedValue(LocalizedProperty property, LocalizationCallback method, object parameter)
            : base(property)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            _method = method;

            _parameter = parameter;
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MethodLocalizedValue"/> class.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="method">The method.</param>
        /// <param name="parameter">The parameter to pass to the method.</param>
        /// <exception cref="ArgumentNullException"><paramref name="property"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="method"/> is null.</exception>
        public MethodLocalizedValue(LocalizedProperty property, LocalizationCallback method, object parameter)
            : base(property)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            _method = method;

            _parameter = parameter;
        }
예제 #4
0
 /// <summary>
 /// Assigns a value that is produced by a callback.
 /// </summary>
 /// <param name="property">The property.</param>
 /// <param name="method">The callback method.</param>
 /// <param name="parameter">The parameter to pass to the callback method.</param>
 /// <exception cref="ArgumentNullException"><paramref name="property"/> is null.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="method"/> is null.</exception>
 /// <remarks>
 /// The method will be called once to set the initial value of the property and each
 /// time the current culture changes.
 /// </remarks>
 public static void SetCallbackValue(this LocalizedProperty property, LocalizationCallback method, object parameter)
 {
     AddLocalizedValue(new MethodLocalizedValue(property, method, parameter));
 }
 /// <summary>
 /// Assigns a value that is produced by a callback.
 /// </summary>
 /// <param name="property">The property.</param>
 /// <param name="method">The callback method.</param>
 /// <param name="parameter">The parameter to pass to the callback method.</param>
 /// <exception cref="ArgumentNullException"><paramref name="property"/> is null.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="method"/> is null.</exception>
 /// <remarks>
 /// The method will be called once to set the initial value of the property and each
 /// time the current culture changes.
 /// </remarks>
 public static void SetCallbackValue(this LocalizedProperty property, LocalizationCallback method, object parameter)
 {
     AddLocalizedValue(new MethodLocalizedValue(property, method, parameter));
 }
 /// <summary>
 /// Localizes the specified objectProperty by using the specified callback to obtain a value and then formats the value using the specified
 /// string resource.
 /// </summary>
 /// <param name="objectProperty"></param>
 public static void CallbackResourceFormat(this DependencyObjectProperty objectProperty, LocalizationCallback callback, string resourceKey)
 {
     CallbackOptions(objectProperty, callback, resourceKey: resourceKey);
 }
 public static void CallbackFormat(this DependencyObjectProperty objectProperty, LocalizationCallback callback, string stringFormat)
 {
     CallbackOptions(objectProperty, callback, stringFormat: stringFormat);
 }
 public static void Callback(this DependencyObjectProperty objectProperty, LocalizationCallback callback)
 {
     CallbackOptions(objectProperty, callback);
 }
예제 #9
0
 // ReSharper disable IdentifierTypo
 /// <summary>
 /// <see cref="Converter{TInput,TOutput}"/> Constructor.
 /// </summary>
 /// <param name="localizer"></param>
 /// <inheritdoc />
 public OptionSet(LocalizationCallback localizer)
 {
     Localizer = localizer ?? DefaultLocalization;
 }