ui: hide installation key if no extras key can be used

This commit is contained in:
2025-06-30 05:50:41 +02:00
parent 433613e43d
commit 45ef76e647
2 changed files with 52 additions and 49 deletions

View File

@@ -35,8 +35,8 @@ namespace ModpackUpdater.Apps.Client
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
RadLabel1 = new Telerik.WinControls.UI.RadLabel(); RadLabel_MinecraftProfile = new Telerik.WinControls.UI.RadLabel();
RadLabel2 = new Telerik.WinControls.UI.RadLabel(); RadLabel_ModpackUrl = new Telerik.WinControls.UI.RadLabel();
RadTextBox_MinecraftProfileFolder = new Telerik.WinControls.UI.RadTextBoxControl(); RadTextBox_MinecraftProfileFolder = new Telerik.WinControls.UI.RadTextBoxControl();
RadTextBox_ModpackConfig = new Telerik.WinControls.UI.RadTextBoxControl(); RadTextBox_ModpackConfig = new Telerik.WinControls.UI.RadTextBoxControl();
RadButton_Install = new Telerik.WinControls.UI.RadSplitButton(); RadButton_Install = new Telerik.WinControls.UI.RadSplitButton();
@@ -46,11 +46,11 @@ namespace ModpackUpdater.Apps.Client
RadButton_SearchMinecraftProfileFolder = new Telerik.WinControls.UI.RadButton(); RadButton_SearchMinecraftProfileFolder = new Telerik.WinControls.UI.RadButton();
tableLayoutPanel1 = new TableLayoutPanel(); tableLayoutPanel1 = new TableLayoutPanel();
RadLabel_Status = new Telerik.WinControls.UI.RadLabel(); RadLabel_Status = new Telerik.WinControls.UI.RadLabel();
RadLabel3 = new Telerik.WinControls.UI.RadLabel(); RadLabel_StatusDesc = new Telerik.WinControls.UI.RadLabel();
radLabel4 = new Telerik.WinControls.UI.RadLabel(); radLabel_InstallationKey = new Telerik.WinControls.UI.RadLabel();
radTextBox_InstallKey = new Telerik.WinControls.UI.RadTextBoxControl(); radTextBox_InstallKey = new Telerik.WinControls.UI.RadTextBoxControl();
((System.ComponentModel.ISupportInitialize)RadLabel1).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadLabel_MinecraftProfile).BeginInit();
((System.ComponentModel.ISupportInitialize)RadLabel2).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadLabel_ModpackUrl).BeginInit();
((System.ComponentModel.ISupportInitialize)RadTextBox_MinecraftProfileFolder).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadTextBox_MinecraftProfileFolder).BeginInit();
((System.ComponentModel.ISupportInitialize)RadTextBox_ModpackConfig).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadTextBox_ModpackConfig).BeginInit();
((System.ComponentModel.ISupportInitialize)RadButton_Install).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadButton_Install).BeginInit();
@@ -58,29 +58,29 @@ namespace ModpackUpdater.Apps.Client
((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).BeginInit();
tableLayoutPanel1.SuspendLayout(); tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)RadLabel_Status).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadLabel_Status).BeginInit();
((System.ComponentModel.ISupportInitialize)RadLabel3).BeginInit(); ((System.ComponentModel.ISupportInitialize)RadLabel_StatusDesc).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel4).BeginInit(); ((System.ComponentModel.ISupportInitialize)radLabel_InstallationKey).BeginInit();
((System.ComponentModel.ISupportInitialize)radTextBox_InstallKey).BeginInit(); ((System.ComponentModel.ISupportInitialize)radTextBox_InstallKey).BeginInit();
((System.ComponentModel.ISupportInitialize)this).BeginInit(); ((System.ComponentModel.ISupportInitialize)this).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// RadLabel1 // RadLabel_MinecraftProfile
// //
RadLabel1.Anchor = AnchorStyles.Left; RadLabel_MinecraftProfile.Anchor = AnchorStyles.Left;
RadLabel1.Location = new Point(3, 4); RadLabel_MinecraftProfile.Location = new Point(3, 4);
RadLabel1.Name = "RadLabel1"; RadLabel_MinecraftProfile.Name = "RadLabel_MinecraftProfile";
RadLabel1.Size = new Size(113, 22); RadLabel_MinecraftProfile.Size = new Size(113, 22);
RadLabel1.TabIndex = 0; RadLabel_MinecraftProfile.TabIndex = 0;
RadLabel1.Text = "Minecraft profile"; RadLabel_MinecraftProfile.Text = "Minecraft profile";
// //
// RadLabel2 // RadLabel_ModpackUrl
// //
RadLabel2.Anchor = AnchorStyles.Left; RadLabel_ModpackUrl.Anchor = AnchorStyles.Left;
RadLabel2.Location = new Point(3, 34); RadLabel_ModpackUrl.Location = new Point(3, 34);
RadLabel2.Name = "RadLabel2"; RadLabel_ModpackUrl.Name = "RadLabel_ModpackUrl";
RadLabel2.Size = new Size(96, 22); RadLabel_ModpackUrl.Size = new Size(96, 22);
RadLabel2.TabIndex = 1; RadLabel_ModpackUrl.TabIndex = 1;
RadLabel2.Text = "Modpack URL"; RadLabel_ModpackUrl.Text = "Modpack URL";
// //
// RadTextBox_MinecraftProfileFolder // RadTextBox_MinecraftProfileFolder
// //
@@ -169,14 +169,14 @@ namespace ModpackUpdater.Apps.Client
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F)); tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F)); tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F)); tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
tableLayoutPanel1.Controls.Add(RadLabel1, 0, 0); tableLayoutPanel1.Controls.Add(RadLabel_MinecraftProfile, 0, 0);
tableLayoutPanel1.Controls.Add(RadLabel2, 0, 1); tableLayoutPanel1.Controls.Add(RadLabel_ModpackUrl, 0, 1);
tableLayoutPanel1.Controls.Add(RadTextBox_MinecraftProfileFolder, 1, 0); tableLayoutPanel1.Controls.Add(RadTextBox_MinecraftProfileFolder, 1, 0);
tableLayoutPanel1.Controls.Add(RadTextBox_ModpackConfig, 1, 1); tableLayoutPanel1.Controls.Add(RadTextBox_ModpackConfig, 1, 1);
tableLayoutPanel1.Controls.Add(RadLabel_Status, 1, 3); tableLayoutPanel1.Controls.Add(RadLabel_Status, 1, 3);
tableLayoutPanel1.Controls.Add(RadLabel3, 0, 3); tableLayoutPanel1.Controls.Add(RadLabel_StatusDesc, 0, 3);
tableLayoutPanel1.Controls.Add(RadButton_Install, 4, 4); tableLayoutPanel1.Controls.Add(RadButton_Install, 4, 4);
tableLayoutPanel1.Controls.Add(radLabel4, 0, 2); tableLayoutPanel1.Controls.Add(radLabel_InstallationKey, 0, 2);
tableLayoutPanel1.Controls.Add(radTextBox_InstallKey, 1, 2); tableLayoutPanel1.Controls.Add(radTextBox_InstallKey, 1, 2);
tableLayoutPanel1.Controls.Add(RadButton_CheckForUpdates, 1, 4); tableLayoutPanel1.Controls.Add(RadButton_CheckForUpdates, 1, 4);
tableLayoutPanel1.Controls.Add(RadButton_SearchMinecraftProfileFolder, 4, 0); tableLayoutPanel1.Controls.Add(RadButton_SearchMinecraftProfileFolder, 4, 0);
@@ -203,23 +203,24 @@ namespace ModpackUpdater.Apps.Client
RadLabel_Status.Text = "-"; RadLabel_Status.Text = "-";
RadLabel_Status.TextImageRelation = TextImageRelation.ImageBeforeText; RadLabel_Status.TextImageRelation = TextImageRelation.ImageBeforeText;
// //
// RadLabel3 // RadLabel_StatusDesc
// //
RadLabel3.Anchor = AnchorStyles.Left; RadLabel_StatusDesc.Anchor = AnchorStyles.Left;
RadLabel3.Location = new Point(3, 93); RadLabel_StatusDesc.Location = new Point(3, 93);
RadLabel3.Name = "RadLabel3"; RadLabel_StatusDesc.Name = "RadLabel_StatusDesc";
RadLabel3.Size = new Size(46, 22); RadLabel_StatusDesc.Size = new Size(46, 22);
RadLabel3.TabIndex = 2; RadLabel_StatusDesc.TabIndex = 2;
RadLabel3.Text = "Status"; RadLabel_StatusDesc.Text = "Status";
// //
// radLabel4 // radLabel_InstallationKey
// //
radLabel4.Anchor = AnchorStyles.Left; radLabel_InstallationKey.Anchor = AnchorStyles.Left;
radLabel4.Location = new Point(3, 64); radLabel_InstallationKey.Location = new Point(3, 64);
radLabel4.Name = "radLabel4"; radLabel_InstallationKey.Name = "radLabel_InstallationKey";
radLabel4.Size = new Size(102, 22); radLabel_InstallationKey.Size = new Size(102, 22);
radLabel4.TabIndex = 12; radLabel_InstallationKey.TabIndex = 12;
radLabel4.Text = "Installation key"; radLabel_InstallationKey.Text = "Installation key";
radLabel_InstallationKey.Visible = false;
// //
// radTextBox_InstallKey // radTextBox_InstallKey
// //
@@ -230,6 +231,7 @@ namespace ModpackUpdater.Apps.Client
radTextBox_InstallKey.NullText = "AAAAA-BBBBB-CCCCC-DDDDD-EEEEE"; radTextBox_InstallKey.NullText = "AAAAA-BBBBB-CCCCC-DDDDD-EEEEE";
radTextBox_InstallKey.Size = new Size(297, 24); radTextBox_InstallKey.Size = new Size(297, 24);
radTextBox_InstallKey.TabIndex = 4; radTextBox_InstallKey.TabIndex = 4;
radTextBox_InstallKey.Visible = false;
radTextBox_InstallKey.TextChanged += RadTextBox_InstallationKey_TextInserted; radTextBox_InstallKey.TextChanged += RadTextBox_InstallationKey_TextInserted;
// //
// MainForm // MainForm
@@ -250,8 +252,8 @@ namespace ModpackUpdater.Apps.Client
FormClosing += Form1_FormClosing; FormClosing += Form1_FormClosing;
Load += Form1_Load; Load += Form1_Load;
Shown += Form1_Shown; Shown += Form1_Shown;
((System.ComponentModel.ISupportInitialize)RadLabel1).EndInit(); ((System.ComponentModel.ISupportInitialize)RadLabel_MinecraftProfile).EndInit();
((System.ComponentModel.ISupportInitialize)RadLabel2).EndInit(); ((System.ComponentModel.ISupportInitialize)RadLabel_ModpackUrl).EndInit();
((System.ComponentModel.ISupportInitialize)RadTextBox_MinecraftProfileFolder).EndInit(); ((System.ComponentModel.ISupportInitialize)RadTextBox_MinecraftProfileFolder).EndInit();
((System.ComponentModel.ISupportInitialize)RadTextBox_ModpackConfig).EndInit(); ((System.ComponentModel.ISupportInitialize)RadTextBox_ModpackConfig).EndInit();
((System.ComponentModel.ISupportInitialize)RadButton_Install).EndInit(); ((System.ComponentModel.ISupportInitialize)RadButton_Install).EndInit();
@@ -260,27 +262,27 @@ namespace ModpackUpdater.Apps.Client
tableLayoutPanel1.ResumeLayout(false); tableLayoutPanel1.ResumeLayout(false);
tableLayoutPanel1.PerformLayout(); tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)RadLabel_Status).EndInit(); ((System.ComponentModel.ISupportInitialize)RadLabel_Status).EndInit();
((System.ComponentModel.ISupportInitialize)RadLabel3).EndInit(); ((System.ComponentModel.ISupportInitialize)RadLabel_StatusDesc).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel4).EndInit(); ((System.ComponentModel.ISupportInitialize)radLabel_InstallationKey).EndInit();
((System.ComponentModel.ISupportInitialize)radTextBox_InstallKey).EndInit(); ((System.ComponentModel.ISupportInitialize)radTextBox_InstallKey).EndInit();
((System.ComponentModel.ISupportInitialize)this).EndInit(); ((System.ComponentModel.ISupportInitialize)this).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
internal Telerik.WinControls.UI.RadLabel RadLabel1; internal Telerik.WinControls.UI.RadLabel RadLabel_MinecraftProfile;
internal Telerik.WinControls.UI.RadLabel RadLabel2; internal Telerik.WinControls.UI.RadLabel RadLabel_ModpackUrl;
internal Telerik.WinControls.UI.RadTextBoxControl RadTextBox_MinecraftProfileFolder; internal Telerik.WinControls.UI.RadTextBoxControl RadTextBox_MinecraftProfileFolder;
internal Telerik.WinControls.UI.RadTextBoxControl RadTextBox_ModpackConfig; internal Telerik.WinControls.UI.RadTextBoxControl RadTextBox_ModpackConfig;
internal Telerik.WinControls.UI.RadSplitButton RadButton_Install; internal Telerik.WinControls.UI.RadSplitButton RadButton_Install;
internal Telerik.WinControls.UI.RadButton RadButton_CheckForUpdates; internal Telerik.WinControls.UI.RadButton RadButton_CheckForUpdates;
internal Telerik.WinControls.UI.RadButton RadButton_SearchMinecraftProfileFolder; internal Telerik.WinControls.UI.RadButton RadButton_SearchMinecraftProfileFolder;
private TableLayoutPanel tableLayoutPanel1; private TableLayoutPanel tableLayoutPanel1;
internal Telerik.WinControls.UI.RadLabel radLabel4; internal Telerik.WinControls.UI.RadLabel radLabel_InstallationKey;
internal Telerik.WinControls.UI.RadTextBoxControl radTextBox_InstallKey; internal Telerik.WinControls.UI.RadTextBoxControl radTextBox_InstallKey;
private Telerik.WinControls.UI.RadMenuItem radMenuItem_Repair; private Telerik.WinControls.UI.RadMenuItem radMenuItem_Repair;
private Telerik.WinControls.UI.RadMenuItem radMenuItem_Install; private Telerik.WinControls.UI.RadMenuItem radMenuItem_Install;
internal Telerik.WinControls.UI.RadLabel RadLabel_Status; internal Telerik.WinControls.UI.RadLabel RadLabel_Status;
internal Telerik.WinControls.UI.RadLabel RadLabel3; internal Telerik.WinControls.UI.RadLabel RadLabel_StatusDesc;
} }
} }

View File

@@ -97,6 +97,8 @@ public partial class MainForm
if (modpackInfo != null) if (modpackInfo != null)
features = new(updateConfig); features = new(updateConfig);
radTextBox_InstallKey.Visible = radLabel_InstallationKey.Visible = !string.IsNullOrWhiteSpace(updateConfig.UnleashApiUrl);
if (modpackInfo == null || string.IsNullOrWhiteSpace(RadTextBox_MinecraftProfileFolder.Text) /*|| modpackInfo.Valid*/) if (modpackInfo == null || string.IsNullOrWhiteSpace(RadTextBox_MinecraftProfileFolder.Text) /*|| modpackInfo.Valid*/)
{ {
SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppGlobals.Symbols.GetSvgImage(AppSymbols.general_warning_sign, SymbolSize.Small)); SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppGlobals.Symbols.GetSvgImage(AppSymbols.general_warning_sign, SymbolSize.Small));
@@ -118,7 +120,6 @@ public partial class MainForm
RadButton_Install.Enabled = false; RadButton_Install.Enabled = false;
return false; return false;
} }
RadButton_CheckForUpdates.Enabled = true; RadButton_CheckForUpdates.Enabled = true;
RadButton_Install.Enabled = true; RadButton_Install.Enabled = true;
return true; return true;