Initial work for AbstractUI options

This commit is contained in:
Yoshi Askharoun
2021-08-05 20:45:26 -05:00
parent ba28eb7ef7
commit 3e3228245d
63 changed files with 2392 additions and 68 deletions
+13 -1
View File
@@ -30,13 +30,25 @@ namespace ZuneModCore
public abstract string Author { get; }
public virtual AbstractUIElementGroup? GetDefaultOptionsUI() => null;
public virtual Task Init() => Task.CompletedTask;
public abstract Task<string?> Apply();
public abstract Task<string?> Reset();
public abstract AbstractUIElementGroup? OptionsUI { get; }
private AbstractUIElementGroup? _OptionsUI;
public AbstractUIElementGroup? OptionsUI
{
get
{
if (_OptionsUI == null)
_OptionsUI = GetDefaultOptionsUI();
return _OptionsUI;
}
set => _OptionsUI = value;
}
public string StorageDirectory
{
+33 -30
View File
@@ -19,39 +19,42 @@ namespace ZuneModCore.Mods
public override string Author => "Rafael Rivera";
public override AbstractUIElementGroup OptionsUI => new(nameof(FeaturesOverrideMod))
public override AbstractUIElementGroup? GetDefaultOptionsUI()
{
Title = "Select features:",
Items =
return new(nameof(FeaturesOverrideMod))
{
// We don't know what some of these overrides do exactly, so hide them from the user.
// The ID is the name of the registry key, the label is the display name
Title = "Select features:",
Items =
{
// We don't know what some of these overrides do exactly, so hide them from the user.
// The ID is the name of the registry key, the label is the display name
new AbstractBooleanUIElement("Apps", "Apps"),
new AbstractBooleanUIElement("Art", "Art"),
new AbstractBooleanUIElement("Channels", "Channels"),
new AbstractBooleanUIElement("FirstLaunchIntroVideo", "First Launch Intro Video"),
new AbstractBooleanUIElement("Games", "Games"),
new AbstractBooleanUIElement("Marketplace", "Marketplace"),
new AbstractBooleanUIElement("MBRPreview", "[Marketplace] Media Preview"),
new AbstractBooleanUIElement("MBRPurchase", "[Marketplace] Media Purchase"),
new AbstractBooleanUIElement("MBRRental", "[Marketplace] Media Rental"),
new AbstractBooleanUIElement("Music", "Music"),
new AbstractBooleanUIElement("MusicVideos", "Music Videos"),
new AbstractBooleanUIElement("Nowplaying", "Now Playing"),
new AbstractBooleanUIElement("NowplayingArt", "Now Playing Art"),
new AbstractBooleanUIElement("Picks", "Picks"),
new AbstractBooleanUIElement("Podcasts", "Podcasts"),
new AbstractBooleanUIElement("QuickMixLocal", "Quick Mix (Local)"),
new AbstractBooleanUIElement("QuickMixZMP", "Quick Mix (ZMP)"),
new AbstractBooleanUIElement("Quickplay", "Quickplay"),
new AbstractBooleanUIElement("Sign In Available", "Sign In"),
new AbstractBooleanUIElement("Social", "Social"),
new AbstractBooleanUIElement("SocialMarketplace", "Social Marketplace"),
new AbstractBooleanUIElement("SubscriptionFreeTracks", "Subscription Free Tracks"),
new AbstractBooleanUIElement("Videos", "Videos"),
}
};
new AbstractBooleanUIElement("Apps", "Apps"),
new AbstractBooleanUIElement("Art", "Art"),
new AbstractBooleanUIElement("Channels", "Channels"),
new AbstractBooleanUIElement("FirstLaunchIntroVideo", "First Launch Intro Video"),
new AbstractBooleanUIElement("Games", "Games"),
new AbstractBooleanUIElement("Marketplace", "Marketplace"),
new AbstractBooleanUIElement("MBRPreview", "[Marketplace] Media Preview"),
new AbstractBooleanUIElement("MBRPurchase", "[Marketplace] Media Purchase"),
new AbstractBooleanUIElement("MBRRental", "[Marketplace] Media Rental"),
new AbstractBooleanUIElement("Music", "Music"),
new AbstractBooleanUIElement("MusicVideos", "Music Videos"),
new AbstractBooleanUIElement("Nowplaying", "Now Playing"),
new AbstractBooleanUIElement("NowplayingArt", "Now Playing Art"),
new AbstractBooleanUIElement("Picks", "Picks"),
new AbstractBooleanUIElement("Podcasts", "Podcasts"),
new AbstractBooleanUIElement("QuickMixLocal", "Quick Mix (Local)"),
new AbstractBooleanUIElement("QuickMixZMP", "Quick Mix (ZMP)"),
new AbstractBooleanUIElement("Quickplay", "Quickplay"),
new AbstractBooleanUIElement("Sign In Available", "Sign In"),
new AbstractBooleanUIElement("Social", "Social"),
new AbstractBooleanUIElement("SocialMarketplace", "Social Marketplace"),
new AbstractBooleanUIElement("SubscriptionFreeTracks", "Subscription Free Tracks"),
new AbstractBooleanUIElement("Videos", "Videos"),
}
};
}
public override IReadOnlyList<Type>? DependentMods => null;
+11 -8
View File
@@ -24,21 +24,24 @@ namespace ZuneModCore.Mods
public override string Author => "Joshua \"Yoshi\" Askharoun";
public override AbstractUIElementGroup OptionsUI => new(nameof(MbidLocatorMod))
public override AbstractUIElementGroup? GetDefaultOptionsUI()
{
Title = "Select music folder:",
Items =
return new(nameof(MbidLocatorMod))
{
new AbstractTextBox("folderBox"),
new AbstractBooleanUIElement("recursiveBox", "Search recursively")
}
};
Title = "Select music folder:",
Items =
{
new AbstractTextBox("folderBox"),
new AbstractBooleanUIElement("recursiveBox", "Search recursively")
}
};
}
public override IReadOnlyList<Type>? DependentMods => null;
public override async Task<string?> Apply()
{
// TODO: Use user choices from AbstractUI
// Use user choices from AbstractUI
string folderPath = ((AbstractTextBox)OptionsUI.Items[0]).Value;
bool recursive = ((AbstractBooleanUIElement)OptionsUI.Items[1]).State;
string errorString = string.Empty;
-2
View File
@@ -23,8 +23,6 @@ namespace ZuneModCore.Mods
public override string Id => nameof(VideoSyncMod);
public override AbstractUIElementGroup? OptionsUI => null;
#pragma warning disable CA1416 // Validate platform compatibility
public override async Task<string?> Apply()
{
+11 -8
View File
@@ -21,18 +21,21 @@ namespace ZuneModCore.Mods
public override string Author => "Joshua \"Yoshi\" Askharoun";
public override AbstractUIElementGroup? OptionsUI => new(nameof(FeaturesOverrideMod))
public override AbstractUIElementGroup? GetDefaultOptionsUI()
{
Title = string.Empty,
Items =
return new(nameof(FeaturesOverrideMod))
{
new AbstractTextBox("hostBox", "zunes.tk", "zune.net")
Title = string.Empty,
Items =
{
Title = "Host",
TooltipText = "The host where the replacement servers are located. Must be the same length as \"zune.net\"."
new AbstractTextBox("hostBox", "zunes.tk", "zune.net")
{
Title = "Host",
TooltipText = "The host where the replacement servers are located. Must be the same length as \"zune.net\"."
}
}
}
};
};
}
public override IReadOnlyList<Type>? DependentMods => null;