Пример #1
0
        /// <summary>
        /// Init Application class
        /// </summary>
        /// <param name="appDisplayName">App display name</param>
        /// <param name="shellPageType">Shell page type</param>
        /// <param name="mainPageType">Main page type</param>
        /// <param name="settingsPageType">Settings page type</param>
        public ApplicationBase(string appDisplayName, Type shellPageType, Type mainPageType, Type settingsPageType)
        {
            this.shellPageType    = shellPageType;
            this.mainPageType     = mainPageType;
            this.SettingsPageType = settingsPageType;
            ModuleAnalyser        = new ModuleAnalyser();

            AppDisplayName = appDisplayName;
            Current        = this;

            PropertyChangedNotifier = new PropertyChangedNotifier();

            RegisterModules();
            ModuleAnalyser = ModuleManager.ModuleAnalyser;

            Suspending += OnSuspending;
        }
        /// <summary>
        /// Raises the PropertyChanged event.
        /// </summary>
        /// <typeparam name="T">The type of the property.</typeparam>
        /// <param name="notifier">The object upon which to update a property.</param>
        /// <param name="name">This clever bit uses a lambda and reflection so you can pass the property from which the name is harvested, rather than hard-coding strings.</param>
        public static void RaisePropertyChanged <T>(this PropertyChangedNotifier notifier, System.Linq.Expressions.Expression <Func <T> > name)
        {
            var propertyName = ((System.Linq.Expressions.MemberExpression)name.Body).Member.Name;

            notifier.RaisePropertyChanged <T>(propertyName);
        }
        /// <summary>
        /// Extension method for easing the use of the UpdateProperty method of the PropertyChangedNotifier type.
        /// </summary>
        /// <typeparam name="T">Type of the property.</typeparam>
        /// <param name="notifier">The object upon which to update a property.</param>
        /// <param name="name">This clever bit uses a lambda and reflection so you can pass the property from which the name is harvested, rather than hard-coding strings.</param>
        /// <param name="newValue">The new value for the property.</param>
        /// <param name="currentValue">The current value of the property. Will equal newValue upon completion of the function.</param>
        /// <param name="customAction">Custom action to execute when raising the property changed event.</param>
        /// <returns>If the value is changed, return <c>true</c>, otherwise <c>false</c>.</returns>
        public static bool UpdateProperty <T>(this PropertyChangedNotifier notifier, System.Linq.Expressions.Expression <Func <T> > name, T newValue, ref T currentValue, Action <string, T> customAction)
        {
            var propertyName = ((System.Linq.Expressions.MemberExpression)name.Body).Member.Name;

            return(notifier.AssignAndUpdateProperty(propertyName, newValue, ref currentValue, customAction));
        }
 /// <summary>
 /// Extension method for easing the use of the UpdateProperty method of the PropertyChangedNotifier type.
 /// </summary>
 /// <typeparam name="T">Type of the property.</typeparam>
 /// <param name="notifier">The object upon which to update a property.</param>
 /// <param name="name">This clever bit uses a lambda and reflection so you can pass the property from which the name is harvested, rather than hard-coding strings.</param>
 /// <param name="newValue">The new value for the property.</param>
 /// <param name="currentValue">The current value of the property. Will equal newValue upon completion of the function.</param>
 /// <returns>If the value is changed, return <c>true</c>, otherwise <c>false</c>.</returns>
 public static bool UpdateProperty <T>(this PropertyChangedNotifier notifier, System.Linq.Expressions.Expression <Func <T> > name, T newValue, ref T currentValue)
 {
     return(UpdateProperty(notifier, name, newValue, ref currentValue, null));
 }
 public Example()
 {
     _notifier = new PropertyChangedNotifier <Example>(this);
 }
Пример #6
0
 public MainViewModel()
 {
     _notifier = new PropertyChangedNotifier <MainViewModel>(this);
 }