Exemplo n.º 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();
        }
Exemplo n.º 2
0
        public void Apply()
        {
            string name;
            string url;

            name       = nameTxtBox.GetText();
            url        = urlTxtBox.GetText();
            controller = MainWindow.controller;
            if (!urlTxtBox.GetText().Equals("") && !nameTxtBox.GetText().Equals(""))
            {
                controller.CreateLibrary(name, url);
            }
            ExitWindow();
            (ParentWindow as MainWindow).ReloadLibraryBrowser();
        }
Exemplo n.º 3
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();
            }
        }
        public AddTrackToPlaylistWindow(Window parentWindow)
            : base("Dodaj piosenkę do playlisty", (Console.WindowHeight / 2) - 10, (Console.WindowWidth / 2) - 5, 33, 20, parentWindow)
        {
            this.parentWindow = parentWindow;
            controller        = MainWindow.controller;

            DialogResult    = false;
            playlistBrowser = new FileBrowser(PostionX + 2, PostionY + 2, 29, 16, MainWindow.controller.PlaylistsToString, "addTrackToPlaylist", this, true);
            cancelButton    = new Button(PostionX + 18, PostionY + 12, "Anuluj", "cancelButton", this)
            {
                Action = delegate() { ExitWindow(); }
            };

            Inputs.Add(cancelButton);
            Inputs.Add(playlistBrowser);

            CurrentlySelected = cancelButton;

            Draw();
            MainLoop();
        }
        public VideoViewer()
        {
            this.InitializeComponent();

            controller = new MediaPlayerController(viewer);

            //Update progress bar 30 times per second
            timer.Interval = new TimeSpan(0, 0, 0, 0, 32);
            timer.Tick    += Timer_Tick;

            //Check if the mouse is over the viewer and control the transport controls accordingly
            pointerCheckTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            pointerCheckTimer.Tick    += PointerCheckTimer_Tick;

            controller.videoPlayer.CurrentStateChanged += VideoPlayer_CurrentStateChanged;

            //Update the position of the video in the cloud data store

            storePositionTimer.Interval = new TimeSpan(0, 0, 0, 10);
            storePositionTimer.Tick    += StorePositionTimer_Tick;
        }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        if (source == null)
        {
            source = gameObject.transform.parent.gameObject;
        }

        if (source != null)
        {
            Player = source.GetComponent <MediaPlayerController>();
        }

        if (Player == null)
        {
            Player             = source.AddComponent <MediaPlayerController>();
            Player.audioSource = source.GetComponent <AudioSource>();
            Player.videoPlayer = source.GetComponent <VideoPlayer>();
        }

        Button button = gameObject.GetComponent <Button>();

        button.onClick.AddListener(Player.ToggleMediaPlayerState);
    }
Exemplo n.º 7
0
 public override void CursorMoveLeft()
 {
     //base.CursorMoveLeft();
     MainWindow.StopTimer();
     if (CursorX < 0 || CursorX >= CurrentList.Count ? false : !ShowingDrive)
     {
         MediaPlayerController controller = MainWindow.controller;
         if (iD.Equals("currentPlaylistBrowser"))
         {
             //controller.SetSongId(cursorX);
             rememberSongId = cursorX;
             //AddTrackToPlaylistWindow addTrackToPlaylistWindow = new AddTrackToPlaylistWindow(ParentWindow);
             var tuple = (ParentWindow as MainWindow).RunAddToTrackWindow();
             //if(tuple.Item1)
             ////if ((ParentWindow as MainWindow).RunAddToTrackWindow())
             //{
             //    var playlistName = tuple.Item2;
             //    controller.AddTrackToPlaylist(controller.GetSongId(), playlistName);
             //}
         }
     }
     MainWindow.StartTimer();
 }