From 0067a6b9a5d2eba74bbe674a5a02ae6bc1e23923 Mon Sep 17 00:00:00 2001
From: Miepee <38186597+Miepee@users.noreply.github.com>
Date: Fri, 18 Feb 2022 18:45:26 +0100
Subject: [PATCH] renaming + variable cleanup
- rename UpdateState to PlayButtonState for better clarity
- move variables that are only used in constructor to local scope
- make colors and formBG readonly
---
.../AM2RLauncher/MainForm/MainForm.Events.cs | 38 ++---
.../MainForm/MainForm.StateMachine.cs | 106 ++++++------
.../AM2RLauncher/MainForm/MainForm.UI.cs | 157 ++++++------------
3 files changed, 125 insertions(+), 176 deletions(-)
diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs
index e6a571a..7328a95 100644
--- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs
+++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs
@@ -38,7 +38,7 @@ namespace AM2RLauncher
if (!Profile.IsPatchDataCloned() || !(bool)autoUpdateAM2RCheck.Checked)
return;
- SetPlayButtonState(UpdateState.Downloading);
+ SetPlayButtonState(PlayButtonState.Downloading);
progressBar.Visible = true;
progressLabel.Visible = true;
@@ -113,7 +113,7 @@ namespace AM2RLauncher
}
}
- SetPlayButtonState(UpdateState.Install);
+ SetPlayButtonState(PlayButtonState.Install);
UpdateStateMachine();
}
@@ -160,7 +160,7 @@ namespace AM2RLauncher
///
/// Gets called when user tries to close . This does a few things:
/// 1) Writes the Width, Height, the check if is currently maximized and the ProfileIndex to the Config
- /// 2) Checks if current is . If yes, it creates a Warning to the end user.
+ /// 2) Checks if current is . If yes, it creates a Warning to the end user.
///
private void MainformClosing(object sender, CancelEventArgs e)
{
@@ -174,7 +174,7 @@ namespace AM2RLauncher
switch (updateState)
{
// If we're currently still downloading, ask first if user really wants to close and cancel the event if necessary
- case UpdateState.Downloading:
+ case PlayButtonState.Downloading:
{
var result = MessageBox.Show(this, Text.CloseOnCloningText, Text.WarningWindowTitle, MessageBoxButtons.YesNo,
MessageBoxType.Warning, MessageBoxDefaultButton.No);
@@ -187,7 +187,7 @@ namespace AM2RLauncher
break;
}
// We can't close during installing, so we cancel the event.
- case UpdateState.Installing:
+ case PlayButtonState.Installing:
{
MessageBox.Show(this, Text.CloseOnInstallingText, Text.WarningWindowTitle, MessageBoxButtons.OK, MessageBoxType.Warning);
e.Cancel = true;
@@ -232,13 +232,13 @@ namespace AM2RLauncher
switch (updateState)
{
#region Download
- case UpdateState.Download:
+ case PlayButtonState.Download:
log.Info("Attempting to clone repository " + currentMirror + "...");
bool successful = true;
// Update playButton states
- SetPlayButtonState(UpdateState.Downloading);
+ SetPlayButtonState(PlayButtonState.Downloading);
// Enable progressBar
progressBar.Visible = true;
@@ -306,7 +306,7 @@ namespace AM2RLauncher
progressBar.Value = 0;
// Just need to switch this to anything that isn't an "active" state so SetUpdateState() actually does something
- SetPlayButtonState(UpdateState.Install);
+ SetPlayButtonState(PlayButtonState.Install);
// This needs to be run BEFORE the state check so that the Mod Settings tab doesn't weird out
LoadProfilesAndAdjustLists();
@@ -319,7 +319,7 @@ namespace AM2RLauncher
#region Downloading
- case UpdateState.Downloading:
+ case PlayButtonState.Downloading:
var result = MessageBox.Show(this, Text.CloseOnCloningText, Text.WarningWindowTitle, MessageBoxButtons.YesNo, MessageBoxType.Warning, MessageBoxDefaultButton.No);
if (result != DialogResult.Yes)
return;
@@ -336,7 +336,7 @@ namespace AM2RLauncher
#endregion
#region Select11
- case UpdateState.Select11:
+ case PlayButtonState.Select11:
log.Info("Requesting user input for AM2R_11.zip...");
@@ -381,10 +381,10 @@ namespace AM2RLauncher
#endregion
#region Install
- case UpdateState.Install:
+ case PlayButtonState.Install:
progressBar.Visible = true;
progressBar.Value = 0;
- SetPlayButtonState(UpdateState.Installing);
+ SetPlayButtonState(PlayButtonState.Installing);
// Make sure the main interface state machines properly
UpdateApkState();
@@ -398,7 +398,7 @@ namespace AM2RLauncher
{
MessageBox.Show(this, Text.XdeltaNotFound, Text.WarningWindowTitle, MessageBoxButtons.OK);
- SetPlayButtonState(UpdateState.Install);
+ SetPlayButtonState(PlayButtonState.Install);
UpdateStateMachine();
log.Error("Xdelta not found. Aborting installing a profile...");
return;
@@ -419,20 +419,20 @@ namespace AM2RLauncher
progressBar.Value = 0;
// Just need to switch this to anything that isn't an "active" state so SetUpdateState() actually does something
- SetPlayButtonState(UpdateState.Play);
+ SetPlayButtonState(PlayButtonState.Play);
UpdateStateMachine();
break;
#endregion
#region Play
- case UpdateState.Play:
+ case PlayButtonState.Play:
if (!IsProfileIndexValid())
return;
ProfileXML profile = profileList[profileIndex.Value];
Visible = false;
- SetPlayButtonState(UpdateState.Playing);
+ SetPlayButtonState(PlayButtonState.Playing);
// Make sure the main interface state machines properly
UpdateApkState();
@@ -455,7 +455,7 @@ namespace AM2RLauncher
Visible = true;
WindowState = windowStateBeforeLaunching;
- SetPlayButtonState(UpdateState.Play);
+ SetPlayButtonState(PlayButtonState.Play);
UpdateStateMachine();
break;
@@ -602,7 +602,7 @@ namespace AM2RLauncher
}
/// Gets called when user selects a different item from .
- /// It then writes that to the config, and if is not
+ /// It then writes that to the config, and if is not
/// it also overwrites the upstream URL in .git/config.
private void MirrorDropDownSelectedIndexChanged(object sender, EventArgs e)
{
@@ -613,7 +613,7 @@ namespace AM2RLauncher
CrossPlatformOperations.WriteToConfig("MirrorIndex", mirrorDropDown.SelectedIndex);
// Don't overwrite the git config while we download!!!
- if (updateState == UpdateState.Downloading) return;
+ if (updateState == PlayButtonState.Downloading) return;
log.Info("Overwriting mirror in gitconfig.");
diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs
index 273b1d3..9e7271a 100644
--- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs
+++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs
@@ -23,12 +23,12 @@ namespace AM2RLauncher
}
///
- /// Determines current conditions and calls accordingly.
+ /// Determines current conditions and calls accordingly.
///
private void UpdatePlayState()
{
// If we're downloading or installing, dont't change anything
- if ((updateState == UpdateState.Downloading) || (updateState == UpdateState.Installing))
+ if ((updateState == PlayButtonState.Downloading) || (updateState == PlayButtonState.Installing))
return;
// If we're currently creating an APK, we disable the play button
@@ -42,14 +42,14 @@ namespace AM2RLauncher
// If PatchData isn't cloned, we still need to download
if (!Profile.IsPatchDataCloned())
{
- SetPlayButtonState(UpdateState.Download);
+ SetPlayButtonState(PlayButtonState.Download);
return;
}
// If 1.1 isn't installed, we still need to select it
if (!Profile.Is11Installed())
{
- SetPlayButtonState(UpdateState.Select11);
+ SetPlayButtonState(PlayButtonState.Select11);
return;
}
@@ -57,7 +57,7 @@ namespace AM2RLauncher
// If current profile is installed, we're ready to play!
if (isProfileValid && Profile.IsProfileInstalled(profileList[profileIndex.Value]))
{
- SetPlayButtonState(UpdateState.Play);
+ SetPlayButtonState(PlayButtonState.Play);
return;
}
// Otherwise, if profile is NOT installable, we delete the profile because we can't install it and therefore holds no value!
@@ -68,7 +68,7 @@ namespace AM2RLauncher
}
// Otherwise, we still need to install.
- SetPlayButtonState(UpdateState.Install);
+ SetPlayButtonState(PlayButtonState.Install);
}
///
@@ -95,14 +95,14 @@ namespace AM2RLauncher
// Switch status based on main button's state
switch (updateState)
{
- case UpdateState.Download:
- case UpdateState.Downloading:
- case UpdateState.Select11:
- case UpdateState.Installing:
- case UpdateState.Playing: return;
-
- case UpdateState.Install:
- case UpdateState.Play: apkButton.Enabled = true; apkButton.ToolTip = HelperMethods.GetText(Text.ApkButtonEnabledToolTip, profileDropDown?.Items[profileDropDown.SelectedIndex]?.Text ?? ""); break;
+ case PlayButtonState.Download:
+ case PlayButtonState.Downloading:
+ case PlayButtonState.Select11:
+ case PlayButtonState.Installing:
+ case PlayButtonState.Playing: return;
+
+ case PlayButtonState.Install:
+ case PlayButtonState.Play: apkButton.Enabled = true; apkButton.ToolTip = HelperMethods.GetText(Text.ApkButtonEnabledToolTip, profileDropDown?.Items[profileDropDown.SelectedIndex]?.Text ?? ""); break;
}
}
@@ -116,14 +116,14 @@ namespace AM2RLauncher
return;
switch (updateState)
{
- case UpdateState.Download:
- case UpdateState.Downloading:
- case UpdateState.Select11:
- case UpdateState.Installing:
- case UpdateState.Playing: profileDropDown.Enabled = false; break;
-
- case UpdateState.Install:
- case UpdateState.Play: profileDropDown.Enabled = true; break;
+ case PlayButtonState.Download:
+ case PlayButtonState.Downloading:
+ case PlayButtonState.Select11:
+ case PlayButtonState.Installing:
+ case PlayButtonState.Playing: profileDropDown.Enabled = false; break;
+
+ case PlayButtonState.Install:
+ case PlayButtonState.Play: profileDropDown.Enabled = true; break;
}
if (apkButtonState == ApkButtonState.Creating) profileDropDown.Enabled = false;
@@ -148,14 +148,14 @@ namespace AM2RLauncher
bool enabled = false;
switch (updateState)
{
- case UpdateState.Download:
- case UpdateState.Downloading:
- case UpdateState.Select11:
- case UpdateState.Installing:
- case UpdateState.Playing: enabled = false; break;
+ case PlayButtonState.Download:
+ case PlayButtonState.Downloading:
+ case PlayButtonState.Select11:
+ case PlayButtonState.Installing:
+ case PlayButtonState.Playing: enabled = false; break;
- case UpdateState.Install:
- case UpdateState.Play: enabled = true; break;
+ case PlayButtonState.Install:
+ case PlayButtonState.Play: enabled = true; break;
}
if (apkButtonState == ApkButtonState.Creating) enabled = false;
@@ -195,19 +195,19 @@ namespace AM2RLauncher
/// Sets the global and then changes the state of accordingly.
///
/// The state that should be set to.
- private void SetPlayButtonState(UpdateState state)
+ private void SetPlayButtonState(PlayButtonState state)
{
updateState = state;
switch (updateState)
{
- 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;
+ case PlayButtonState.Download:
+ case PlayButtonState.Downloading:
+ case PlayButtonState.Select11:
+ case PlayButtonState.Install:
+ case PlayButtonState.Play: playButton.Enabled = true; break;
+
+ case PlayButtonState.Installing:
+ case PlayButtonState.Playing: playButton.Enabled = false; break;
}
playButton.Text = GetPlayButtonText();
playButton.ToolTip = GetPlayButtonTooltip();
@@ -240,13 +240,13 @@ namespace AM2RLauncher
{
switch (updateState)
{
- case UpdateState.Download: return Text.Download;
- case UpdateState.Downloading: return Text.Abort;
- case UpdateState.Select11: return Text.Select11;
- case UpdateState.Install: return Text.Install;
- case UpdateState.Installing: return Text.Installing;
- case UpdateState.Play: return Text.Play;
- case UpdateState.Playing: return Text.Playing;
+ case PlayButtonState.Download: return Text.Download;
+ case PlayButtonState.Downloading: return Text.Abort;
+ case PlayButtonState.Select11: return Text.Select11;
+ case PlayButtonState.Install: return Text.Install;
+ case PlayButtonState.Installing: return Text.Installing;
+ case PlayButtonState.Play: return Text.Play;
+ case PlayButtonState.Playing: return Text.Playing;
default: return null;
}
}
@@ -260,13 +260,13 @@ namespace AM2RLauncher
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;
+ case PlayButtonState.Download: return Text.PlayButtonDownloadToolTip;
+ case PlayButtonState.Downloading: return Text.PlayButtonDownloadToolTip;
+ case PlayButtonState.Select11: return Text.PlayButtonSelect11ToolTip;
+ case PlayButtonState.Install: return playButton.ToolTip = HelperMethods.GetText(Text.PlayButtonInstallToolTip, profileName);
+ case PlayButtonState.Installing: return Text.PlayButtonInstallingToolTip;
+ case PlayButtonState.Play: return HelperMethods.GetText(Text.PlayButtonPlayToolTip, profileName);
+ case PlayButtonState.Playing: return Text.PlayButtonPlayingToolTip;
default: return null;
}
}
@@ -374,7 +374,7 @@ namespace AM2RLauncher
customMirrorTextBox.Enabled = enabled;
mirrorDropDown.Enabled = !enabled;
// Not sure why the dropdown menu needs this hack, but the textBox does not.
- //TODO: eto issue?
+ //TODO: eto feature request
if (OS.IsWindows)
mirrorDropDown.TextColor = mirrorDropDown.Enabled ? colGreen : colInactive;
mirrorLabel.TextColor = !enabled ? colGreen : colInactive;
diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs
index 65fd56f..a20598e 100644
--- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs
+++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs
@@ -1,6 +1,7 @@
using AM2RLauncher.Core;
using AM2RLauncher.Core.XML;
using AM2RLauncher.Language;
+using AM2RLauncher.Properties;
using Eto.Drawing;
using Eto.Forms;
using log4net;
@@ -31,15 +32,11 @@ namespace AM2RLauncher
///
private const string VERSION = LauncherUpdater.VERSION;
- ///
- /// A of the AM2R icon.
- ///
- private static readonly Bitmap am2rIcon = new Bitmap(AM2RLauncher.Properties.Resources.AM2RIcon);
///
- /// An enum, that has possible states for our Launcher.
+ /// An enum, that has possible states for the play button.
///
- public enum UpdateState
+ public enum PlayButtonState
{
Download,
Downloading,
@@ -62,7 +59,7 @@ namespace AM2RLauncher
///
/// This variable has the current global state of the Launcher.
///
- private static UpdateState updateState = UpdateState.Download;
+ private static PlayButtonState updateState = PlayButtonState.Download;
///
/// This variable has the current global statue of the .
///
@@ -101,13 +98,9 @@ namespace AM2RLauncher
if (OS.IsWindows)
{
Process current = Process.GetCurrentProcess();
- foreach (Process process in Process.GetProcessesByName(current.ProcessName))
- {
- if (process.Id == current.Id)
- continue;
+ Process process = Process.GetProcessesByName(current.ProcessName).First(p => p.Id == current.Id);
+ if (process != null)
Core.Core.SetForegroundWindow(process.MainWindowHandle);
- break;
- }
}
Environment.Exit(0);
}
@@ -134,8 +127,10 @@ namespace AM2RLauncher
#region VARIABLE INITIALIZATION
log.Info("Beginning UI initialization...");
+ Bitmap am2rIcon = new Bitmap(AM2RLauncher.Properties.Resources.AM2RIcon);
+
// System tray indicator
- showButton = new ButtonMenuItem { Text = Text.TrayButtonShow };
+ ButtonMenuItem showButton = new ButtonMenuItem { Text = Text.TrayButtonShow };
trayIndicator = new TrayIndicator
{
Menu = new ContextMenu(showButton),
@@ -151,6 +146,7 @@ namespace AM2RLauncher
// Create array from validCount
profileList = new List();
+ //TODO: whenever profileDropDown gets rewritten to use a datastore, scrap this
profileNames = new List();
foreach (var profile in profileList)
{
@@ -161,23 +157,6 @@ namespace AM2RLauncher
string splash = Splash.GetSplash();
log.Info("Randomly chosen splash: " + splash);
- // Load bitmaps
- redditIcon = new Bitmap(AM2RLauncher.Properties.Resources.redditIcon48);
- githubIcon = new Bitmap(AM2RLauncher.Properties.Resources.githubIcon48);
- youtubeIcon = new Bitmap(AM2RLauncher.Properties.Resources.youtubeIcon48);
- discordIcon = new Bitmap(AM2RLauncher.Properties.Resources.discordIcon48);
- formBG = new Bitmap(AM2RLauncher.Properties.Resources.bgCentered);
-
- // Load colors
- colGreen = Color.FromArgb(142, 188, 35);
- colRed = Color.FromArgb(188, 10, 35);
- colInactive = Color.FromArgb(109, 109, 109);
- colBGNoAlpha = Color.FromArgb(10, 10, 10);
- colBG = Color.FromArgb(10, 10, 10, 80);
- if (OS.IsLinux) colBG = colBGNoAlpha; // XORG can't display alpha anyway, and Wayland breaks with it.
- // TODO: that sounds like an Eto bug. investigate, try to open eto issue.
- colBGHover = Color.FromArgb(17, 28, 13);
-
Font smallButtonFont = new Font(SystemFont.Default, 10);
// Create mirror list - eventually this should be platform specific!
@@ -347,15 +326,19 @@ namespace AM2RLauncher
// Social buttons
+ Bitmap redditIcon = new Bitmap(Resources.redditIcon48);
var redditButton = new ImageButton { ToolTip = Text.RedditToolTip, Image = redditIcon };
redditButton.Click += (sender, e) => CrossPlatformOperations.OpenURL("https://www.reddit.com/r/AM2R");
+ Bitmap githubIcon = new Bitmap(Resources.githubIcon48);
var githubButton = new ImageButton { ToolTip = Text.GithubToolTip, Image = githubIcon };
githubButton.Click += (sender, e) => CrossPlatformOperations.OpenURL("https://www.github.com/AM2R-Community-Developers");
+ Bitmap youtubeIcon = new Bitmap(Resources.youtubeIcon48);
var youtubeButton = new ImageButton { ToolTip = Text.YoutubeToolTip, Image = youtubeIcon };
youtubeButton.Click += (sender, e) => CrossPlatformOperations.OpenURL("https://www.youtube.com/c/AM2RCommunityUpdates");
+ Bitmap discordIcon = new Bitmap(Resources.discordIcon48);
var discordButton = new ImageButton { ToolTip = Text.DiscordToolTip, Image = discordIcon };
discordButton.Click += (sender, e) => CrossPlatformOperations.OpenURL("https://discord.gg/nk7UYPbd5u");
@@ -371,7 +354,12 @@ namespace AM2RLauncher
// Version number label
- versionLabel = new Label { Text = "v" + VERSION + (isThisRunningFromWine ? "-WINE" : ""), Width = 48, TextAlignment = TextAlignment.Right, TextColor = colGreen, Font = new Font(SystemFont.Default, 12) };
+ Label versionLabel = new Label
+ {
+ Text = "v" + VERSION + (isThisRunningFromWine ? "-WINE" : ""),
+ Width = 48, TextAlignment = TextAlignment.Right, TextColor = colGreen,
+ Font = new Font(SystemFont.Default, 12)
+ };
// Tie everything together
var mainLayout = new DynamicLayout();
@@ -394,7 +382,7 @@ namespace AM2RLauncher
#region MAIN PAGE
// [MAIN PAGE]
- mainPage = new TabPage
+ TabPage mainPage = new TabPage
{
BackgroundColor = colBGNoAlpha,
Text = Text.PlayTab,
@@ -404,20 +392,19 @@ namespace AM2RLauncher
#region CHANGELOG PAGE
// [CHANGELOG]
- changelogUri = new Uri("https://am2r-community-developers.github.io/DistributionCenter/changelog.html");
-
- changelogWebView = new WebView { Url = changelogUri };
+ Uri changelogUri = new Uri("https://am2r-community-developers.github.io/DistributionCenter/changelog.html");
+ WebView changelogWebView = new WebView { Url = changelogUri };
if (OS.IsUnix && !isInternetThere)
changelogWebView = new WebView();
- changelogNoConnectionLabel = new Label
+ Label changelogNoConnectionLabel = new Label
{
Text = Text.NoInternetConnection,
TextColor = colGreen
};
- changelogPage = new TabPage
+ TabPage changelogPage = new TabPage
{
BackgroundColor = colBGNoAlpha,
Text = Text.ChangelogTab,
@@ -436,19 +423,20 @@ namespace AM2RLauncher
#region NEWS PAGE
// [NEWS]
- newsUri = new Uri("https://am2r-community-developers.github.io/DistributionCenter/news.html");
- newsWebView = new WebView { Url = newsUri };
+ Uri newsUri = new Uri("https://am2r-community-developers.github.io/DistributionCenter/news.html");
+ WebView newsWebView = new WebView { Url = newsUri };
+ //TODO: why exactly is this check necessary?
if (OS.IsUnix && !isInternetThere)
newsWebView = new WebView();
- newsNoConnectionLabel = new Label
+ Label newsNoConnectionLabel = new Label
{
Text = Text.NoInternetConnection,
TextColor = colGreen
};
- newsPage = new TabPage
+ TabPage newsPage = new TabPage
{
Text = Text.NewsTab,
BackgroundColor = colBGNoAlpha,
@@ -462,6 +450,7 @@ namespace AM2RLauncher
}
};
+ //TODO: this is hack because on linux / mac the other way doesn't work. eto issue?
if (OS.IsUnix && !isInternetThere)
{
changelogPage.Content = new TableLayout
@@ -492,7 +481,7 @@ namespace AM2RLauncher
DynamicLayout settingsLayout = new DynamicLayout();
// LanguageLabel
- languageLabel = new Label
+ Label languageLabel = new Label
{
Text = Text.LanguageNotice,
TextColor = colGreen
@@ -575,7 +564,7 @@ namespace AM2RLauncher
};
// Custom environment variables label
- customEnvVarLabel = new Label();
+ Label customEnvVarLabel = new Label();
if (OS.IsLinux)
{
customEnvVarLabel = new Label
@@ -653,7 +642,7 @@ namespace AM2RLauncher
#region MODSETTINGS PAGE
// [MOD SETTINGS]
- DynamicLayout profileLayout = new DynamicLayout();
+ DynamicLayout modSettingsLayout = new DynamicLayout();
addModButton = new ColorButton
@@ -756,15 +745,15 @@ namespace AM2RLauncher
Text = Text.ProfileNotes
};
- profileLayout.BeginHorizontal();
- profileLayout.AddSpace();
- profileLayout.AddColumn(null, addModButton, modSpacer, settingsProfileLabel, modSettingsProfileDropDown, profileButton, saveButton, updateModButton, deleteModButton, profileNotesTextArea, null);
- profileLayout.AddSpace();
+ modSettingsLayout.BeginHorizontal();
+ modSettingsLayout.AddSpace();
+ modSettingsLayout.AddColumn(null, addModButton, modSpacer, settingsProfileLabel, modSettingsProfileDropDown, profileButton, saveButton, updateModButton, deleteModButton, profileNotesTextArea, null);
+ modSettingsLayout.AddSpace();
- profilePage = new TabPage
+ TabPage modSettingsPage = new TabPage
{
BackgroundColor = colBGNoAlpha,
- Content = profileLayout,
+ Content = modSettingsLayout,
Text = Text.ModSettingsTab
};
@@ -784,7 +773,7 @@ namespace AM2RLauncher
settingsPage,
- profilePage
+ modSettingsPage
}
};
@@ -808,7 +797,7 @@ namespace AM2RLauncher
playButton.LoadComplete += PlayButtonLoadComplete;
customMirrorTextBox.LostFocus += CustomMirrorTextBoxLostFocus;
mirrorDropDown.SelectedIndexChanged += MirrorDropDownSelectedIndexChanged;
- profileLayout.LoadComplete += ProfileLayoutLoadComplete;
+ modSettingsLayout.LoadComplete += ProfileLayoutLoadComplete;
addModButton.Click += AddModButtonClicked;
profileButton.Click += ProfileDataButtonClickEvent;
saveButton.Click += SaveButtonClickEvent;
@@ -833,9 +822,7 @@ namespace AM2RLauncher
// Visual studio does it like this for normal winforms projects, so I just used the same format.
/// The tray indicator
- TrayIndicator trayIndicator;
- /// The "Show" Button on the tray indicator
- ButtonMenuItem showButton;
+ private TrayIndicator trayIndicator;
/// of s, used for actually working with profile data.
//TODO: this should be moved into AM2RLauncher.Core
@@ -843,31 +830,24 @@ namespace AM2RLauncher
/// of s so that Eto's annoying interface is appeased. Used for profile name display in DropDowns.
List profileNames;
- // Bitmaps
- /// The Reddit icon.
- private Bitmap redditIcon;
- /// The Github icon.
- private Bitmap githubIcon;
- /// The YouTube icon.
- private Bitmap youtubeIcon;
- /// The Discord icon.
- private Bitmap discordIcon;
/// The planet Background.
- private Bitmap formBG;
+ private readonly Bitmap formBG = new Bitmap(Resources.bgCentered);
// Colors
/// The main green color.
- private Color colGreen;
+ private readonly Color colGreen = Color.FromArgb(142, 188, 35);
/// The warning red color.
- private Color colRed;
+ private readonly Color colRed = Color.FromArgb(188, 10, 35);
/// The main inactive color.
- private Color colInactive;
+ private readonly Color colInactive = Color.FromArgb(109, 109, 109);
/// The black background color without alpha value.
- private Color colBGNoAlpha;
+ private readonly Color colBGNoAlpha = Color.FromArgb(10, 10, 10);
/// The black background color.
- private Color colBG;
+ // XORG can't display alpha anyway, and Wayland breaks with it.
+ // TODO: that sounds like an Eto bug. investigate, try to open eto issue.
+ private readonly Color colBG = OS.IsLinux ? Color.FromArgb(10, 10, 10) : Color.FromArgb(10, 10, 10, 80);
/// The lighter green color on hover.
- private Color colBGHover;
+ private readonly Color colBGHover = Color.FromArgb(17, 28, 13);
// Mirror lists
/// of mirror s, used for actually working with mirrors.
@@ -876,7 +856,7 @@ namespace AM2RLauncher
private List mirrorDescriptionList;
// UI Elements
- /// The main control of the , used to draw the and hold the main interface.
+ /// The main control of the main page, used to draw the and hold the main interface.
private Drawable drawable;
/// A that acts as the main Button
@@ -894,8 +874,6 @@ namespace AM2RLauncher
/// A that is used to delete a mod
private ColorButton deleteModButton;
- /// The that gives information for .
- private Label languageLabel;
/// The that entitles .
private Label profileLabel;
/// The that gives author information for .
@@ -904,22 +882,12 @@ namespace AM2RLauncher
private Label profileVersionLabel;
/// The that gives information for .
private Label mirrorLabel;
- /// The that displays , aka the current launcher version.
- private Label versionLabel;
/// The that gives information for .
private Label settingsProfileLabel;
/// The that compliments .
private Label progressLabel;
- /// The that gives a warning on failure to load the .
- private Label newsNoConnectionLabel;
- /// The that gives a warning on failure to load the .
- private Label changelogNoConnectionLabel;
/// The that gives a warning if the current selected shares the same save location has default AM2R.
private Label saveWarningLabel;
- /// The that describes .
- private Label customEnvVarLabel;
-
-
/// A , that indicates wether to automatically update AM2R or not.
private CheckBox autoUpdateAM2RCheck;
@@ -955,25 +923,6 @@ namespace AM2RLauncher
/// A that can be used to show progress for a specific task.
private ProgressBar progressBar;
- /// The Uri used by .
- private Uri newsUri;
- /// The Uri used by .
- private Uri changelogUri;
-
- /// A to display the DistributionCenter news page.
- private WebView newsWebView;
- /// A to display the DistributionCenter changelog page.
- private WebView changelogWebView;
-
- /// A for the Launcher's main interface.
- private TabPage mainPage;
- /// A for the Launcher's news integration.
- private TabPage newsPage;
- /// A for the Launcher's changelog integration.
- private TabPage changelogPage;
- /// A for the Launcher's profile settings.
- private TabPage profilePage;
-
#endregion
}
}
\ No newline at end of file