private async void PlaylistView_OnDrop(object sender, DragEventArgs e) { SpinningGear.Visibility = Visibility.Visible; foreach (var s in (string[])e.Data.GetData(DataFormats.FileDrop, false)) { if (DirectoryEx.Exists(s)) { await FileUtils.AddFolder(FileSystemInfoEx.FromString(s) as DirectoryInfoEx, true, FileSystemUtils.DefaultLoadErrorCallback); } else if (PlaylistDataManager.Instance.HasReader(s.GetExt())) { Playlist.AddRange(s, FileSystemUtils.DefaultLoadErrorCallback); } else if (PlaybackManagerInstance.HasSupportingPlayer(s.GetExt())) { Playlist.Add(MusicInfo.Create(FileSystemInfoEx.FromString(s) as FileInfoEx, FileSystemUtils.DefaultLoadErrorCallback)); } } SpinningGear.Visibility = Visibility.Hidden; }
private async void AddFromTreeBrowser_OnClick(object sender, RoutedEventArgs e) { SpinningGear.Visibility = Visibility.Visible; var s = from r in TreeBrowser.RootList from n in r.GetChecked() select n; foreach (var infoEx in s) { if (infoEx.IsFolder) { await FileUtils.AddFolder(infoEx as DirectoryInfoEx, true, FileSystemUtils.DefaultLoadErrorCallback); } else if (PlaylistDataManager.Instance.HasReader(infoEx.Name.GetExt())) { Playlist.AddRange(infoEx.FullName, FileSystemUtils.DefaultLoadErrorCallback); } else if (PlaybackManagerInstance.HasSupportingPlayer(infoEx.Name.GetExt())) { Playlist.Add(MusicInfo.Create(infoEx as FileInfoEx, FileSystemUtils.DefaultLoadErrorCallback)); } } SpinningGear.Visibility = Visibility.Hidden; }