Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions WheelWizard/Views/Patterns/MiiImages/Mii3DRender.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ private async Task RenderWorkerLoopAsync()

if (result.IsFailure)
{
await Dispatcher.UIThread.InvokeAsync(() => ClearSurface(render.Generation), DispatcherPriority.Background);
continue;
}

Expand Down
13 changes: 9 additions & 4 deletions WheelWizard/Views/Popups/Generic/MiiRenderingSetupPopup.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Margin="0,14,0,0"
TextWrapping="Wrap"
Classes="BodyText"
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." />
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." />

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

<UniformGrid Grid.Row="4"
Columns="2"
Columns="3"
Margin="0,24,0,0">
<components:Button x:Name="CloseButton"
Margin="0,0,6,0"
Variant="Default"
Text="Close"
Click="CloseButton_OnClick" />
<components:Button x:Name="SkipButton"
Margin="0,0,6,0"
Variant="Default"
Text="Skip"
Click="SkipButton_OnClick" />
<components:Button x:Name="DownloadButton"
Margin="6,0,0,0"
Margin="0,0,0,0"
Variant="Primary"
Text="Download"
Click="DownloadButton_OnClick" />
Expand Down
20 changes: 16 additions & 4 deletions WheelWizard/Views/Popups/Generic/MiiRenderingSetupPopup.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public partial class MiiRenderingSetupPopup : PopupContent
private readonly TaskCompletionSource<bool> _completionSource = new();
private CancellationTokenSource? _downloadCancellationTokenSource;
private bool _downloadCompleted;
private bool _skipRequested;

[Inject]
private IMiiRenderingResourceInstaller ResourceInstaller { get; set; } = null!;
Expand All @@ -24,7 +25,7 @@ public MiiRenderingSetupPopup()
{
InitializeComponent();
PathTextBlock.Text = PathManager.MiiRenderingResourceFilePath;
StatusTextBlock.Text = "Download the Mii rendering resource to continue.";
StatusTextBlock.Text = "Download the Mii rendering resource to enable offline 3D Mii rendering.";
ProgressTextBlock.Text = "Ready to install.";
}

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

if (!_downloadCompleted)
SetBusyState(false, "Download the Mii rendering resource to continue.");
SetBusyState(false, "Download the Mii rendering resource to enable offline 3D Mii rendering.");
}
}

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

private void SkipButton_OnClick(object? sender, RoutedEventArgs e)
{
if (_downloadCancellationTokenSource != null)
return;

_skipRequested = true;
_completionSource.TrySetResult(true);
Close();
}

protected override void BeforeClose()
{
_downloadCancellationTokenSource?.Cancel();
_completionSource.TrySetResult(_downloadCompleted);
_completionSource.TrySetResult(_downloadCompleted || _skipRequested);
}

private void SetBusyState(bool busy, string statusText)
{
StatusTextBlock.Text = statusText;
DownloadButton.IsEnabled = !busy;
SkipButton.IsEnabled = !busy;
CloseButton.IsEnabled = true;
CloseButton.Text = busy ? "Close and Exit" : "Close";
}
Expand All @@ -111,7 +123,7 @@ private void ShowError(string message)
{
ErrorTextBlock.Text = message;
ErrorTextBlock.IsVisible = true;
SetBusyState(false, "Download the Mii rendering resource to continue.");
SetBusyState(false, "Download the Mii rendering resource to enable offline 3D Mii rendering.");
}

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