コード例 #1
0
 ImageSourceServiceProvider(IThemeService themeService, IBackgroundImageOptionDefinitionService backgroundImageOptionDefinitionService, IBackgroundImageSettingsService backgroundImageSettingsService)
 {
     this.themeService = themeService;
     this.backgroundImageOptionDefinitionService = backgroundImageOptionDefinitionService;
     this.backgroundImageSettingsService         = backgroundImageSettingsService;
     imageSourceServices = new Dictionary <IBackgroundImageOptionDefinition, IImageSourceService>();
 }
コード例 #2
0
 AppSettingsPageProvider(IBackgroundImageSettingsService backgroundImageSettingsService, IPickFilename pickFilename, IPickDirectory pickDirectory)
 {
     this.backgroundImageSettingsService = backgroundImageSettingsService;
     this.pickFilename  = pickFilename;
     this.pickDirectory = pickDirectory;
 }
コード例 #3
0
 public AppSettingsPageImpl(IBackgroundImageSettingsService backgroundImageSettingsService, IPickFilename pickFilename, IPickDirectory pickDirectory, ImageSettingsInfo[] settings)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     if (settings.Length == 0)
     {
         throw new ArgumentException();
     }
     Debug.Assert(settings.All(a => a.Lazy.Value.UserVisible));
     this.backgroundImageSettingsService = backgroundImageSettingsService ?? throw new ArgumentNullException(nameof(backgroundImageSettingsService));
     this.pickFilename  = pickFilename ?? throw new ArgumentNullException(nameof(pickFilename));
     this.pickDirectory = pickDirectory ?? throw new ArgumentNullException(nameof(pickDirectory));
     Settings           = new ObservableCollection <Settings>(settings.OrderBy(a => a.Lazy.Value.UIOrder).Select(a => new Settings(a)));
     stretchVM          = new EnumListVM(EnumVM.Create(false, typeof(Stretch)), (a, b) => currentItem.RawSettings.Stretch = (Stretch)stretchVM.SelectedItem);
     stretchDirectionVM = new EnumListVM(stretchDirectionList, (a, b) => currentItem.RawSettings.StretchDirection = (StretchDirection)stretchDirectionVM.SelectedItem);
     imagePlacementVM   = new EnumListVM(imagePlacementList, (a, b) => currentItem.RawSettings.ImagePlacement = (ImagePlacement)imagePlacementVM.SelectedItem);
     opacityVM          = new DoubleVM(a => { if (!opacityVM.HasError)
                                              {
                                                  currentItem.RawSettings.Opacity = FilterOpacity(opacityVM.Value);
                                              }
                                       });
     horizontalOffsetVM = new DoubleVM(a => { if (!horizontalOffsetVM.HasError)
                                              {
                                                  currentItem.RawSettings.HorizontalOffset = FilterOffset(horizontalOffsetVM.Value);
                                              }
                                       });
     verticalOffsetVM = new DoubleVM(a => { if (!verticalOffsetVM.HasError)
                                            {
                                                currentItem.RawSettings.VerticalOffset = FilterOffset(verticalOffsetVM.Value);
                                            }
                                     });
     leftMarginWidthPercentVM = new DoubleVM(a => { if (!leftMarginWidthPercentVM.HasError)
                                                    {
                                                        currentItem.RawSettings.LeftMarginWidthPercent = FilterMarginPercent(leftMarginWidthPercentVM.Value);
                                                    }
                                             });
     rightMarginWidthPercentVM = new DoubleVM(a => { if (!rightMarginWidthPercentVM.HasError)
                                                     {
                                                         currentItem.RawSettings.RightMarginWidthPercent = FilterMarginPercent(rightMarginWidthPercentVM.Value);
                                                     }
                                              });
     topMarginHeightPercentVM = new DoubleVM(a => { if (!topMarginHeightPercentVM.HasError)
                                                    {
                                                        currentItem.RawSettings.TopMarginHeightPercent = FilterMarginPercent(topMarginHeightPercentVM.Value);
                                                    }
                                             });
     bottomMarginHeightPercentVM = new DoubleVM(a => { if (!bottomMarginHeightPercentVM.HasError)
                                                       {
                                                           currentItem.RawSettings.BottomMarginHeightPercent = FilterMarginPercent(bottomMarginHeightPercentVM.Value);
                                                       }
                                                });
     maxHeightVM = new DoubleVM(a => { if (!maxHeightVM.HasError)
                                       {
                                           currentItem.RawSettings.MaxHeight = FilterLength(maxHeightVM.Value);
                                       }
                                });
     maxWidthVM = new DoubleVM(a => { if (!maxWidthVM.HasError)
                                      {
                                          currentItem.RawSettings.MaxWidth = FilterLength(maxWidthVM.Value);
                                      }
                               });
     zoomVM = new DoubleVM(a => { if (!zoomVM.HasError)
                                  {
                                      currentItem.RawSettings.Zoom = FilterZoom(zoomVM.Value);
                                  }
                           });
     intervalVM = new DefaultConverterVM <TimeSpan>(a => { if (!intervalVM.HasError)
                                                           {
                                                               currentItem.RawSettings.Interval = intervalVM.Value;
                                                           }
                                                    });
     CurrentItem = Settings.FirstOrDefault(a => a.Id == backgroundImageSettingsService.LastSelectedId) ?? Settings[0];
 }
コード例 #4
0
		AppSettingsPageProvider(IBackgroundImageSettingsService backgroundImageSettingsService, IPickFilename pickFilename, IPickDirectory pickDirectory) {
			this.backgroundImageSettingsService = backgroundImageSettingsService;
			this.pickFilename = pickFilename;
			this.pickDirectory = pickDirectory;
		}
コード例 #5
0
		public AppSettingsPageImpl(IBackgroundImageSettingsService backgroundImageSettingsService, IPickFilename pickFilename, IPickDirectory pickDirectory, ImageSettingsInfo[] settings) {
			if (backgroundImageSettingsService == null)
				throw new ArgumentNullException(nameof(backgroundImageSettingsService));
			if (pickFilename == null)
				throw new ArgumentNullException(nameof(pickFilename));
			if (pickDirectory == null)
				throw new ArgumentNullException(nameof(pickDirectory));
			if (settings == null)
				throw new ArgumentNullException(nameof(settings));
			if (settings.Length == 0)
				throw new ArgumentException();
			Debug.Assert(settings.All(a => a.Lazy.Value.UserVisible));
			this.backgroundImageSettingsService = backgroundImageSettingsService;
			this.pickFilename = pickFilename;
			this.pickDirectory = pickDirectory;
			Settings = new ObservableCollection<Settings>(settings.OrderBy(a => a.Lazy.Value.UIOrder).Select(a => new Settings(a)));
			stretchVM = new EnumListVM(EnumVM.Create(false, typeof(Stretch)), (a, b) => currentItem.RawSettings.Stretch = (Stretch)stretchVM.SelectedItem);
			stretchDirectionVM = new EnumListVM(stretchDirectionList, (a, b) => currentItem.RawSettings.StretchDirection = (StretchDirection)stretchDirectionVM.SelectedItem);
			imagePlacementVM = new EnumListVM(imagePlacementList, (a, b) => currentItem.RawSettings.ImagePlacement = (ImagePlacement)imagePlacementVM.SelectedItem);
			opacityVM = new DoubleVM(a => { if (!opacityVM.HasError) currentItem.RawSettings.Opacity = FilterOpacity(opacityVM.Value); });
			horizontalOffsetVM = new DoubleVM(a => { if (!horizontalOffsetVM.HasError) currentItem.RawSettings.HorizontalOffset = FilterOffset(horizontalOffsetVM.Value); });
			verticalOffsetVM = new DoubleVM(a => { if (!verticalOffsetVM.HasError) currentItem.RawSettings.VerticalOffset = FilterOffset(verticalOffsetVM.Value); });
			leftMarginWidthPercentVM = new DoubleVM(a => { if (!leftMarginWidthPercentVM.HasError) currentItem.RawSettings.LeftMarginWidthPercent = FilterMarginPercent(leftMarginWidthPercentVM.Value); });
			rightMarginWidthPercentVM = new DoubleVM(a => { if (!rightMarginWidthPercentVM.HasError) currentItem.RawSettings.RightMarginWidthPercent = FilterMarginPercent(rightMarginWidthPercentVM.Value); });
			topMarginHeightPercentVM = new DoubleVM(a => { if (!topMarginHeightPercentVM.HasError) currentItem.RawSettings.TopMarginHeightPercent = FilterMarginPercent(topMarginHeightPercentVM.Value); });
			bottomMarginHeightPercentVM = new DoubleVM(a => { if (!bottomMarginHeightPercentVM.HasError) currentItem.RawSettings.BottomMarginHeightPercent = FilterMarginPercent(bottomMarginHeightPercentVM.Value); });
			maxHeightVM = new DoubleVM(a => { if (!maxHeightVM.HasError) currentItem.RawSettings.MaxHeight = FilterLength(maxHeightVM.Value); });
			maxWidthVM = new DoubleVM(a => { if (!maxWidthVM.HasError) currentItem.RawSettings.MaxWidth = FilterLength(maxWidthVM.Value); });
			zoomVM = new DoubleVM(a => { if (!zoomVM.HasError) currentItem.RawSettings.Zoom = FilterZoom(zoomVM.Value); });
			intervalVM = new DefaultConverterVM<TimeSpan>(a => { if (!intervalVM.HasError) currentItem.RawSettings.Interval = intervalVM.Value; });
			CurrentItem = Settings.FirstOrDefault(a => a.Id == backgroundImageSettingsService.LastSelectedId) ?? Settings[0];
		}
コード例 #6
0
		ImageSourceServiceProvider(IThemeService themeService, IBackgroundImageOptionDefinitionService backgroundImageOptionDefinitionService, IBackgroundImageSettingsService backgroundImageSettingsService) {
			this.themeService = themeService;
			this.backgroundImageOptionDefinitionService = backgroundImageOptionDefinitionService;
			this.backgroundImageSettingsService = backgroundImageSettingsService;
			imageSourceServices = new Dictionary<IBackgroundImageOptionDefinition, IImageSourceService>();
		}