Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
One progress card per job, version 1.10.2
KnifeLemon6dbe41b8ce42
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ab737544..06ae3fd3 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,13 @@ version it publishes under "What's Changed" in the GitHub release notes, above tAdd a `## <version>` section before tagging a release. Write what someone using Filee notices: what's new, where tofind it, what it does and doesn't do.+## 1.10.2++### Fixed++- **One progress card per conversion** (issue #60). When a long conversion moved from the ring around the donut to+ the progress card in the bottom-right corner, the card appeared twice.+## 1.10.1### Newdiff --git a/Directory.Build.props b/Directory.Build.propsindex 6774ed52..000a85a6 100644--- a/Directory.Build.props+++ b/Directory.Build.props@@ -14,7 +14,7 @@parameters of a member is fine (CS1573). --><NoWarn>$(NoWarn);CS1591;CS1573</NoWarn>- <Version>1.10.1</Version>+ <Version>1.10.2</Version><Product>Filee</Product><Authors>Filee contributors</Authors><Copyright>Copyright (c) Filee contributors</Copyright>diff --git a/src/Filee.App/Views/ToastWindow.axaml.cs b/src/Filee.App/Views/ToastWindow.axaml.csindex 00c7cb0d..b4f911e6 100644--- a/src/Filee.App/Views/ToastWindow.axaml.cs+++ b/src/Filee.App/Views/ToastWindow.axaml.cs@@ -1,6 +1,7 @@using System.Collections.Specialized;using Avalonia;using Avalonia.Controls;+using Avalonia.Threading;using Filee.App.Services;namespace Filee.App.Views;@@ -17,15 +18,36 @@ public partial class ToastWindow : WindowSizeChanged += (_, _) => PlaceBottomRight();}+ private ConversionService? _service;+ private bool _closed;+protected override void OnDataContextChanged(EventArgs e){base.OnDataContextChanged(e);- if (DataContext is ConversionService service)- service.ToastJobs.CollectionChanged += (_, args) => OnJobsChanged(service, args);+ if (_service is not null)+ _service.ToastJobs.CollectionChanged -= OnJobsChanged;+ _service = DataContext as ConversionService;+ if (_service is not null)+ _service.ToastJobs.CollectionChanged += OnJobsChanged;+ }++ protected override void OnClosed(EventArgs e)+ {+ _closed = true;+ if (_service is not null)+ _service.ToastJobs.CollectionChanged -= OnJobsChanged;+ base.OnClosed(e);}- private void OnJobsChanged(ConversionService service, NotifyCollectionChangedEventArgs e)+ // After the change: showing the window inside CollectionChanged built the list with the new job already in it, and+ // the list then added it again, so one job had two cards (issue #60).+ private void OnJobsChanged(object? sender, NotifyCollectionChangedEventArgs e) =>+ Dispatcher.UIThread.Post(UpdateVisibility);++ private void UpdateVisibility(){+ if (_closed || _service is not { } service)+ return;if (service.ToastJobs.Count > 0 && !IsVisible){Show();diff --git a/tests/Filee.App.Tests/ToastWindowTests.cs b/tests/Filee.App.Tests/ToastWindowTests.csnew file mode 100644index 00000000..72784ad5--- /dev/null+++ b/tests/Filee.App.Tests/ToastWindowTests.cs@@ -0,0 +1,65 @@+// The bottom-right progress cards: one card per job.++using Avalonia.Controls;+using Avalonia.Headless;+using Avalonia.Headless.XUnit;+using Avalonia.Threading;+using Avalonia.VisualTree;+using Filee.App.Services;+using Filee.App.ViewModels;+using Filee.App.Views;+using Filee.Core.Conversion;+using Filee.Core.Localization;+using Filee.Core.Platform;+using Filee.Core.Presets;++namespace Filee.App.Tests;++public class ToastWindowTests+{+ [AvaloniaFact]+ public void A_job_handed_to_the_hidden_toast_gets_one_card()+ {+ // Issue #60: a large file's ring handed its job to the toast, which showed two identical cards.+ TestServices.EnsureInitialized("en");+ var service = AppHost.Get<ConversionService>();+ service.ToastJobs.Clear();+ var toast = new ToastWindow { DataContext = service };+ try+ {+ for (var round = 0; round < 3; round++)+ {+ var job = new JobViewModel(new ConversionJob(["C:/clip.mp4"], new Preset { TargetFormat = "mp4" }, "MP4"),+ AppHost.Get<ILocalizer>(), AppHost.Get<IPlatformServices>(), _ => { });+ service.Jobs.Insert(0, job);+ service.ShowInToast(job);+ Pump();+ Assert.True(toast.IsVisible);+ Assert.Equal(1, Cards(toast));++ service.ToastJobs.Remove(job);+ service.Jobs.Remove(job);+ Pump();+ Assert.False(toast.IsVisible);+ Assert.Equal(0, Cards(toast));+ }+ }+ finally+ {+ service.ToastJobs.Clear();+ toast.Close();+ }+ }++ private static int Cards(ToastWindow toast) =>+ toast.GetVisualDescendants().OfType<ItemsControl>().Single(c => c.Name == "Jobs").ItemsPanelRoot?.Children.Count ?? 0;++ private static void Pump()+ {+ for (var i = 0; i < 10; i++)+ {+ Dispatcher.UIThread.RunJobs();+ AvaloniaHeadlessPlatform.ForceRenderTimerTick();+ }+ }+}