ui(client): optimize installation key caching & show invalid key hint
This commit is contained in:
@@ -111,7 +111,15 @@ public partial class MainForm : Window
|
||||
}
|
||||
|
||||
if (modpackInfo != null)
|
||||
{
|
||||
features = new(updateConfig);
|
||||
modpackInfo.ExtrasKey = TextBoxInstallKey.Text?.Trim();
|
||||
if (!features.IsInvalid() && !string.IsNullOrWhiteSpace(TextBoxInstallKey.Text) && !AllowExtras())
|
||||
{
|
||||
SetStatus(GeneralLangRes.InstallationKeyNotValid, Symbols.Fluent.GetImageSource(SymbolsFluent.warning_shield));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
LabelInstallKey.IsVisible = TextBoxInstallKey.IsVisible = !string.IsNullOrWhiteSpace(updateConfig.UnleashApiUrl);
|
||||
|
||||
@@ -177,7 +185,7 @@ public partial class MainForm : Window
|
||||
SetStatus(GeneralLangRes.CheckingForUpdates, Symbols.Fluent.GetImageSource(SymbolsFluent.update));
|
||||
|
||||
// Check for extras once again
|
||||
updateOptions.IncludeExtras = features != null && features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
|
||||
updateOptions.IncludeExtras = AllowExtras();
|
||||
|
||||
// Force re-install on repair
|
||||
updateOptions.IgnoreInstalledVersion = repair;
|
||||
@@ -244,6 +252,11 @@ public partial class MainForm : Window
|
||||
}
|
||||
}
|
||||
|
||||
private bool AllowExtras()
|
||||
{
|
||||
return features != null && features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
|
||||
}
|
||||
|
||||
private void Updated_CheckingProgresssUpdated(int toCheck, int processed)
|
||||
{
|
||||
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", Symbols.Fluent.GetImageSource(SymbolsFluent.update));
|
||||
|
||||
Reference in New Issue
Block a user