示例#1
0
        async Task ImportFiles(IEnumerable <string> paths, NormalPlaylist playlist, EventHandler finished = null)
        {
            var controller = await _baseWindow.WindowDialogService.CreateProgressDialog(string.Empty, false);

            var tracks = Playlists.ImportFiles(paths, (s, e) =>
            {
                controller.SetProgress(e.Percentage);
                controller.SetMessage(e.CurrentFile);
                controller.SetTitle(string.Format(Application.Current.Resources["FilesGetImported"].ToString(), e.FilesImported, e.TotalFiles));
            });

            await playlist.AddFiles(tracks);

            MusicManager.SaveToSettings();
            MySettings.Save();
            await controller.Close();

            if (finished != null)
            {
                Application.Current.Dispatcher.Invoke(() => finished(this, EventArgs.Empty));
            }
        }