Пример #1
0
        private async Task HandleDropActionAsync(IDropInfo dropInfo, IList fileOrDirDropList)
        {
            if (!this.FileSearchWorker.IsWorking)
            {
                var files = await this.FileSearchWorker.StartSearchAsync(fileOrDirDropList)
                            .ContinueWith(task => task.Result.OrderBy(f => f.FirstPerformer)
                                          .ThenBy(f => f.Album)
                                          .ThenBy(f => f.Disc)
                                          .ThenBy(f => f.Track));

                var currentFilesCollView = this.FirstSimplePlaylistFiles as ICollectionView;

                if (currentFilesCollView == null)
                {
                    var filesColl     = new PlayListCollection(files);
                    var filesCollView = CollectionViewSource.GetDefaultView(filesColl);
                    this.FirstSimplePlaylistFiles = filesCollView;
                    ((ICollectionView)this.FirstSimplePlaylistFiles).MoveCurrentTo(null);
                }
                else
                {
                    var insertIndex     = dropInfo.InsertIndex;
                    var destinationList = (QuickFillObservableCollection <IMediaFile>)(dropInfo.TargetCollection.TryGetList());
                    destinationList.AddItems(files, insertIndex);
                }
            }
        }
Пример #2
0
        public ObservableCollection <PlayListCollection> CreateStandartPlayList()
        {
            PlayListCollection playList = new PlayListCollection();
            string             dir      = Directory.GetCurrentDirectory() + "\\..\\..\\";

            playList.name   = "Основной";
            playList.musics = new ObservableCollection <MusicNotifyChanged>();
            playList.musics.Add(new MusicNotifyChanged {
                musics = new Music {
                    name = "Тест 1", source = new Uri(dir + "testMusic\\BTS-Butter.mp3")
                }
            });
            playList.musics.Add(new MusicNotifyChanged {
                musics = new Music {
                    name = "Тест 2", source = new Uri(dir + "testMusic\\Konfuz-Ратата.mp3")
                }
            });
            playList.musics.Add(new MusicNotifyChanged {
                musics = new Music {
                    name = "Тест 3", source = new Uri(dir + "testMusic\\РукиВверх-Нокаут.mp3")
                }
            });
            return(new ObservableCollection <PlayListCollection> {
                playList
            });
        }
Пример #3
0
        private void PlayListPanel_OnChangeClick(PlayListCollection playList)
        {
            this.MenuEditPlayList.Visibility = Visibility.Visible;
            this.MenuEditPlayList.IsEnabled  = true;
            this.MainGrid.IsEnabled          = false;
            this.MainGrid.Opacity            = 0.5;

            this.MenuEditPlayList.PlayList = this.SelectedPlayList;
        }
Пример #4
0
        private void MenuAddPlaylist_OnSelectedPlayList(PlayListCollection playList)
        {
            int index = this.PlayListCollections.IndexOf(playList);

            if (index == -1 || this.PlayListCollections[index].musics.IndexOf(selectMusicAdd) != -1)
            {
                return;
            }

            this.PlayListCollections[index].musics.Add(selectMusicAdd);
        }
Пример #5
0
 private void PlayListPanel_OnDeleteClick(PlayListCollection playList)
 {
     if (this.PlayListCollections.Count > 1)
     {
         int index = this.PlayListCollections.IndexOf(playList);
         this.PlayListCollections.Remove(playList);
         this.SelectedPlayList = this.PlayListCollections[index != 0 ? index - 1 : index];
         this.VisibilitySelectedPlayList();
         this.SelectingPlayList(this.SelectedPlayList);
     }
 }
Пример #6
0
        private void SelectingPlayList(PlayListCollection playList)
        {
            if (this.PlayListCollections.IndexOf(playList) == -1)
            {
                return;
            }

            this.PlayingPlayList           = playList;
            this.PlayListPanel.playLists   = PlayListCollections;
            this.MenuAddPlaylist.playLists = PlayListCollections;

            this.CustomPlayer.SetPlayList(new Playlist(playList.musics.ToList().ConvertAll((musicNotify) =>
            {
                return(musicNotify.musics);
            })));

            this.VisibilitySelectedPlayList();
        }
Пример #7
0
        public async Task StartUpAsync()
        {
            var playList = await PlayList.LoadAsync();

            if (playList != null)
            {
                this.Log().Info("show loaded play list with {0} files", playList.Files.Count);
                var filesColl     = new PlayListCollection(playList.Files);
                var filesCollView = CollectionViewSource.GetDefaultView(filesColl);
                this.FirstSimplePlaylistFiles = filesCollView;
                ((ICollectionView)this.FirstSimplePlaylistFiles).MoveCurrentTo(null);
            }
            var args = await Task.Run(() => Environment.GetCommandLineArgs().Skip(1).ToList());

            if (args.Any())
            {
                await this.HandleCommandLineArgsAsync(args);
            }
        }
Пример #8
0
        public async Task HandleCommandLineArgsAsync(IList args)
        {
            // TODO take another search worker for multiple added files via command line (possible lost the command line files while searching...)
            if (!this.FileSearchWorker.IsWorking)
            {
                this.Log().Info("handle {0} command line args", args.Count);

                var files = await this.FileSearchWorker.StartSearchAsync(args);

                var currentFilesCollView = this.FirstSimplePlaylistFiles as ICollectionView;

                var newScrollIndex = 0;

                if (currentFilesCollView == null)
                {
                    var filesColl     = new PlayListCollection(files);
                    var filesCollView = CollectionViewSource.GetDefaultView(filesColl);
                    this.FirstSimplePlaylistFiles = filesCollView;
                    ((ICollectionView)this.FirstSimplePlaylistFiles).MoveCurrentTo(null);

                    this.Play();
                }
                else
                {
                    var filesColl = (QuickFillObservableCollection <IMediaFile>)currentFilesCollView.SourceCollection;
                    newScrollIndex = filesColl.Count;
                    var insertIndex = filesColl.Count;
                    filesColl.AddItems(files, insertIndex);

                    var file = files.FirstOrDefault();
                    if (file != null)
                    {
                        currentFilesCollView.MoveCurrentTo(file);
                        this.playerEngine.Play(file);
                    }
                }

                this.Log().Debug("set scroll index to {0}", newScrollIndex);
                this.ScrollIndex = newScrollIndex;

                this.CommandLineArgs = null;
            }
        }
Пример #9
0
        private async Task HandleDropActionAsync(IDropInfo dropInfo, IList fileOrDirDropList)
        {
            if (!this.FileSearchWorker.IsWorking)
            {
                var files = await this.FileSearchWorker.StartSearchAsync(fileOrDirDropList);

                var currentFilesCollView = this.FirstSimplePlaylistFiles as ICollectionView;

                if (currentFilesCollView == null)
                {
                    var filesColl     = new PlayListCollection(files);
                    var filesCollView = CollectionViewSource.GetDefaultView(filesColl);
                    this.FirstSimplePlaylistFiles = filesCollView;
                    ((ICollectionView)this.FirstSimplePlaylistFiles).MoveCurrentTo(null);
                }
                else
                {
                    var insertIndex     = dropInfo.InsertIndex;
                    var destinationList = (QuickFillObservableCollection <IMediaFile>)DefaultDropHandler.GetList(dropInfo.TargetCollection);
                    destinationList.AddItems(files, insertIndex);
                }
            }
        }
 private void Clear()
 {
     if (CurrentPlaylist != null)
     {
         if (HasChanges)
         {
             if (MessageBox.Show("Do you wish to save changes in " +
                                 CurrentPlaylist.PlaylistName + " ?",
                                 CurrentPlaylist.PlaylistName, MessageBoxButton.OKCancel)
                 == MessageBoxResult.OK)
             {
                 this.UpdateList();
             }
         }
     }
     CurrentPlaylist = null;
     PlayListCollection.Clear();
     //foreach (var item in PlayList)
     //{
     //    if (item == MediaControllerVM.MediaControllerInstance.CurrentVideoItem) continue;
     //    PlayList.Remove(item);
     //}
 }
        private async Task HandleDropActionAsync(IDropInfo dropInfo, IList fileOrDirDropList)
        {
            if (!this.FileSearchWorker.IsWorking)
            {
                var files = await this.FileSearchWorker.StartSearchAsync(fileOrDirDropList)
                                      .ContinueWith(task => task.Result.OrderBy(f => f.FirstPerformer)
                                                                .ThenBy(f => f.Album)
                                                                .ThenBy(f => f.Disc)
                                                                .ThenBy(f => f.Track));

                var currentFilesCollView = this.FirstSimplePlaylistFiles as ICollectionView;

                if (currentFilesCollView == null)
                {
                    var filesColl = new PlayListCollection(files);
                    var filesCollView = CollectionViewSource.GetDefaultView(filesColl);
                    this.FirstSimplePlaylistFiles = filesCollView;
                    ((ICollectionView)this.FirstSimplePlaylistFiles).MoveCurrentTo(null);
                }
                else
                {
                    var insertIndex = dropInfo.InsertIndex;
                    var destinationList = (QuickFillObservableCollection<IMediaFile>)(dropInfo.TargetCollection.TryGetList());
                    destinationList.AddItems(files, insertIndex);
                }
            }
        }
Пример #12
0
 public void setPlayListsCollection(ObservableCollection <PlayListCollection> value)
 {
     PlayListCollections   = value;
     this.SelectedPlayList = value[0];
     this.SelectingPlayList(value[0]);
 }
 public PlayListCollectionTest()
 {
     this.thePlayListCollection = new PlayListCollection(Helpers.GetSomeMediaFiles());
 }
Пример #14
0
 private void PlayListPanel_OnSelectedPlayList(PlayListCollection obj)
 {
     this.SelectedPlayList = obj;
     this.VisibilitySelectedPlayList();
 }
Пример #15
0
 public PlayListCollectionTest()
 {
     this.thePlayListCollection = new PlayListCollection(Helpers.GetSomeMediaFiles());
 }
        public async Task HandleCommandLineArgsAsync(IList args)
        {
            // TODO take another search worker for multiple added files via command line (possible lost the command line files while searching...)
            if (!this.FileSearchWorker.IsWorking)
            {
                this.Log().Info("handle {0} command line args", args.Count);

                var files = await this.FileSearchWorker.StartSearchAsync(args);

                var currentFilesCollView = this.FirstSimplePlaylistFiles as ICollectionView;

                var newScrollIndex = 0;

                if (currentFilesCollView == null)
                {
                    var filesColl = new PlayListCollection(files);
                    var filesCollView = CollectionViewSource.GetDefaultView(filesColl);
                    this.FirstSimplePlaylistFiles = filesCollView;
                    ((ICollectionView)this.FirstSimplePlaylistFiles).MoveCurrentTo(null);

                    this.Play();
                }
                else
                {
                    var filesColl = (QuickFillObservableCollection<IMediaFile>)currentFilesCollView.SourceCollection;
                    newScrollIndex = filesColl.Count;
                    var insertIndex = filesColl.Count;
                    filesColl.AddItems(files, insertIndex);

                    var file = files.FirstOrDefault();
                    if (file != null)
                    {
                        currentFilesCollView.MoveCurrentTo(file);
                        this.playerEngine.Play(file);
                    }
                }

                this.Log().Debug("set scroll index to {0}", newScrollIndex);
                this.ScrollIndex = newScrollIndex;

                this.CommandLineArgs = null;
            }
        }
 public async Task StartUpAsync()
 {
     var playList = await PlayList.LoadAsync();
     if (playList != null)
     {
         this.Log().Info("show loaded play list with {0} files", playList.Files.Count);
         var filesColl = new PlayListCollection(playList.Files);
         var filesCollView = CollectionViewSource.GetDefaultView(filesColl);
         this.FirstSimplePlaylistFiles = filesCollView;
         ((ICollectionView)this.FirstSimplePlaylistFiles).MoveCurrentTo(null);
     }
     var args = await Task.Run(() => Environment.GetCommandLineArgs().Skip(1).ToList());
     if (args.Any())
     {
         await this.HandleCommandLineArgsAsync(args);
     }
 }
        private async Task HandleDropActionAsync(IDropInfo dropInfo, IList fileOrDirDropList)
        {
            if (!this.FileSearchWorker.IsWorking)
            {
                var files = await this.FileSearchWorker.StartSearchAsync(fileOrDirDropList);

                var currentFilesCollView = this.FirstSimplePlaylistFiles as ICollectionView;

                if (currentFilesCollView == null)
                {
                    var filesColl = new PlayListCollection(files);
                    var filesCollView = CollectionViewSource.GetDefaultView(filesColl);
                    this.FirstSimplePlaylistFiles = filesCollView;
                    ((ICollectionView)this.FirstSimplePlaylistFiles).MoveCurrentTo(null);
                }
                else
                {
                    var insertIndex = dropInfo.InsertIndex;
                    var destinationList = (QuickFillObservableCollection<IMediaFile>)DefaultDropHandler.GetList(dropInfo.TargetCollection);
                    destinationList.AddItems(files, insertIndex);
                }
            }
        }