コード例 #1
0
 static void CallbackOptions(this DependencyObjectProperty objectProperty, LocalizationCallback callback, string stringFormat = null, string resourceKey = null)
 {
     Localize(objectProperty, new LocalizationOptions()
     {
         Callback = callback, StringFormat = stringFormat, Key = resourceKey
     });
 }
コード例 #2
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;
        }
コード例 #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));
 }
コード例 #5
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));
 }
コード例 #6
0
 /// <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);
 }
コード例 #7
0
 public static void CallbackFormat(this DependencyObjectProperty objectProperty, LocalizationCallback callback, string stringFormat)
 {
     CallbackOptions(objectProperty, callback, stringFormat: stringFormat);
 }
コード例 #8
0
 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;
 }