Skip to content

Commit ad13b92

Browse files
authored
Merge pull request #244 from TeamWheelWizard/dev
Add Skip option; clear surface on render failure
2 parents 0fc2cd5 + 2aa1af2 commit ad13b92

3 files changed

Lines changed: 26 additions & 8 deletions

File tree

WheelWizard/Views/Patterns/MiiImages/Mii3DRender.axaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ private async Task RenderWorkerLoopAsync()
272272

273273
if (result.IsFailure)
274274
{
275+
await Dispatcher.UIThread.InvokeAsync(() => ClearSurface(render.Generation), DispatcherPriority.Background);
275276
continue;
276277
}
277278

WheelWizard/Views/Popups/Generic/MiiRenderingSetupPopup.axaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Margin="0,14,0,0"
1515
TextWrapping="Wrap"
1616
Classes="BodyText"
17-
Text="Wheel Wizard needs one external file to render Miis offline. Download it once and it will be stored in your Wheel Wizard data folder." />
17+
Text="Wheel Wizard can use one external file to render Miis offline in 3D. Download it once and it will be stored in your Wheel Wizard data folder, or skip and continue without 3D Mii rendering." />
1818

1919
<Border Grid.Row="2"
2020
Margin="0,18,0,0"
@@ -49,7 +49,7 @@
4949
<TextBlock Classes="BodyText"
5050
TextWrapping="Wrap"
5151
Opacity="0.75"
52-
Text="Closing this popup exits Wheel Wizard. The main app will only open after the required Mii rendering file is installed." />
52+
Text="Skip opens Wheel Wizard without offline 3D Mii rendering. Close exits the app." />
5353
<TextBlock x:Name="ErrorTextBlock"
5454
Classes="BodyText"
5555
Foreground="{StaticResource Danger400}"
@@ -58,15 +58,20 @@
5858
</StackPanel>
5959

6060
<UniformGrid Grid.Row="4"
61-
Columns="2"
61+
Columns="3"
6262
Margin="0,24,0,0">
6363
<components:Button x:Name="CloseButton"
6464
Margin="0,0,6,0"
6565
Variant="Default"
6666
Text="Close"
6767
Click="CloseButton_OnClick" />
68+
<components:Button x:Name="SkipButton"
69+
Margin="0,0,6,0"
70+
Variant="Default"
71+
Text="Skip"
72+
Click="SkipButton_OnClick" />
6873
<components:Button x:Name="DownloadButton"
69-
Margin="6,0,0,0"
74+
Margin="0,0,0,0"
7075
Variant="Primary"
7176
Text="Download"
7277
Click="DownloadButton_OnClick" />

WheelWizard/Views/Popups/Generic/MiiRenderingSetupPopup.axaml.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public partial class MiiRenderingSetupPopup : PopupContent
1212
private readonly TaskCompletionSource<bool> _completionSource = new();
1313
private CancellationTokenSource? _downloadCancellationTokenSource;
1414
private bool _downloadCompleted;
15+
private bool _skipRequested;
1516

1617
[Inject]
1718
private IMiiRenderingResourceInstaller ResourceInstaller { get; set; } = null!;
@@ -24,7 +25,7 @@ public MiiRenderingSetupPopup()
2425
{
2526
InitializeComponent();
2627
PathTextBlock.Text = PathManager.MiiRenderingResourceFilePath;
27-
StatusTextBlock.Text = "Download the Mii rendering resource to continue.";
28+
StatusTextBlock.Text = "Download the Mii rendering resource to enable offline 3D Mii rendering.";
2829
ProgressTextBlock.Text = "Ready to install.";
2930
}
3031

@@ -66,7 +67,7 @@ private async void DownloadButton_OnClick(object? sender, RoutedEventArgs e)
6667
_downloadCancellationTokenSource = null;
6768

6869
if (!_downloadCompleted)
69-
SetBusyState(false, "Download the Mii rendering resource to continue.");
70+
SetBusyState(false, "Download the Mii rendering resource to enable offline 3D Mii rendering.");
7071
}
7172
}
7273

@@ -93,16 +94,27 @@ private void CloseButton_OnClick(object? sender, RoutedEventArgs e)
9394
Close();
9495
}
9596

97+
private void SkipButton_OnClick(object? sender, RoutedEventArgs e)
98+
{
99+
if (_downloadCancellationTokenSource != null)
100+
return;
101+
102+
_skipRequested = true;
103+
_completionSource.TrySetResult(true);
104+
Close();
105+
}
106+
96107
protected override void BeforeClose()
97108
{
98109
_downloadCancellationTokenSource?.Cancel();
99-
_completionSource.TrySetResult(_downloadCompleted);
110+
_completionSource.TrySetResult(_downloadCompleted || _skipRequested);
100111
}
101112

102113
private void SetBusyState(bool busy, string statusText)
103114
{
104115
StatusTextBlock.Text = statusText;
105116
DownloadButton.IsEnabled = !busy;
117+
SkipButton.IsEnabled = !busy;
106118
CloseButton.IsEnabled = true;
107119
CloseButton.Text = busy ? "Close and Exit" : "Close";
108120
}
@@ -111,7 +123,7 @@ private void ShowError(string message)
111123
{
112124
ErrorTextBlock.Text = message;
113125
ErrorTextBlock.IsVisible = true;
114-
SetBusyState(false, "Download the Mii rendering resource to continue.");
126+
SetBusyState(false, "Download the Mii rendering resource to enable offline 3D Mii rendering.");
115127
}
116128

117129
private static string FormatMegabytes(long bytes) => $"{bytes / 1024d / 1024d:F2} MB";

0 commit comments

Comments
 (0)