Example #1
0
        /// <summary>
        ///     Creates the restart button
        /// </summary>
        private void CreateRestartButton()
        {
            RestartButton = new JukeboxButton(FontAwesome.Get(FontAwesomeIcon.fa_undo_arrow))
            {
                Parent    = this,
                Alignment = Alignment.MidRight,
                Size      = new ScalableVector2(Height * 0.50f, Height * 0.50f),
                X         = PauseResumeButton.X - PauseResumeButton.Width - 10,
            };

            RestartButton.Clicked += (o, e) =>
            {
                SkinManager.Skin.SoundClick.CreateChannel().Play();

                try
                {
                    AudioEngine.LoadCurrentTrack();

                    if (AudioEngine.Track != null)
                    {
                        lock (AudioEngine.Track)
                            AudioEngine.Track?.Play();
                    }

                    PauseResumeButton.Image = FontAwesome.Get(FontAwesomeIcon.fa_pause_symbol);
                }
                catch (Exception)
                {
                    Logger.Error($"Failed to load track", LogType.Runtime);
                }
            };
        }
Example #2
0
        /// <summary>
        ///     Creates the pause/resume control button.
        /// </summary>
        private void CreatePauseResumeButton()
        {
            PauseResumeButton = new JukeboxButton(FontAwesome.Get(FontAwesomeIcon.fa_pause_symbol))
            {
                Parent    = this,
                Alignment = Alignment.MidRight,
                Size      = new ScalableVector2(Height * 0.50f, Height * 0.50f),
                X         = NextButton.X - NextButton.Width - 10
            };

            PauseResumeButton.Clicked += (o, e) =>
            {
                SkinManager.Skin.SoundClick.CreateChannel().Play();

                if (AudioEngine.Track == null || AudioEngine.Track.IsDisposed)
                {
                    return;
                }

                if (AudioEngine.Track.IsStopped || AudioEngine.Track.IsPaused)
                {
                    AudioEngine.Track.Play();
                    PauseResumeButton.Image = FontAwesome.Get(FontAwesomeIcon.fa_pause_symbol);
                    ChangeDiscordPresenceToSongTitle();
                }
                else
                {
                    AudioEngine.Track.Pause();
                    PauseResumeButton.Image = FontAwesome.Get(FontAwesomeIcon.fa_play_button);
                    ChangeDiscordPresenceToIdle();
                }
            };
        }
Example #3
0
        /// <summary>
        ///     Creates the previous song control button.
        /// </summary>
        private void CreatePreviousSongButton()
        {
            PreviousButton = new JukeboxButton(FontAwesome.Get(FontAwesomeIcon.fa_step_backward))
            {
                Parent    = this,
                Alignment = Alignment.MidRight,
                Size      = new ScalableVector2(Height * 0.50f, Height * 0.50f),
                X         = RestartButton.X - RestartButton.Width - 10
            };

            PreviousButton.Clicked += (o, e) =>
            {
                SkinManager.Skin.SoundClick.CreateChannel().Play();
                SelectNextTrack(Direction.Backward);
            };
        }
Example #4
0
        /// <summary>
        ///     Creates the button to allow the user to choose the next song.
        /// </summary>
        private void CreateNextSongButton()
        {
            NextButton = new JukeboxButton(FontAwesome.Get(FontAwesomeIcon.fa_step_forward))
            {
                Parent    = this,
                Alignment = Alignment.MidRight,
                Size      = new ScalableVector2(Height * 0.50f, Height * 0.50f),
                X         = -10
            };

            NextButton.Clicked += (o, e) =>
            {
                SkinManager.Skin.SoundClick.CreateChannel().Play();

                SelectNextTrack(Direction.Forward);
            };
        }