Skip to content

Commit

Permalink
Updated dependencies and updated MessageBox a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
natekford committed Apr 6, 2024
1 parent 673e6fd commit 656fdf5
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 25 deletions.
10 changes: 5 additions & 5 deletions src/SongProcessor.UI/SongProcessor.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.7" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.7" />
<PackageReference Include="Avalonia.Themes.Simple" Version="11.0.7" />
<PackageReference Include="DynamicData" Version="8.3.27" />
<PackageReference Include="Avalonia" Version="11.0.10" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.10" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.10" />
<PackageReference Include="Avalonia.Themes.Simple" Version="11.0.10" />
<PackageReference Include="DynamicData" Version="8.4.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="ReactiveUI.Validation" Version="3.1.7" />
</ItemGroup>
Expand Down
13 changes: 10 additions & 3 deletions src/SongProcessor.UI/ViewModels/SongViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,15 @@ await HostScreen.Router.Navigate.Execute(new EditViewModel(
));
}

private Task ExportFixesAsync()
=> _Processor.ExportFixesAsync(Anime, Directory!);
private async Task ExportFixesAsync()
{
var outputFile = await _Processor.ExportFixesAsync(Anime, Directory!).ConfigureAwait(true);
await _MessageBoxManager.ShowNoResultAsync(new()
{
Text = $"Exported to {outputFile}",
Title = "Exported Fixes",
}).ConfigureAwait(true);
}

private async Task GetVolumeInfoAsync(ObservableAnime anime)
{
Expand Down Expand Up @@ -414,7 +421,7 @@ private async Task LoadAsync()
}
catch (Exception e)
{
await _MessageBoxManager.ShowExceptionAsync(e).ConfigureAwait(false);
await _MessageBoxManager.ShowExceptionAsync(e).ConfigureAwait(true);
}
}

Expand Down
25 changes: 16 additions & 9 deletions src/SongProcessor.UI/Views/MessageBox.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,31 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="SongProcessor.UI.Views.MessageBox"
mc:Ignorable="d" d:DesignWidth="278" d:DesignHeight="133"
Name="MsgBox" FontFamily="Courier New"
Title="{Binding Title}" CanResize="{Binding CanResize}"
Width="{Binding Width}" Height="{Binding Height}">
x:Class="SongProcessor.UI.Views.MessageBox"
Name="Me"
Title="{Binding Title}"
FontFamily="Courier New"
Width="{Binding Width}"
Height="{Binding Height}"
CanResize="{Binding CanResize}">

<Window.KeyBindings>
<KeyBinding Command="{Binding Escape}" Gesture="Escape"
CommandParameter="{Binding ElementName=Me}" />
</Window.KeyBindings>

<Grid RowDefinitions="89*,42">
<Grid Grid.Row="0">
<TextBlock Text="{Binding Text}" TextWrapping="Wrap" VerticalAlignment="Center"
Margin="15,0,15,0" />
<SelectableTextBlock Text="{Binding Text}" TextWrapping="Wrap" VerticalAlignment="Center"
Margin="15,0,15,0" />
</Grid>

<Grid Grid.Row="1" RowDefinitions="9*,23*,10*" ColumnDefinitions="104*,75,7,75,15">
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Options}"
SelectedItem="{Binding CurrentOption}"
IsVisible="{Binding Options, Converter={x:Static ObjectConverters.IsNotNull}}" />
SelectedItem="{Binding CurrentOption}" IsVisible="{Binding HasOptions}" />
<Button Grid.Row="1" Grid.Column="3" Content="{Binding ButtonText}"
Command="{Binding CloseCommand}" CommandParameter="{Binding ElementName=MsgBox}" />
Command="{Binding Ok}" CommandParameter="{Binding ElementName=Me}" />
</Grid>
</Grid>
</Window>
2 changes: 2 additions & 0 deletions src/SongProcessor.UI/Views/MessageBox.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public static Task<T> ShowAsync<T>(
return new MessageBox
{
DataContext = viewModel,
// Focusable otherwise Escape keybind doesn't work
Focusable = true,
}.ShowDialog<T>(window);
}

Expand Down
2 changes: 1 addition & 1 deletion src/SongProcessor/SongProcessor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.57" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.60" />
</ItemGroup>
</Project>
5 changes: 3 additions & 2 deletions src/SongProcessor/Utils/SongUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class SongUtils
{
public const int LOAD_SLOW = 0;

public static Task ExportFixesAsync(
public static async Task<string> ExportFixesAsync(
this ISongProcessor processor,
IEnumerable<IAnime> anime,
string directory,
Expand All @@ -32,7 +32,8 @@ public static Task ExportFixesAsync(
{
var path = Path.Combine(directory, fileName);
var text = processor.CreateFixes(anime);
return File.WriteAllTextAsync(path, text, cancellationToken);
await File.WriteAllTextAsync(path, text, cancellationToken).ConfigureAwait(false);
return path;
}

public static IEnumerable<string> GetFiles(this ISongLoader loader, string directory)
Expand Down
10 changes: 5 additions & 5 deletions tests/SongProcessor.Tests/SongProcessor.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.2.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.2.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 656fdf5

Please sign in to comment.