示例#1
0
        /// <summary>
        ///   Shows the <see cref="ConfigWallpaperWindow" /> to configure the <see cref="WallpaperDefaultSettings" /> of the
        ///   given <see cref="WallpaperCategoryVM" />.
        /// </summary>
        /// <param name="categoryVM">
        ///   The <see cref="WallpaperCategoryVM" /> to configure the <see cref="WallpaperDefaultSettings" /> for.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///   <paramref name="categoryVM" /> is <c>null</c>.
        /// </exception>
        /// <seealso cref="WallpaperCategoryVM">WallpaperCategoryVM Class</seealso>
        private void WallpaperCategoryVM_RequestConfigureDefaultSettings(WallpaperCategoryVM categoryVM)
        {
            if (categoryVM == null)
            {
                throw new ArgumentNullException();
            }

            ConfigWallpaperVM configWallpaperVM = new ConfigWallpaperVM(categoryVM.Category.WallpaperDefaultSettings);

            configWallpaperVM.UnhandledCommandException += this.ConfigWallpaperVM_UnhandledCommandException;

            ConfigWallpaperWindow configWallpaperWindow = new ConfigWallpaperWindow(configWallpaperVM, this.Configuration.General.ScreensSettings);

            configWallpaperWindow.Owner = this.MainWindow;

            bool?result = configWallpaperWindow.ShowDialog();

            // If the settings have been confirmed by the user.
            if ((result != null) && result.Value)
            {
                this.WriteConfigFile();
            }
        }
示例#2
0
        /// <summary>
        ///   Shows the <see cref="ConfigWallpaperWindow" /> to configure the selected <see cref="Wallpaper" /> instances of the
        ///   given <see cref="WallpaperCategoryVM" />.
        /// </summary>
        /// <param name="categoryVM">
        ///   The <see cref="WallpaperCategoryVM" /> to configure the selected <see cref="Wallpaper" /> instances for.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///   <paramref name="categoryVM" /> is <c>null</c>.
        /// </exception>
        /// <seealso cref="WallpaperCategoryVM">WallpaperCategoryVM Class</seealso>
        private void WallpaperCategoryVM_RequestConfigureSelected(WallpaperCategoryVM categoryVM)
        {
            if (categoryVM == null)
            {
                throw new ArgumentNullException();
            }

            var wallpapersToConfigure = new Wallpaper[categoryVM.SelectedWallpaperVMs.Count];

            for (int i = 0; i < categoryVM.SelectedWallpaperVMs.Count; i++)
            {
                wallpapersToConfigure[i] = categoryVM.SelectedWallpaperVMs[i].Wallpaper;
            }

            ConfigWallpaperVM configWallpaperVM = new ConfigWallpaperVM(this.Configuration.General, wallpapersToConfigure, categoryVM.IsSynchronizedCategory);

            configWallpaperVM.UnhandledCommandException += this.ConfigWallpaperVM_UnhandledCommandException;

            ConfigWallpaperWindow configWallpaperWindow = new ConfigWallpaperWindow(configWallpaperVM, this.Configuration.General.ScreensSettings);

            configWallpaperWindow.Owner = this.MainWindow;

            bool?result = configWallpaperWindow.ShowDialog();

            // If the settings have been confirmed by the user.
            if ((result != null) && result.Value)
            {
                this.WriteConfigFile();
            }

            // It could be possible that the ImagePath of a wallpaper has been changed, so we clear the thumbnails which will
            // then be recreated when the GUI requests them.
            for (int i = 0; i < categoryVM.SelectedWallpaperVMs.Count; i++)
            {
                categoryVM.SelectedWallpaperVMs[i].Thumbnail = null;
            }
        }