Example #1
0
        /// <summary>
        /// Applies configuration changes (music playback and volume)
        /// when settings are saved.
        /// </summary>
        private void SettingsSaved(object sender, EventArgs e)
        {
            if (isMediaPlayerAvailable)
            {
                if (MediaPlayer.State == MediaState.Playing)
                {
                    if (!UserINISettings.Instance.PlayMainMenuMusic)
                    {
                        isMusicFading = true;
                    }
                }
                else if (topBar.GetTopMostPrimarySwitchable() == this &&
                         topBar.LastSwitchType == SwitchType.PRIMARY)
                {
                    PlayMusic();
                }
            }

            if (!connectionManager.IsConnected)
            {
                ProgramConstants.PLAYERNAME = UserINISettings.Instance.PlayerName;
            }

            if (UserINISettings.Instance.DiscordIntegration)
            {
                discordHandler?.Connect();
            }
            else
            {
                discordHandler?.Disconnect();
            }
        }