Exemple #1
0
        public override void Enter()
        {
            MainWindow.StopTimer();
            if (CursorX < 0 || CursorX >= CurrentList.Count ? false : !ShowingDrive)
            {
                MediaPlayerController controller = MainWindow.controller;

                if (iD.Equals("currentPlaylistBrowser"))
                {
                    WindowManager.DrawColourBlock(ConsoleColor.Gray, 42, 10, 43, 120);//Seekbar domyslny szary
                    //controller.LoadCurrentSong(CurrentList.ElementAt(cursorX));
                    controller.Stop();
                    controller.LoadCurrentSong(cursorX);
                    WindowManager.WirteText(CurrentlySelectedFile, 0, 0, this.TextColour, this.BackgroundColour);
                    //ResetCursorX();
                    //(ParentWindow as MainWindow).currentSongLabel.SetText("                                                                              ");
                    //(ParentWindow as MainWindow).currentSongLabel.SetText(controller.GetCurrentSongLabel(cursorX));
                    //(ParentWindow as MainWindow).ReloadCurrentPlaylistBrowser();
                }
                else if (iD.Equals("playlistsBrowser"))
                {
                    controller.Stop();
                    controller.LoadCurrentPlaylist(CurrentList.ElementAt(cursorX));
                    //controller.CurrentSong = mediaPlayer.CurrentPlaylist.Tracks.FirstOrDefault();
                    //controller.SetFirstOrDefaultSong();
                    (ParentWindow as MainWindow).ReloadCurrentPlaylistBrowser();

                    //ResetCursorX();
                    //(ParentWindow as MainWindow).ReloadPlaylistsBrowser();
                }
                else if (iD.Equals("libraryBrowser"))
                {
                    controller.Stop();
                    if (CursorX == 0)
                    {
                        controller.LoadLibraryMediaPlaylist();
                    }
                    else
                    {
                        controller.LoadCurrentLibrary(CurrentList.ElementAt(CursorX));
                    }
                    (ParentWindow as MainWindow).ReloadCurrentPlaylistBrowser();
                    //(ParentWindow as MainWindow).ReloadLibraryBrowser();
                    //(ParentWindow as MainWindow).ReloadPlaylistsBrowser();
                }
                else if (iD.Equals("addTrackToPlaylist"))
                {
                    string playlist;
                    playlist = controller.PlaylistsToString.ElementAt(cursorX);
                    (ParentWindow as AddTrackToPlaylistWindow).Apply();
                    controller.AddTrackToPlaylist(rememberSongId, playlist);
                    ResetCursorX();
                }
            }
            else if (SelectFile == null ? false : !ShowingDrive)
            {
                SelectFile();
            }
            MainWindow.StartTimer();
        }
Exemple #2
0
        public override void BackSpace()
        {
            if (CursorX < 0 || CursorX >= CurrentList.Count ? false : !ShowingDrive)
            {
                MediaPlayerController controller = MainWindow.controller;

                if (iD.Equals("currentPlaylistBrowser"))
                {
                    Confirm confirm = new Confirm("Czy na pewno chcesz usunąć piosenkę?", ParentWindow, ConsoleColor.Gray);
                    if (confirm.ShowDialog() == DialogResult.OK)
                    {
                        controller.RemoveTrack(cursorX);
                        (ParentWindow as MainWindow).ReloadCurrentPlaylistBrowser();
                        ResetCursorX();
                    }
                }
                else if (iD.Equals("playlistsBrowser"))
                {
                    Confirm confirm = new Confirm("Czy na pewno chcesz usunąć playlistę?", ParentWindow, ConsoleColor.Gray);
                    if (confirm.ShowDialog() == DialogResult.OK)
                    {
                        if (controller.RemovePlaylist(CurrentList.ElementAt(CursorX)))
                        {
                            (ParentWindow as MainWindow).ReloadCurrentPlaylistBrowser();
                        }
                        (ParentWindow as MainWindow).ReloadPlaylistsBrowser();
                        ResetCursorX();
                    }
                }
                else if (iD.Equals("libraryBrowser"))
                {
                    Confirm confirm = new Confirm("Czy na pewno chcesz usunąć bibliotekę?", ParentWindow, ConsoleColor.Gray);
                    if (confirm.ShowDialog() == DialogResult.OK)
                    {
                        if (controller.RemoveLibrary(CurrentList.ElementAt(CursorX)))
                        {
                            (ParentWindow as MainWindow).ReloadCurrentPlaylistBrowser();
                        }
                        (ParentWindow as MainWindow).ReloadLibraryBrowser();
                        ResetCursorX();
                    }
                }
            }
            else if (SelectFile == null ? false : !ShowingDrive)
            {
                SelectFile();
            }
        }