/// <summary>
        /// Converts the <see cref="DisplayItemModel"/> into a menu display item model.
        /// </summary>
        /// <param name="data">The data.</param>
        public static MenuDisplayItemModel ToMenuDisplayItemModel(this DisplayItemModel data)
        {
            if (data == null)
            {
                return(null);
            }

            var menuItem = new MenuDisplayItemModel();

            FrameworkTypeUtility.SetProperties(data, menuItem);

            return(menuItem);
        }
Example #2
0
        /// <summary>
        /// Updates the view model.
        /// </summary>
        /// <typeparam name="TModel">The type of the model.</typeparam>
        /// <typeparam name="TViewModel">The type of the view model.</typeparam>
        /// <param name="notifier">The notifier.</param>
        /// <param name="model">The model.</param>
        /// <exception cref="System.NullReferenceException">Notifier as TViewModel returns null.</exception>
        public static void UpdateViewModel <TModel, TViewModel>(this INotifyPropertyChanged notifier, TModel model)
            where TViewModel : class
            where TModel : class, TViewModel
        {
            if (notifier == null)
            {
                return;
            }
            var vm = notifier as TViewModel;

            if (vm == null)
            {
                throw new NullReferenceException("Notifier as TViewModel returns null.");
            }
            FrameworkTypeUtility.SetProperties <TModel, TViewModel>(model, vm);
        }
        void SetProperties(Assembly dll)
        {
            var data = new FrameworkAssemblyInfo(dll);

            FrameworkTypeUtility.SetProperties <FrameworkAssemblyInfo, AboutViewModel>(data, this);
        }