Exemple #1
0
        /// <summary>
        /// Determines whether FlexiMvvm classes which implement <see cref="INotifyPropertyChanged"/> should raise <see cref="INotifyPropertyChanged.PropertyChanged"/> event.
        /// </summary>
        /// <param name="config">The FlexiMvvm configuration.</param>
        /// <param name="value"><c>true</c> if FlexiMvvm classes should raise <see cref="INotifyPropertyChanged.PropertyChanged"/> event; otherwise, <c>false</c>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="config"/> is <c>null</c>.</exception>
        public static void ShouldRaisePropertyChanged(this FlexiMvvmConfig config, bool value)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            config.SetValue(ShouldRaisePropertyChangedKey, value);
        }
Exemple #2
0
        /// <summary>
        /// Determines whether FlexiMvvm classes which implement <see cref="INotifyPropertyChanged"/> should raise <see cref="INotifyPropertyChanged.PropertyChanged"/> event.
        /// </summary>
        /// <param name="config">>The FlexiMvvm configuration.</param>
        /// <returns><c>true</c> if FlexiMvvm classes raise <see cref="INotifyPropertyChanged.PropertyChanged"/> event; otherwise, <c>false</c>. Returns <c>true</c> by default.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="config"/> is <c>null</c>.</exception>
        public static bool ShouldRaisePropertyChanged(this FlexiMvvmConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            return(config.GetValue(ShouldRaisePropertyChangedKey, true));
        }
        /// <summary>
        /// Returns a logger factory instance. This method is intended for internal use by FlexiMvvm.
        /// </summary>
        /// <param name="config">The FlexiMvvm configuration.</param>
        /// <returns>The logger factory instance.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="config"/> is <see langword="null"/>.</exception>
        public static ILoggerFactory GetLoggerFactory(this FlexiMvvmConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            return(config.GetValue <ILoggerFactory>(LoggerFactoryKey, NullLoggerFactory.Instance));
        }
        /// <summary>
        /// Sets the logger factory instance. FlexiMvvm uses this logger factory to log its diagnostic events.
        /// </summary>
        /// <param name="config">The FlexiMvvm configuration.</param>
        /// <param name="loggerFactory">The logger factory.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="config"/> or <paramref name="loggerFactory"/> is <see langword="null"/>.
        /// </exception>
        public static void SetLoggerFactory(this FlexiMvvmConfig config, ILoggerFactory loggerFactory)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            config.SetValue(LoggerFactoryKey, loggerFactory);
        }