diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs index 3677e9f..af95fb4 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs @@ -697,19 +697,6 @@ namespace AM2RLauncher e.Graphics.DrawImage(formBG, ((width / 2) - (height / 1.4745f)) / scale, 0); } - #region ICON EVENTS - - /// Gets called when gets clicked. - private void RedditIconOnClick(object sender, EventArgs e) { CrossPlatformOperations.OpenURL("https://www.reddit.com/r/AM2R"); } - /// Gets called when gets clicked. - private void GithubIconOnClick(object sender, EventArgs e) { CrossPlatformOperations.OpenURL("https://www.github.com/AM2R-Community-Developers"); } - /// Gets called when gets clicked. - private void YoutubeIconOnClick(object sender, EventArgs e) { CrossPlatformOperations.OpenURL("https://www.youtube.com/c/AM2RCommunityUpdates"); } - /// Gets called when gets clicked. - private void DiscordIconOnClick(object sender, EventArgs e) { CrossPlatformOperations.OpenURL("https://discord.gg/nk7UYPbd5u"); } - - #endregion - /// Gets called when gets clicked and shows the and brings it to the front again. private void ShowButtonClick(object sender, EventArgs e) { diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs index fefc2e4..b1ae1bb 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs @@ -118,18 +118,15 @@ namespace AM2RLauncher { case UpdateState.Download: case UpdateState.Downloading: + case UpdateState.Select11: case UpdateState.Installing: case UpdateState.Playing: profileDropDown.Enabled = false; break; - case UpdateState.Select11: case UpdateState.Install: case UpdateState.Play: profileDropDown.Enabled = true; break; } - switch (apkButtonState) - { - case ApkButtonState.Creating: profileDropDown.Enabled = false; break; - } + if (apkButtonState == ApkButtonState.Creating) profileDropDown.Enabled = false; Color col = profileDropDown.Enabled ? colGreen : colInactive; @@ -156,6 +153,7 @@ namespace AM2RLauncher case UpdateState.Select11: case UpdateState.Installing: case UpdateState.Playing: enabled = false; break; + case UpdateState.Install: case UpdateState.Play: enabled = true; break; @@ -200,19 +198,19 @@ namespace AM2RLauncher private void SetPlayButtonState(UpdateState state) { updateState = state; - string profileName = ((profileDropDown != null) && (profileDropDown.Items.Count > 0)) ? profileDropDown.Items[profileDropDown.SelectedIndex].Text : ""; switch (updateState) { - //TODO: seperate this into a "onenabledchanged" delegate? - case UpdateState.Download: playButton.Enabled = true; playButton.ToolTip = Text.PlayButtonDownloadToolTip; break; - case UpdateState.Downloading: playButton.Enabled = true; playButton.ToolTip = ""; playButton.ToolTip = Text.PlayButtonDownladingToolTip; break; - case UpdateState.Select11: playButton.Enabled = true; playButton.ToolTip = Text.PlayButtonSelect11ToolTip; break; - case UpdateState.Install: playButton.Enabled = true; playButton.ToolTip = HelperMethods.GetText(Text.PlayButtonInstallToolTip, profileName); break; - case UpdateState.Installing: playButton.Enabled = false; playButton.ToolTip = Text.PlayButtonInstallingToolTip; break; - case UpdateState.Play: playButton.Enabled = true; playButton.ToolTip = HelperMethods.GetText(Text.PlayButtonPlayToolTip, profileName); break; - case UpdateState.Playing: playButton.Enabled = false; playButton.ToolTip = Text.PlayButtonPlayingToolTip; break; + case UpdateState.Download: + case UpdateState.Downloading: + case UpdateState.Select11: + case UpdateState.Install: + case UpdateState.Play: playButton.Enabled = true; break; + + case UpdateState.Installing: + case UpdateState.Playing: playButton.Enabled = false; break; } playButton.Text = GetPlayButtonText(); + playButton.ToolTip = GetPlayButtonTooltip(); playButton.Invalidate(); @@ -253,6 +251,26 @@ namespace AM2RLauncher } } + /// + /// This returns the tooltip that should have depending on the global updateState. + /// + /// The tooltip as a , or if the current State is invalid. + private string GetPlayButtonTooltip() + { + string profileName = ((profileDropDown != null) && (profileDropDown.Items.Count > 0)) ? profileDropDown.Items[profileDropDown.SelectedIndex].Text : ""; + switch (updateState) + { + case UpdateState.Download: return Text.PlayButtonDownloadToolTip; + case UpdateState.Downloading: return Text.PlayButtonDownloadToolTip; + case UpdateState.Select11: return Text.PlayButtonSelect11ToolTip; + case UpdateState.Install: return playButton.ToolTip = HelperMethods.GetText(Text.PlayButtonInstallToolTip, profileName); + case UpdateState.Installing: return Text.PlayButtonInstallingToolTip; + case UpdateState.Play: return HelperMethods.GetText(Text.PlayButtonPlayToolTip, profileName); + case UpdateState.Playing: return Text.PlayButtonPlayingToolTip; + default: return null; + } + } + /// /// This returns the text that the apkButton should have depending on the global updateState. /// diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index fafc1a8..bd7e93d 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -347,16 +347,16 @@ namespace AM2RLauncher // Social buttons var redditButton = new ImageButton { ToolTip = Text.RedditToolTip, Image = redditIcon }; - redditButton.Click += RedditIconOnClick; + redditButton.Click += (sender, e) => CrossPlatformOperations.OpenURL("https://www.reddit.com/r/AM2R"); var githubButton = new ImageButton { ToolTip = Text.GithubToolTip, Image = githubIcon }; - githubButton.Click += GithubIconOnClick; + githubButton.Click += (sender, e) => CrossPlatformOperations.OpenURL("https://www.github.com/AM2R-Community-Developers"); var youtubeButton = new ImageButton { ToolTip = Text.YoutubeToolTip, Image = youtubeIcon }; - youtubeButton.Click += YoutubeIconOnClick; + youtubeButton.Click += (sender, e) => CrossPlatformOperations.OpenURL("https://www.youtube.com/c/AM2RCommunityUpdates"); var discordButton = new ImageButton { ToolTip = Text.DiscordToolTip, Image = discordIcon }; - discordButton.Click += DiscordIconOnClick; + discordButton.Click += (sender, e) => CrossPlatformOperations.OpenURL("https://discord.gg/nk7UYPbd5u"); // Social button panel