MainViewModel.cs 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178
  1. using System.Reactive;
  2. using Avalonia;
  3. using Avalonia.Controls;
  4. using Avalonia.Controls.Primitives;
  5. using Avalonia.Layout;
  6. using Avalonia.Media;
  7. using PicView.Avalonia.Clipboard;
  8. using PicView.Avalonia.Converters;
  9. using PicView.Avalonia.FileSystem;
  10. using PicView.Avalonia.Functions;
  11. using PicView.Avalonia.Gallery;
  12. using PicView.Avalonia.ImageTransformations.Rotation;
  13. using PicView.Avalonia.Interfaces;
  14. using PicView.Avalonia.LockScreen;
  15. using PicView.Avalonia.Navigation;
  16. using PicView.Avalonia.UI;
  17. using PicView.Avalonia.Wallpaper;
  18. using PicView.Avalonia.WindowBehavior;
  19. using PicView.Core.FileSorting;
  20. using PicView.Core.Gallery;
  21. using PicView.Core.ProcessHandling;
  22. using PicView.Core.Sizing;
  23. using PicView.Core.ViewModels;
  24. using ReactiveUI;
  25. using ImageViewer = PicView.Avalonia.Views.ImageViewer;
  26. namespace PicView.Avalonia.ViewModels;
  27. public class MainViewModel : ReactiveObject
  28. {
  29. public readonly IPlatformSpecificService? PlatformService;
  30. public readonly IPlatformWindowService? PlatformWindowService;
  31. public TranslationViewModel Translation { get; } = new();
  32. public SettingsViewModel? SettingsViewModel { get; set; }
  33. public ImageCropperViewModel? Crop { get; set; }
  34. public PicViewerModel PicViewer { get; } = new();
  35. public ExifViewModel Exif { get; } = new();
  36. public FileAssociationsViewModel? AssociationsViewModel { get; set; }
  37. public MainViewModel(IPlatformSpecificService? platformSpecificService, IPlatformWindowService? platformWindowService)
  38. {
  39. FunctionsMapper.Vm = this;
  40. PlatformService = platformSpecificService;
  41. PlatformWindowService = platformWindowService;
  42. #region Window commands
  43. ExitCommand = FunctionsHelper.CreateReactiveCommand(WindowFunctions.Close);
  44. MinimizeCommand = FunctionsHelper.CreateReactiveCommand(WindowFunctions.Minimize);
  45. MaximizeCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Maximize);
  46. RestoreCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Restore);
  47. ToggleFullscreenCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleFullscreen);
  48. NewWindowCommand = FunctionsHelper.CreateReactiveCommand(ProcessHelper.StartNewProcess);
  49. ShowExifWindowCommand = FunctionsHelper.CreateReactiveCommand(PlatformWindowService.ShowExifWindow);
  50. ShowSettingsWindowCommand = FunctionsHelper.CreateReactiveCommand(PlatformWindowService.ShowSettingsWindow);
  51. ShowKeybindingsWindowCommand = FunctionsHelper.CreateReactiveCommand(PlatformWindowService.ShowKeybindingsWindow);
  52. ShowAboutWindowCommand = FunctionsHelper.CreateReactiveCommand(PlatformWindowService.ShowAboutWindow);
  53. ShowBatchResizeWindowCommand = FunctionsHelper.CreateReactiveCommand(PlatformWindowService.ShowBatchResizeWindow);
  54. ShowSingleImageResizeWindowCommand =
  55. FunctionsHelper.CreateReactiveCommand(PlatformWindowService.ShowSingleImageResizeWindow);
  56. ShowEffectsWindowCommand = FunctionsHelper.CreateReactiveCommand(PlatformWindowService.ShowEffectsWindow);
  57. #endregion Window commands
  58. #region Navigation Commands
  59. NextCommand = FunctionsHelper.CreateReactiveCommand(() => { Task.Run(FunctionsMapper.Next); });
  60. NextButtonCommand = FunctionsHelper.CreateReactiveCommand(() => { UIHelper.NextButtonNavigation(this); });
  61. NextArrowButtonCommand = FunctionsHelper.CreateReactiveCommand(() => { UIHelper.NextArrowButtonNavigation(this); });
  62. NextFolderCommand = FunctionsHelper.CreateReactiveCommand(() => { Task.Run(FunctionsMapper.NextFolder); });
  63. PreviousCommand = FunctionsHelper.CreateReactiveCommand(() => { Task.Run(FunctionsMapper.Prev); });
  64. PreviousButtonCommand = FunctionsHelper.CreateReactiveCommand(() => { UIHelper.PreviousButtonNavigation(this); });
  65. PreviousArrowButtonCommand = FunctionsHelper.CreateReactiveCommand(() => { UIHelper.PreviousArrowButtonNavigation(this); });
  66. PreviousFolderCommand = FunctionsHelper.CreateReactiveCommand(() => { Task.Run(FunctionsMapper.PrevFolder); });
  67. Skip10Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Next10);
  68. Skip100Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Next100);
  69. Prev10Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Prev10);
  70. Prev100Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Prev100);
  71. FirstCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.First);
  72. LastCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Last);
  73. ReloadCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Reload);
  74. #endregion Navigation Commands
  75. #region Sort Commands
  76. SortFilesByNameCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SortFilesByName);
  77. SortFilesByCreationTimeCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SortFilesByCreationTime);
  78. SortFilesByLastAccessTimeCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SortFilesByLastAccessTime);
  79. SortFilesBySizeCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SortFilesBySize);
  80. SortFilesByExtensionCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SortFilesByExtension);
  81. SortFilesRandomlyCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SortFilesRandomly);
  82. SortFilesAscendingCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SortFilesAscending);
  83. SortFilesDescendingCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SortFilesDescending);
  84. #endregion Sort Commands
  85. #region Menus
  86. CloseMenuCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.CloseMenus);
  87. ToggleFileMenuCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleFileMenu);
  88. ToggleImageMenuCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleImageMenu);
  89. ToggleSettingsMenuCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleSettingsMenu);
  90. ToggleToolsMenuCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleToolsMenu);
  91. #endregion Menus
  92. #region Image commands
  93. RotateLeftCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.RotateLeft);
  94. RotateLeftButtonCommand = FunctionsHelper.CreateReactiveCommand(async () =>
  95. {
  96. await RotationNavigation.RotateLeft(this, RotationButton.RotateLeftButton);
  97. });
  98. RotateRightCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.RotateRight);
  99. RotateRightButtonCommand = FunctionsHelper.CreateReactiveCommand(async () =>
  100. {
  101. await RotationNavigation.RotateRight(this, RotationButton.RotateRightButton);
  102. });
  103. RotateToCommand = FunctionsHelper.CreateReactiveCommand<string>(RotateToTask);
  104. RotateRightWindowBorderButtonCommand = FunctionsHelper.CreateReactiveCommand(async () =>
  105. {
  106. await RotationNavigation.RotateRight(this, RotationButton.WindowBorderButton);
  107. });
  108. FlipCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Flip);
  109. StretchCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Stretch);
  110. CropCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Crop);
  111. ToggleScrollCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleScroll);
  112. OptimizeImageCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.OptimizeImage);
  113. ChangeBackgroundCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ChangeBackground);
  114. ShowSideBySideCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SideBySide);
  115. #endregion Image commands
  116. #region File commands
  117. OpenFileCommand = FunctionsHelper.CreateReactiveCommand(() => { Task.Run(FunctionsMapper.Open); });
  118. OpenLastFileCommand = FunctionsHelper.CreateReactiveCommand(() => { Task.Run(FunctionsMapper.OpenLastFile); });
  119. SaveFileCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Save);
  120. SaveFileAsCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SaveAs);
  121. CopyFileCommand = FunctionsHelper.CreateReactiveCommand<string>(CopyFileTask);
  122. CopyFilePathCommand = FunctionsHelper.CreateReactiveCommand<string>(CopyFilePathTask);
  123. FilePropertiesCommand = FunctionsHelper.CreateReactiveCommand<string>(ShowFilePropertiesTask);
  124. CopyImageCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.CopyImage);
  125. CopyBase64Command = FunctionsHelper.CreateReactiveCommand<string>(CopyBase64Task);
  126. CutCommand = FunctionsHelper.CreateReactiveCommand<string>(CutFileTask);
  127. PasteCommand = FunctionsHelper.CreateReactiveCommand(() => { Task.Run(FunctionsMapper.Paste); });
  128. OpenWithCommand = FunctionsHelper.CreateReactiveCommand<string>(OpenWithTask);
  129. RenameCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Rename);
  130. ResizeCommand = FunctionsHelper.CreateReactiveCommand<int>(ResizeImageByPercentage);
  131. ConvertCommand = FunctionsHelper.CreateReactiveCommand<int>(ConvertFileExtension);
  132. DuplicateFileCommand = FunctionsHelper.CreateReactiveCommand<string>(DuplicateFileTask);
  133. PrintCommand = FunctionsHelper.CreateReactiveCommand<string>(PrintTask);
  134. DeleteFileCommand = FunctionsHelper.CreateReactiveCommand<string>(DeleteFileTask);
  135. RecycleFileCommand = FunctionsHelper.CreateReactiveCommand<string>(RecycleFileTask);
  136. LocateOnDiskCommand = FunctionsHelper.CreateReactiveCommand<string>(LocateOnDiskTask);
  137. SetAsWallpaperCommand = FunctionsHelper.CreateReactiveCommand<string>(SetAsWallpaperTask);
  138. SetAsWallpaperTiledCommand = FunctionsHelper.CreateReactiveCommand<string>(SetAsWallpaperTiledTask);
  139. SetAsWallpaperStretchedCommand = FunctionsHelper.CreateReactiveCommand<string>(SetAsWallpaperStretchedTask);
  140. SetAsWallpaperCenteredCommand = FunctionsHelper.CreateReactiveCommand<string>(SetAsWallpaperCenteredTask);
  141. SetAsWallpaperFilledCommand = FunctionsHelper.CreateReactiveCommand<string>(SetAsWallpaperFilledTask);
  142. SetAsLockScreenCommand = FunctionsHelper.CreateReactiveCommand<string>(SetAsLockScreenTask);
  143. #endregion File commands
  144. #region EXIF commands
  145. SetExifRating0Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Set0Star);
  146. SetExifRating1Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Set1Star);
  147. SetExifRating2Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Set2Star);
  148. SetExifRating3Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Set3Star);
  149. SetExifRating4Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Set4Star);
  150. SetExifRating5Command = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Set5Star);
  151. OpenGoogleLinkCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.OpenGoogleMaps);
  152. OpenBingLinkCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.OpenBingMaps);
  153. #endregion EXIF commands
  154. #region Gallery Commands
  155. ToggleGalleryCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleGallery);
  156. ToggleBottomGalleryCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.OpenCloseBottomGallery);
  157. CloseGalleryCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.CloseGallery);
  158. GalleryItemStretchCommand = FunctionsHelper.CreateReactiveCommand<string>(SetGalleryItemStretch);
  159. #endregion Gallery Commands
  160. #region UI Commands
  161. ToggleUICommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleInterface);
  162. ToggleBottomNavBarCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleBottomToolbar);
  163. ToggleBottomGalleryShownInHiddenUICommand = FunctionsHelper.CreateReactiveCommand(async () =>
  164. {
  165. await HideInterfaceLogic.ToggleBottomGalleryShownInHiddenUI(this);
  166. });
  167. ToggleFadeInButtonsOnHoverCommand = FunctionsHelper.CreateReactiveCommand(async () =>
  168. {
  169. await HideInterfaceLogic.ToggleFadeInButtonsOnHover(this);
  170. });
  171. ChangeCtrlZoomCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ChangeCtrlZoom);
  172. ColorPickerCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ColorPicker);
  173. SlideshowCommand = FunctionsHelper.CreateReactiveCommand<int>(StartSlideShowTask);
  174. ToggleTaskbarProgressCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleTaskbarProgress);
  175. ToggleConstrainBackgroundColorCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleConstrainBackgroundColor);
  176. #endregion UI Commands
  177. #region Settings commands
  178. ChangeAutoFitCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.AutoFitWindow);
  179. ChangeTopMostCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SetTopMost);
  180. ToggleSubdirectoriesCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleSubdirectories);
  181. ToggleLoopingCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleLooping);
  182. ResetSettingsCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ResetSettings);
  183. RestartCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Restart);
  184. ToggleUsingTouchpadCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleUsingTouchpad);
  185. ToggleOpeningInSameWindowCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleOpeningInSameWindow);
  186. ShowSettingsFileCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ShowSettingsFile);
  187. ShowKeybindingsFileCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ShowKeybindingsFile);
  188. #endregion Settings commands
  189. }
  190. public MainViewModel()
  191. {
  192. // Only use for unit test
  193. }
  194. #region Gallery
  195. public Thickness GalleryMargin
  196. {
  197. get;
  198. set => this.RaiseAndSetIfChanged(ref field, value);
  199. }
  200. public bool IsBottomGalleryShown
  201. {
  202. get;
  203. set => this.RaiseAndSetIfChanged(ref field, value);
  204. }
  205. public bool IsBottomGalleryShownInHiddenUI
  206. {
  207. get;
  208. set => this.RaiseAndSetIfChanged(ref field, value);
  209. }
  210. public GalleryMode GalleryMode
  211. {
  212. get;
  213. set => this.RaiseAndSetIfChanged(ref field, value);
  214. } = GalleryMode.Closed;
  215. public Stretch GalleryStretch
  216. {
  217. get;
  218. set => this.RaiseAndSetIfChanged(ref field, value);
  219. }
  220. public int SelectedGalleryItemIndex
  221. {
  222. get;
  223. set => this.RaiseAndSetIfChanged(ref field, value);
  224. }
  225. public VerticalAlignment GalleryVerticalAlignment
  226. {
  227. get;
  228. set => this.RaiseAndSetIfChanged(ref field, value);
  229. } = VerticalAlignment.Bottom;
  230. public Orientation GalleryOrientation
  231. {
  232. set => this.RaiseAndSetIfChanged(ref field, value);
  233. get;
  234. }
  235. public bool IsFullGalleryOpen
  236. {
  237. get;
  238. set => this.RaiseAndSetIfChanged(ref field, value);
  239. }
  240. public double GalleryWidth
  241. {
  242. get;
  243. set => this.RaiseAndSetIfChanged(ref field, value);
  244. }
  245. public double GalleryHeight
  246. {
  247. get
  248. {
  249. if (!Settings.Gallery.IsBottomGalleryShown || IsSingleImage || Slideshow.IsRunning)
  250. {
  251. return 0;
  252. }
  253. if (Settings.WindowProperties.Fullscreen)
  254. {
  255. return Settings.Gallery.IsBottomGalleryShown
  256. ? GetBottomGalleryItemHeight + (SizeDefaults.ScrollbarSize - 1)
  257. : 0;
  258. }
  259. if (!Settings.Gallery.ShowBottomGalleryInHiddenUI && !IsUIShown)
  260. {
  261. return 0;
  262. }
  263. return GetBottomGalleryItemHeight + (SizeDefaults.ScrollbarSize - 1);
  264. }
  265. }
  266. public double GetGalleryItemWidth
  267. {
  268. get;
  269. set => this.RaiseAndSetIfChanged(ref field, value);
  270. } = double.NaN;
  271. public double GetGalleryItemHeight
  272. {
  273. get;
  274. set => this.RaiseAndSetIfChanged(ref field, value);
  275. }
  276. public double GetFullGalleryItemHeight
  277. {
  278. get;
  279. set => this.RaiseAndSetIfChanged(ref field, value);
  280. }
  281. public double GetBottomGalleryItemHeight
  282. {
  283. get;
  284. set => this.RaiseAndSetIfChanged(ref field, value);
  285. }
  286. public double MaxFullGalleryItemHeight
  287. {
  288. get => GalleryDefaults.MaxFullGalleryItemHeight;
  289. }
  290. public double MinFullGalleryItemHeight
  291. {
  292. get => GalleryDefaults.MinFullGalleryItemHeight;
  293. }
  294. public double MaxBottomGalleryItemHeight
  295. {
  296. get => GalleryDefaults.MaxBottomGalleryItemHeight;
  297. }
  298. public double MinBottomGalleryItemHeight
  299. {
  300. get => GalleryDefaults.MinBottomGalleryItemHeight;
  301. }
  302. public Thickness GalleryItemMargin
  303. {
  304. get;
  305. set => this.RaiseAndSetIfChanged(ref field, value);
  306. }
  307. #region Gallery Stretch IsChecked
  308. public bool IsUniformBottomChecked
  309. {
  310. get;
  311. set => this.RaiseAndSetIfChanged(ref field, value);
  312. }
  313. public bool IsUniformFullChecked
  314. {
  315. get;
  316. set => this.RaiseAndSetIfChanged(ref field, value);
  317. }
  318. public bool IsUniformMenuChecked
  319. {
  320. get;
  321. set => this.RaiseAndSetIfChanged(ref field, value);
  322. }
  323. public bool IsUniformToFillBottomChecked
  324. {
  325. get;
  326. set => this.RaiseAndSetIfChanged(ref field, value);
  327. }
  328. public bool IsUniformToFillFullChecked
  329. {
  330. get;
  331. set => this.RaiseAndSetIfChanged(ref field, value);
  332. }
  333. public bool IsUniformToFillMenuChecked
  334. {
  335. get;
  336. set => this.RaiseAndSetIfChanged(ref field, value);
  337. }
  338. public bool IsFillBottomChecked
  339. {
  340. get;
  341. set => this.RaiseAndSetIfChanged(ref field, value);
  342. }
  343. public bool IsFillFullChecked
  344. {
  345. get;
  346. set => this.RaiseAndSetIfChanged(ref field, value);
  347. }
  348. public bool IsFillMenuChecked
  349. {
  350. get;
  351. set => this.RaiseAndSetIfChanged(ref field, value);
  352. }
  353. public bool IsNoneBottomChecked
  354. {
  355. get;
  356. set => this.RaiseAndSetIfChanged(ref field, value);
  357. }
  358. public bool IsNoneFullChecked
  359. {
  360. get;
  361. set => this.RaiseAndSetIfChanged(ref field, value);
  362. }
  363. public bool IsNoneMenuChecked
  364. {
  365. get;
  366. set => this.RaiseAndSetIfChanged(ref field, value);
  367. }
  368. public bool IsSquareBottomChecked
  369. {
  370. get;
  371. set => this.RaiseAndSetIfChanged(ref field, value);
  372. }
  373. public bool IsSquareFullChecked
  374. {
  375. get;
  376. set => this.RaiseAndSetIfChanged(ref field, value);
  377. }
  378. public bool IsSquareMenuChecked
  379. {
  380. get;
  381. set => this.RaiseAndSetIfChanged(ref field, value);
  382. }
  383. public bool IsFillSquareBottomChecked
  384. {
  385. get;
  386. set => this.RaiseAndSetIfChanged(ref field, value);
  387. }
  388. public bool IsFillSquareFullChecked
  389. {
  390. get;
  391. set => this.RaiseAndSetIfChanged(ref field, value);
  392. }
  393. public bool IsFillSquareMenuChecked
  394. {
  395. get;
  396. set => this.RaiseAndSetIfChanged(ref field, value);
  397. }
  398. #endregion
  399. #endregion Gallery
  400. #region Commands
  401. public ReactiveCommand<Unit, Unit>? ExitCommand { get; }
  402. public ReactiveCommand<Unit, Unit>? MinimizeCommand { get; }
  403. public ReactiveCommand<Unit, Unit>? MaximizeCommand { get; }
  404. public ReactiveCommand<Unit, Unit>? RestoreCommand { get; }
  405. public ReactiveCommand<Unit, Unit>? ToggleFullscreenCommand { get; }
  406. public ReactiveCommand<Unit, Unit>? NextCommand { get; }
  407. public ReactiveCommand<Unit, Unit>? NextButtonCommand { get; }
  408. public ReactiveCommand<Unit, Unit>? NextArrowButtonCommand { get; }
  409. public ReactiveCommand<Unit, Unit>? PreviousCommand { get; }
  410. public ReactiveCommand<Unit, Unit>? PreviousButtonCommand { get; }
  411. public ReactiveCommand<Unit, Unit>? PreviousArrowButtonCommand { get; }
  412. public ReactiveCommand<Unit, Unit>? NextFolderCommand { get; }
  413. public ReactiveCommand<Unit, Unit>? PreviousFolderCommand { get; }
  414. public ReactiveCommand<Unit, Unit>? FirstCommand { get; }
  415. public ReactiveCommand<Unit, Unit>? LastCommand { get; }
  416. public ReactiveCommand<Unit, Unit>? Skip10Command { get; }
  417. public ReactiveCommand<Unit, Unit>? Prev10Command { get; }
  418. public ReactiveCommand<Unit, Unit>? Skip100Command { get; }
  419. public ReactiveCommand<Unit, Unit>? Prev100Command { get; }
  420. public ReactiveCommand<Unit, Unit>? OpenFileCommand { get; }
  421. public ReactiveCommand<Unit, Unit>? SaveFileCommand { get; }
  422. public ReactiveCommand<Unit, Unit>? SaveFileAsCommand { get; }
  423. public ReactiveCommand<Unit, Unit>? OpenLastFileCommand { get; }
  424. public ReactiveCommand<Unit, Unit>? PasteCommand { get; }
  425. public ReactiveCommand<string, Unit>? CopyFileCommand { get; }
  426. public ReactiveCommand<string, Unit>? CopyBase64Command { get; }
  427. public ReactiveCommand<string, Unit>? CopyFilePathCommand { get; }
  428. public ReactiveCommand<string, Unit>? FilePropertiesCommand { get; }
  429. public ReactiveCommand<Unit, Unit>? CopyImageCommand { get; }
  430. public ReactiveCommand<string, Unit>? CutCommand { get; }
  431. public ReactiveCommand<Unit, Unit>? ReloadCommand { get; }
  432. public ReactiveCommand<string, Unit>? PrintCommand { get; }
  433. public ReactiveCommand<string, Unit>? DeleteFileCommand { get; }
  434. public ReactiveCommand<string, Unit>? RecycleFileCommand { get; }
  435. public ReactiveCommand<Unit, Unit>? CloseMenuCommand { get; }
  436. public ReactiveCommand<Unit, Unit>? ToggleFileMenuCommand { get; }
  437. public ReactiveCommand<Unit, Unit>? ToggleImageMenuCommand { get; }
  438. public ReactiveCommand<Unit, Unit>? ToggleSettingsMenuCommand { get; }
  439. public ReactiveCommand<Unit, Unit>? ToggleToolsMenuCommand { get; }
  440. public ReactiveCommand<string, Unit>? LocateOnDiskCommand { get; }
  441. public ReactiveCommand<string, Unit>? OpenWithCommand { get; }
  442. public ReactiveCommand<Unit, Unit>? RenameCommand { get; }
  443. public ReactiveCommand<Unit, Unit>? NewWindowCommand { get; }
  444. public ReactiveCommand<string, Unit>? DuplicateFileCommand { get; }
  445. public ReactiveCommand<Unit, Unit>? ToggleLoopingCommand { get; }
  446. public ReactiveCommand<Unit, Unit>? RotateLeftCommand { get; }
  447. public ReactiveCommand<Unit, Unit>? RotateLeftButtonCommand { get; }
  448. public ReactiveCommand<Unit, Unit>? RotateRightCommand { get; }
  449. public ReactiveCommand<string, Unit>? RotateToCommand { get; }
  450. public ReactiveCommand<Unit, Unit>? RotateRightButtonCommand { get; }
  451. public ReactiveCommand<Unit, Unit>? RotateRightWindowBorderButtonCommand { get; }
  452. public ReactiveCommand<Unit, Unit>? FlipCommand { get; }
  453. public ReactiveCommand<Unit, Unit>? StretchCommand { get; }
  454. public ReactiveCommand<Unit, Unit>? CropCommand { get; }
  455. public ReactiveCommand<Unit, Unit>? ChangeAutoFitCommand { get; }
  456. public ReactiveCommand<Unit, Unit>? ChangeTopMostCommand { get; }
  457. public ReactiveCommand<Unit, Unit>? ChangeCtrlZoomCommand { get; }
  458. public ReactiveCommand<Unit, Unit>? ToggleUsingTouchpadCommand { get; }
  459. public ReactiveCommand<Unit, Unit>? ToggleUICommand { get; }
  460. public ReactiveCommand<Unit, Unit>? ToggleOpeningInSameWindowCommand { get; }
  461. public ReactiveCommand<Unit, Unit>? ChangeBackgroundCommand { get; }
  462. public ReactiveCommand<Unit, Unit>? ToggleBottomNavBarCommand { get; }
  463. public ReactiveCommand<Unit, Unit>? ToggleBottomGalleryShownInHiddenUICommand { get; }
  464. public ReactiveCommand<Unit, Unit>? ToggleFadeInButtonsOnHoverCommand { get; }
  465. public ReactiveCommand<Unit, Unit>? ToggleTaskbarProgressCommand { get; }
  466. public ReactiveCommand<Unit, Unit>? ShowExifWindowCommand { get; }
  467. public ReactiveCommand<Unit, Unit>? ShowAboutWindowCommand { get; }
  468. public ReactiveCommand<Unit, Unit>? ShowSettingsWindowCommand { get; }
  469. public ReactiveCommand<Unit, Unit>? ShowKeybindingsWindowCommand { get; }
  470. public ReactiveCommand<Unit, Unit>? ShowBatchResizeWindowCommand { get; }
  471. public ReactiveCommand<Unit, Unit>? ShowSingleImageResizeWindowCommand { get; }
  472. public ReactiveCommand<Unit, Unit>? ShowEffectsWindowCommand { get; }
  473. public ReactiveCommand<Unit, Unit>? SetExifRating0Command { get; }
  474. public ReactiveCommand<Unit, Unit>? SetExifRating1Command { get; }
  475. public ReactiveCommand<Unit, Unit>? SetExifRating2Command { get; }
  476. public ReactiveCommand<Unit, Unit>? SetExifRating3Command { get; }
  477. public ReactiveCommand<Unit, Unit>? SetExifRating4Command { get; }
  478. public ReactiveCommand<Unit, Unit>? SetExifRating5Command { get; }
  479. public ReactiveCommand<Unit, Unit>? OpenGoogleLinkCommand { get; }
  480. public ReactiveCommand<Unit, Unit>? OpenBingLinkCommand { get; }
  481. public ReactiveCommand<Unit, Unit>? OptimizeImageCommand { get; }
  482. public ReactiveCommand<int, Unit>? ResizeCommand { get; }
  483. public ReactiveCommand<int, Unit>? ConvertCommand { get; }
  484. public ReactiveCommand<Unit, Unit>? SortFilesByNameCommand { get; }
  485. public ReactiveCommand<Unit, Unit>? SortFilesBySizeCommand { get; }
  486. public ReactiveCommand<Unit, Unit>? SortFilesByExtensionCommand { get; }
  487. public ReactiveCommand<Unit, Unit>? SortFilesByCreationTimeCommand { get; }
  488. public ReactiveCommand<Unit, Unit>? SortFilesByLastAccessTimeCommand { get; }
  489. public ReactiveCommand<Unit, Unit>? SortFilesRandomlyCommand { get; }
  490. public ReactiveCommand<Unit, Unit>? SortFilesAscendingCommand { get; }
  491. public ReactiveCommand<Unit, Unit>? SortFilesDescendingCommand { get; }
  492. public ReactiveCommand<Unit, Unit>? ToggleGalleryCommand { get; }
  493. public ReactiveCommand<Unit, Unit>? ToggleBottomGalleryCommand { get; }
  494. public ReactiveCommand<Unit, Unit>? CloseGalleryCommand { get; }
  495. public ReactiveCommand<Unit, Unit>? ToggleScrollCommand { get; }
  496. public ReactiveCommand<Unit, Unit>? ToggleSubdirectoriesCommand { get; }
  497. public ReactiveCommand<Unit, Unit>? ColorPickerCommand { get; }
  498. public ReactiveCommand<int, Unit>? SlideshowCommand { get; }
  499. public ReactiveCommand<string, Unit>? SetAsWallpaperCommand { get; }
  500. public ReactiveCommand<string, Unit>? SetAsWallpaperFilledCommand { get; }
  501. public ReactiveCommand<string, Unit>? SetAsWallpaperStretchedCommand { get; }
  502. public ReactiveCommand<string, Unit>? SetAsWallpaperTiledCommand { get; }
  503. public ReactiveCommand<string, Unit>? SetAsWallpaperCenteredCommand { get; }
  504. public ReactiveCommand<string, Unit>? SetAsLockScreenCommand { get; }
  505. public ReactiveCommand<string, Unit>? GalleryItemStretchCommand { get; }
  506. public ReactiveCommand<Unit, Unit>? ResetSettingsCommand { get; }
  507. public ReactiveCommand<Unit, Unit>? ShowSideBySideCommand { get; }
  508. public ReactiveCommand<Unit, Unit>? RestartCommand { get; }
  509. public ReactiveCommand<Unit, Unit>? ShowSettingsFileCommand { get; }
  510. public ReactiveCommand<Unit, Unit>? ShowKeybindingsFileCommand { get; }
  511. public ReactiveCommand<Unit, Unit>? ToggleConstrainBackgroundColorCommand { get; }
  512. #endregion Commands
  513. #region Fields
  514. #region Sorting Order
  515. public SortFilesBy SortOrder
  516. {
  517. get;
  518. set => this.RaiseAndSetIfChanged(ref field, value);
  519. }
  520. public bool IsAscending
  521. {
  522. get;
  523. set => this.RaiseAndSetIfChanged(ref field, value);
  524. }
  525. #endregion Sorting Order
  526. #region Booleans
  527. public bool ShouldCropBeEnabled
  528. {
  529. get;
  530. set => this.RaiseAndSetIfChanged(ref field, value);
  531. }
  532. public bool ShouldOptimizeImageBeEnabled
  533. {
  534. get;
  535. set => this.RaiseAndSetIfChanged(ref field, value);
  536. }
  537. public bool IsAvoidingZoomingOut
  538. {
  539. get;
  540. set
  541. {
  542. Settings.Zoom.AvoidZoomingOut = value;
  543. this.RaiseAndSetIfChanged(ref field, value);
  544. }
  545. }
  546. public IImage? ChangeCtrlZoomImage
  547. {
  548. get;
  549. set => this.RaiseAndSetIfChanged(ref field, value);
  550. }
  551. public bool IsLoading
  552. {
  553. get;
  554. set => this.RaiseAndSetIfChanged(ref field, value);
  555. }
  556. public bool IsUIShown
  557. {
  558. get;
  559. set => this.RaiseAndSetIfChanged(ref field, value);
  560. }
  561. public bool IsTopToolbarShown
  562. {
  563. get;
  564. set => this.RaiseAndSetIfChanged(ref field, value);
  565. }
  566. public bool IsBottomToolbarShown
  567. {
  568. get;
  569. set => this.RaiseAndSetIfChanged(ref field, value);
  570. }
  571. public bool IsShowingTaskbarProgress
  572. {
  573. get;
  574. set => this.RaiseAndSetIfChanged(ref field, value);
  575. }
  576. public bool IsFullscreen
  577. {
  578. get;
  579. set
  580. {
  581. this.RaiseAndSetIfChanged(ref field, value);
  582. ShouldRestore = IsFullscreen || IsMaximized;
  583. ShouldMaximizeBeShown = !IsFullscreen && !IsMaximized;
  584. }
  585. }
  586. public bool IsMaximized
  587. {
  588. get;
  589. set
  590. {
  591. this.RaiseAndSetIfChanged(ref field, value);
  592. ShouldRestore = IsFullscreen || IsMaximized;
  593. ShouldMaximizeBeShown = !IsFullscreen && !IsMaximized;
  594. }
  595. }
  596. public bool ShouldRestore
  597. {
  598. get;
  599. set => this.RaiseAndSetIfChanged(ref field, value);
  600. }
  601. public bool ShouldMaximizeBeShown
  602. {
  603. get;
  604. set => this.RaiseAndSetIfChanged(ref field, value);
  605. } = true;
  606. public bool IsTopMost
  607. {
  608. get;
  609. set => this.RaiseAndSetIfChanged(ref field, value);
  610. }
  611. public bool IsConstrainingBackgroundColor
  612. {
  613. get;
  614. set => this.RaiseAndSetIfChanged(ref field, value);
  615. }
  616. public bool IsIncludingSubdirectories
  617. {
  618. get;
  619. set => this.RaiseAndSetIfChanged(ref field, value);
  620. }
  621. public bool IsScrollingEnabled
  622. {
  623. get;
  624. set => this.RaiseAndSetIfChanged(ref field, value);
  625. }
  626. public bool IsStretched
  627. {
  628. get;
  629. set
  630. {
  631. this.RaiseAndSetIfChanged(ref field, value);
  632. Settings.ImageScaling.StretchImage = value;
  633. WindowResizing.SetSize(this);
  634. }
  635. }
  636. public bool IsLooping
  637. {
  638. get;
  639. set => this.RaiseAndSetIfChanged(ref field, value);
  640. }
  641. public bool IsAutoFit
  642. {
  643. get;
  644. set => this.RaiseAndSetIfChanged(ref field, value);
  645. }
  646. public bool IsStayingCentered
  647. {
  648. get;
  649. set
  650. {
  651. this.RaiseAndSetIfChanged(ref field, value);
  652. Settings.WindowProperties.KeepCentered = value;
  653. }
  654. }
  655. public bool IsOpeningInSameWindow
  656. {
  657. get;
  658. set
  659. {
  660. this.RaiseAndSetIfChanged(ref field, value);
  661. Settings.UIProperties.OpenInSameWindow = value;
  662. }
  663. }
  664. public bool IsShowingConfirmationOnEsc
  665. {
  666. get;
  667. set
  668. {
  669. this.RaiseAndSetIfChanged(ref field, value);
  670. Settings.UIProperties.ShowConfirmationOnEsc = value;
  671. }
  672. }
  673. public bool IsEditableTitlebarOpen
  674. {
  675. get;
  676. set => this.RaiseAndSetIfChanged(ref field, value);
  677. }
  678. public bool IsUsingTouchpad
  679. {
  680. get;
  681. set
  682. {
  683. this.RaiseAndSetIfChanged(ref field, value);
  684. Settings.Zoom.IsUsingTouchPad = value;
  685. }
  686. }
  687. public bool IsSingleImage
  688. {
  689. get;
  690. set => this.RaiseAndSetIfChanged(ref field, value);
  691. }
  692. #endregion Booleans
  693. public Brush? ImageBackground
  694. {
  695. get;
  696. set => this.RaiseAndSetIfChanged(ref field, value);
  697. }
  698. public Brush? ConstrainedImageBackground
  699. {
  700. get;
  701. set => this.RaiseAndSetIfChanged(ref field, value);
  702. }
  703. public Thickness RightControlOffSetMargin
  704. {
  705. get;
  706. set => this.RaiseAndSetIfChanged(ref field, value);
  707. }
  708. public Thickness TopScreenMargin
  709. {
  710. get;
  711. set => this.RaiseAndSetIfChanged(ref field, value);
  712. }
  713. public Thickness BottomScreenMargin
  714. {
  715. get;
  716. set => this.RaiseAndSetIfChanged(ref field, value);
  717. }
  718. public CornerRadius BottomCornerRadius
  719. {
  720. get;
  721. set => this.RaiseAndSetIfChanged(ref field, value);
  722. }
  723. public int BackgroundChoice
  724. {
  725. get;
  726. set => this.RaiseAndSetIfChanged(ref field, value);
  727. }
  728. public double WindowMinSize
  729. {
  730. get { return SizeDefaults.WindowMinSize; }
  731. }
  732. public double TitlebarHeight
  733. {
  734. get;
  735. set => this.RaiseAndSetIfChanged(ref field, value);
  736. }
  737. public double BottombarHeight
  738. {
  739. get;
  740. set => this.RaiseAndSetIfChanged(ref field, value);
  741. }
  742. public UserControl? CurrentView
  743. {
  744. get;
  745. set => this.RaiseAndSetIfChanged(ref field, value);
  746. }
  747. public ImageViewer? ImageViewer;
  748. public uint EXIFRating
  749. {
  750. get;
  751. set => this.RaiseAndSetIfChanged(ref field, value);
  752. }
  753. public int GetIndex
  754. {
  755. get;
  756. set => this.RaiseAndSetIfChanged(ref field, value);
  757. }
  758. public double GetSlideshowSpeed
  759. {
  760. get;
  761. set
  762. {
  763. var roundedValue = Math.Round(value, 2);
  764. this.RaiseAndSetIfChanged(ref field, roundedValue);
  765. Settings.UIProperties.SlideShowTimer = roundedValue;
  766. }
  767. }
  768. public double GetNavSpeed
  769. {
  770. get => Math.Round(field, 2);
  771. set
  772. {
  773. this.RaiseAndSetIfChanged(ref field, value);
  774. Settings.UIProperties.NavSpeed = value;
  775. }
  776. }
  777. public double GetZoomSpeed
  778. {
  779. get;
  780. set
  781. {
  782. var roundedValue = Math.Round(value, 2);
  783. this.RaiseAndSetIfChanged(ref field, roundedValue);
  784. Settings.Zoom.ZoomSpeed = roundedValue;
  785. }
  786. }
  787. #region Window Properties
  788. public SizeToContent SizeToContent
  789. {
  790. get;
  791. set => this.RaiseAndSetIfChanged(ref field, value);
  792. }
  793. public bool CanResize
  794. {
  795. get;
  796. set => this.RaiseAndSetIfChanged(ref field, value);
  797. }
  798. #endregion Window Properties
  799. #region Size
  800. public double TitleMaxWidth
  801. {
  802. get;
  803. set => this.RaiseAndSetIfChanged(ref field, value);
  804. }
  805. #endregion Size
  806. #region Zoom
  807. public double RotationAngle
  808. {
  809. get;
  810. set => this.RaiseAndSetIfChanged(ref field, value);
  811. }
  812. public double ZoomValue
  813. {
  814. get;
  815. set => this.RaiseAndSetIfChanged(ref field, value);
  816. }
  817. public ScrollBarVisibility ToggleScrollBarVisibility
  818. {
  819. get;
  820. set => this.RaiseAndSetIfChanged(ref field, value);
  821. }
  822. #endregion Zoom
  823. #region Menus
  824. public bool IsFileMenuVisible
  825. {
  826. get;
  827. set => this.RaiseAndSetIfChanged(ref field, value);
  828. }
  829. public bool IsImageMenuVisible
  830. {
  831. get;
  832. set => this.RaiseAndSetIfChanged(ref field, value);
  833. }
  834. public bool IsSettingsMenuVisible
  835. {
  836. get;
  837. set => this.RaiseAndSetIfChanged(ref field, value);
  838. }
  839. public bool IsToolsMenuVisible
  840. {
  841. get;
  842. set => this.RaiseAndSetIfChanged(ref field, value);
  843. }
  844. #endregion Menus
  845. #endregion Fields
  846. #region Methods
  847. #region Tasks
  848. private async Task ResizeImageByPercentage(int percentage) =>
  849. await ConversionHelper.ResizeImageByPercentage(percentage, this).ConfigureAwait(false);
  850. private async Task ConvertFileExtension(int index) =>
  851. await ConversionHelper.ConvertFileExtension(index, this).ConfigureAwait(false);
  852. private async Task CopyFileTask(string path) =>
  853. await ClipboardFileOperations.CopyFileToClipboard(path, this).ConfigureAwait(false);
  854. private static async Task CopyFilePathTask(string path) =>
  855. await ClipboardTextOperations.CopyTextToClipboard(path).ConfigureAwait(false);
  856. private async Task CopyBase64Task(string path) =>
  857. await ClipboardImageOperations.CopyBase64ToClipboard(path, this).ConfigureAwait(false);
  858. private async Task CutFileTask(string path) =>
  859. await ClipboardFileOperations.CutFile(path, this).ConfigureAwait(false);
  860. private async Task DeleteFileTask(string path) =>
  861. await Task.Run(() => FileManager.DeleteFileWithOptionalDialog(false, path, PlatformService)).ConfigureAwait(false);
  862. private async Task RecycleFileTask(string path) =>
  863. await Task.Run(() => FileManager.DeleteFileWithOptionalDialog(true, path, PlatformService)).ConfigureAwait(false);
  864. private async Task DuplicateFileTask(string path) =>
  865. await ClipboardFileOperations.Duplicate(path, this).ConfigureAwait(false);
  866. private async Task ShowFilePropertiesTask(string path) =>
  867. await FileManager.ShowFileProperties(path, this).ConfigureAwait(false);
  868. private async Task PrintTask(string path) =>
  869. await FileManager.Print(path, this).ConfigureAwait(false);
  870. private async Task OpenWithTask(string path) =>
  871. await FileManager.OpenWith(path, this).ConfigureAwait(false);
  872. private async Task LocateOnDiskTask(string path) =>
  873. await FileManager.LocateOnDisk(path, this).ConfigureAwait(false);
  874. private async Task SetAsWallpaperTask(string path) =>
  875. await SetAsWallpaperTask(path, WallpaperStyle.Fill).ConfigureAwait(false);
  876. private async Task SetAsWallpaperFilledTask(string path) =>
  877. await SetAsWallpaperTask(path, WallpaperStyle.Fill).ConfigureAwait(false);
  878. private async Task SetAsWallpaperFittedTask(string path) =>
  879. await SetAsWallpaperTask(path, WallpaperStyle.Fit).ConfigureAwait(false);
  880. private async Task SetAsWallpaperTiledTask(string path) =>
  881. await SetAsWallpaperTask(path, WallpaperStyle.Tile).ConfigureAwait(false);
  882. private async Task SetAsWallpaperStretchedTask(string path) =>
  883. await SetAsWallpaperTask(path, WallpaperStyle.Stretch).ConfigureAwait(false);
  884. private async Task SetAsWallpaperCenteredTask(string path) =>
  885. await SetAsWallpaperTask(path, WallpaperStyle.Center).ConfigureAwait(false);
  886. private async Task SetAsWallpaperTask(string path, WallpaperStyle style) =>
  887. await WallpaperManager.SetAsWallpaper(path, style, this).ConfigureAwait(false);
  888. private async Task SetAsLockScreenTask(string path) =>
  889. await LockScreenHelper.SetAsLockScreenTask(path, this).ConfigureAwait(false);
  890. private void SetGalleryItemStretch(string value) => GalleryHelper.SetGalleryItemStretch(value, this);
  891. public async Task StartSlideShowTask(int milliseconds) =>
  892. await Slideshow.StartSlideshow(this, milliseconds);
  893. public async Task RotateToTask(string angle)
  894. {
  895. if (int.TryParse(angle, out var result))
  896. {
  897. await RotationNavigation.RotateTo(this, result);
  898. }
  899. }
  900. #endregion
  901. #endregion Methods
  902. }