public void PlayDone(PlaylistItem item, bool canPlayNext = false) { // 次送りが出来る場合は次へ if (canPlayNext && (Player?.CanGoNext ?? false)) { Player.GoNext(); } else if (canPlayNext) { if (PlaylistSettings.PlaylistEndAction == PlaylistEndAction.ChangeIntoSplit) { IsPlayerFloatingModeEnable = true; } else if (PlaylistSettings.PlaylistEndAction == PlaylistEndAction.CloseIfPlayWithCurrentWindow) { IsDisplayPlayer = false; } } // あとで見るプレイリストの場合、再生後に // アイテムを削除する if (CurrentPlaylist == DefaultPlaylist) { DefaultPlaylist.Remove(item); } ResetMediaPlayerCommand(); }
public void PlayDone(PlaylistItem item, bool canPlayNext = false) { // 次送りが出来る場合は次へ if (canPlayNext && (Player?.CanGoNext ?? false)) { Player.GoNext(); } else if (canPlayNext) { if (PlaylistSettings.PlaylistEndAction == PlaylistEndAction.ChangeIntoSplit) { if (PlayerDisplayType == PlayerDisplayType.PrimaryView) { PlayerDisplayType = PlayerDisplayType.PrimaryWithSmall; } } else if (PlaylistSettings.PlaylistEndAction == PlaylistEndAction.CloseIfPlayWithCurrentWindow) { IsDisplayMainViewPlayer = false; } } // あとで見るプレイリストの場合、再生後に // アイテムを削除する if (CurrentPlaylist == DefaultPlaylist) { DefaultPlaylist.Remove(item); } }
public async Task Load() { var files = await HohoemaApp.GetSyncRoamingData(PlaylistsSaveFolder); // ファイルがない場合 if (files.Count == 0) { // デフォルトプレイリストを作成 MakeDefaultPlaylist(); CurrentPlaylist = DefaultPlaylist; return; } // 古いデータを解放 foreach (var playlist in _Playlists) { playlist.Dispose(); } _PlaylistFileAccessorMap.Clear(); _Playlists.Clear(); DefaultPlaylist = null; // 読み込み List <LocalMylist> loadedItem = new List <LocalMylist>(); foreach (var file in files) { var playlistFileAccessor = new FileAccessor <LocalMylist>(PlaylistsSaveFolder, file.Name); var playlist = await playlistFileAccessor.Load(); if (playlist != null) { playlist.HohoemaPlaylist = this; // 重複登録されている場合、ファイルの日付が古いほうを削除 // (本来はリネームのミスがないようにするべき) if (_PlaylistFileAccessorMap.ContainsKey(playlist.Id)) { var prevFileAccessor = _PlaylistFileAccessorMap[playlist.Id]; var prevFile = await prevFileAccessor.TryGetFile(); var prevFileProp = await prevFile.GetBasicPropertiesAsync(); var fileProp = await file.GetBasicPropertiesAsync(); if (prevFileProp.DateModified < fileProp.DateModified) { await prevFileAccessor.Delete(StorageDeleteOption.PermanentDelete); _PlaylistFileAccessorMap.Remove(playlist.Id); _PlaylistFileAccessorMap.Add(playlist.Id, playlistFileAccessor); loadedItem.Add(playlist); } else { await HohoemaApp.RoamingDataRemoved(file); await file.DeleteAsync(); } } else { _PlaylistFileAccessorMap.Add(playlist.Id, playlistFileAccessor); loadedItem.Add(playlist); } } if (playlist.Id == WatchAfterPlaylistId) { DefaultPlaylist = playlist; } } loadedItem.Sort((x, y) => x.SortIndex - y.SortIndex); foreach (var sortedPlaylist in loadedItem) { _Playlists.Add(sortedPlaylist); } // デフォルトプレイリストが削除されていた場合に対応 if (DefaultPlaylist == null) { MakeDefaultPlaylist(); } // Live Item は削除 foreach (var i in DefaultPlaylist.PlaylistItems.Where(x => x.ContentId.StartsWith("lv")).ToArray()) { DefaultPlaylist.Remove(i); } }