Esempio n. 1
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="ApplicationVM" /> class.
 /// </summary>
 /// <param name="categoriesVM">
 ///   The <see cref="ViewModels.WallpaperCategoryCollectionVM" /> instance.
 /// </param>
 /// <param name="wallpaperChangerVM">
 ///   The the <see cref="ViewModels.WallpaperChangerVM" /> instance providing an interface to
 ///   control the cycling of wallpapers.
 /// </param>
 /// <param name="requestShowMain">
 ///   The delegate invoked to request the showing of the main view.
 /// </param>
 /// <param name="requestShowConfiguration">
 ///   The delegate invoked to request the showing of the configuration view.
 /// </param>
 /// <param name="requestShowChangelog">
 ///   The delegate invoked to request the showing of the Changelog.
 /// </param>
 /// <param name="requestShowAbout">
 ///   The delegate invoked to request the showing of the about view.
 /// </param>
 /// <param name="requestUpdateCheck">
 ///   The delegate invoked to request a check for updates.
 /// </param>
 /// <param name="requestTerminateApplication">
 ///   The delegate invoked to request a termination of the application.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///   <paramref name="categoriesVM" /> or <paramref name="wallpaperChangerVM" /> or <paramref name="requestShowMain" /> or
 ///   <paramref name="requestShowConfiguration" /> or <paramref name="requestShowChangelog" /> or
 ///   <paramref name="requestShowAbout" /> or <paramref name="requestUpdateCheck" /> or
 ///   <paramref name="requestTerminateApplication" /> is <c>null</c>.
 /// </exception>
 /// <seealso cref="ViewModels.WallpaperCategoryCollectionVM">WallpaperCategoryCollectionVM Class</seealso>
 /// <seealso cref="ViewModels.WallpaperChangerVM">WallpaperChangerVM Class</seealso>
 public ApplicationVM(
     WallpaperCategoryCollectionVM categoriesVM,
     WallpaperChangerVM wallpaperChangerVM,
     Action <ApplicationVM, bool> requestShowMain,
     Action <ApplicationVM> requestShowConfiguration,
     Action <ApplicationVM> requestShowChangelog,
     Action <ApplicationVM> requestShowAbout,
     Action <ApplicationVM> requestUpdateCheck,
     Action <ApplicationVM> requestTerminateApplication)
 {
     this.WallpaperCategoryCollectionVM = categoriesVM;
     this.WallpaperChangerVM            = wallpaperChangerVM;
     this.RequestUpdateCheck            = requestUpdateCheck;
     this.RequestShowMain             = requestShowMain;
     this.RequestShowConfiguration    = requestShowConfiguration;
     this.RequestShowChangelog        = requestShowChangelog;
     this.RequestShowAbout            = requestShowAbout;
     this.RequestTerminateApplication = requestTerminateApplication;
 }
Esempio n. 2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="WallpaperCategoryVM" /> class.
        /// </summary>
        /// <param name="category">
        ///   The <see cref="WallpaperManager.Models.Wallpaper" /> which should be wrapped by this View Model.
        /// </param>
        /// <param name="wallpaperChangerVM">
        ///   The <see cref="ViewModels.WallpaperChangerVM" /> instance used to control cycle operations
        ///   performed by this View Model.
        /// </param>
        /// <param name="requestConfigureSelected">
        ///   The delegate invoked to request the configuration of the selected <see cref="WallpaperVM" /> instances.
        /// </param>
        /// <param name="requestConfigureDefaultSettings">
        ///   The delegate invoked to request the configuration of the <see cref="WallpaperDefaultSettings" />.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///   <paramref name="category" /> or <paramref name="wallpaperChangerVM" /> or
        ///   <paramref name="requestConfigureSelected" /> or <paramref name="requestConfigureDefaultSettings" /> is <c>null</c>.
        /// </exception>
        /// <commondoc select='ViewModels/General/seealso' />
        public WallpaperCategoryVM(
            WallpaperCategory category,
            WallpaperChangerVM wallpaperChangerVM,
            Action <WallpaperCategoryVM> requestConfigureSelected,
            Action <WallpaperCategoryVM> requestConfigureDefaultSettings)
        {
            this.Category                        = category;
            this.WallpaperChangerVM              = wallpaperChangerVM;
            this.RequestConfigureSelected        = requestConfigureSelected;
            this.RequestConfigureDefaultSettings = requestConfigureDefaultSettings;

            CollectionChangedEventManager.AddListener(category, this);

            // Simulate adding of all wallpapers to the category so that a WallpaperVM is created for any Wallpaper instance.
            this.handleCategoryCollectionChanged = true;
            this.Category_CollectionChanged(
                this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, category));

            this.selectedWallpaperVMs = new ReadOnlyCollection <WallpaperVM>(new List <WallpaperVM>());

            PropertyChangedEventManager.AddListener(wallpaperChangerVM, this, string.Empty);
            this.WallpaperChangerVM_PropertyChanged(this, new PropertyChangedEventArgs("ActiveWallpapers"));
        }