public CacheManagementPageViewModel( CacheSettings cacheSettings, VideoCacheManager videoCacheManager, CacheSaveFolder cacheSaveFolder, NicoVideoProvider nicoVideoProvider, PageManager pageManager, DialogService dialogService, NotificationService notificationService, HohoemaPlaylist hohoemaPlaylist ) : base(pageManager) { CacheSettings = cacheSettings; VideoCacheManager = videoCacheManager; CacheSaveFolder = cacheSaveFolder; NicoVideoProvider = nicoVideoProvider; HohoemaDialogService = dialogService; NotificationService = notificationService; HohoemaPlaylist = hohoemaPlaylist; IsRequireUpdateCacheSaveFolder = new ReactiveProperty <bool>(false); IsCacheUserAccepted = CacheSettings.ObserveProperty(x => x.IsUserAcceptedCache) .ToReadOnlyReactiveProperty(); RequireEnablingCacheCommand = new DelegateCommand(async() => { var result = await HohoemaDialogService.ShowAcceptCacheUsaseDialogAsync(); if (result) { CacheSettings.IsEnableCache = true; CacheSettings.IsUserAcceptedCache = true; (App.Current).Resources["IsCacheEnabled"] = true; await RefreshCacheSaveFolderStatus(); NotificationService.ShowInAppNotification( InAppNotificationPayload.CreateReadOnlyNotification("キャッシュの保存先フォルダを選択してください。\n保存先が選択されると利用準備が完了します。", showDuration: TimeSpan.FromSeconds(30) )); if (await CacheSaveFolder.ChangeUserDataFolder()) { await RefreshCacheSaveFolderStatus(); await ResetList(); NotificationService.ShowInAppNotification( InAppNotificationPayload.CreateReadOnlyNotification("キャッシュの利用準備が出来ました") ); } } }); ReadCacheAcceptTextCommand = new DelegateCommand(async() => { var result = await HohoemaDialogService.ShowAcceptCacheUsaseDialogAsync(showWithoutConfirmButton: true); }); CacheFolderStateDescription = new ReactiveProperty <string>(""); CacheSaveFolderPath = new ReactiveProperty <string>(""); OpenCurrentCacheFolderCommand = new DelegateCommand(async() => { await RefreshCacheSaveFolderStatus(); var folder = await CacheSaveFolder.GetVideoCacheFolder(); if (folder != null) { await Launcher.LaunchFolderAsync(folder); } }); ChangeCacheFolderCommand = new DelegateCommand(async() => { var prevPath = CacheSaveFolderPath.Value; if (await CacheSaveFolder.ChangeUserDataFolder()) { NotificationService.ShowInAppNotification( InAppNotificationPayload.CreateReadOnlyNotification($"キャッシュの保存先を {CacheSaveFolderPath.Value} に変更しました") ); await RefreshCacheSaveFolderStatus(); await VideoCacheManager.OnCacheFolderChanged(); await ResetList(); } }); }