diff --git a/src/Titano.Uploader/DesignTime/SampleData.cs b/src/Titano.Uploader/DesignTime/SampleData.cs
index 3d2d80a3..f432af07 100644
--- a/src/Titano.Uploader/DesignTime/SampleData.cs
+++ b/src/Titano.Uploader/DesignTime/SampleData.cs
@@ -41,13 +41,16 @@ public sealed class SampleData
],
};
- /// A view model over in-memory sample services; settings changes are discarded.
- public MainViewModel CreateViewModel()
+ ///
+ /// A view model over in-memory sample services; settings changes are discarded. stands for
+ /// the sign-in entry (an in-memory one, on, by default).
+ ///
+ public MainViewModel CreateViewModel(IStartupRegistration? startup = null)
{
var memory = new ProcessedFileMemory();
_session.BandwidthLimit = Settings.BandwidthLimit;
_vm = new MainViewModel(new UploaderServices(
- Settings, () => { }, _session, _queue, new SampleEngine(_queue), new SampleStartup(), new UploaderDialogs(),
+ Settings, () => { }, _session, _queue, new SampleEngine(_queue), startup ?? new SampleStartup(), new UploaderDialogs(),
new WatchFolderService(memory, _queue.ContainsPath), memory, string.Empty));
foreach (var w in _vm.WatchFolders) w.IsAvailable = true;
// A disconnected drive: its chip shows the hollow ring and wraps to a second line.
diff --git a/src/Titano.Uploader/Shell/MainViewModel.cs b/src/Titano.Uploader/Shell/MainViewModel.cs
index 8e217c1e..0f66906d 100644
--- a/src/Titano.Uploader/Shell/MainViewModel.cs
+++ b/src/Titano.Uploader/Shell/MainViewModel.cs
@@ -156,7 +156,13 @@ public sealed class MainViewModel : LocalizedViewModel
public bool IsSettingsOpen
{
get => _isSettingsOpen;
- set => Set(ref _isSettingsOpen, value);
+ set
+ {
+ if (!Set(ref _isSettingsOpen, value) || !value) return;
+ // The Uploader runs for the whole session: Task Manager may have turned its sign-in entry off meanwhile.
+ _startWithWindows = _s.Startup.IsEnabled;
+ OnPropertyChanged(nameof(StartWithWindows));
+ }
}
// ---------------- Target ----------------
diff --git a/tests/Titano.App.Tests/Uploader/UploaderScreenSmokeTests.cs b/tests/Titano.App.Tests/Uploader/UploaderScreenSmokeTests.cs
index 19e25822..2dd42775 100644
--- a/tests/Titano.App.Tests/Uploader/UploaderScreenSmokeTests.cs
+++ b/tests/Titano.App.Tests/Uploader/UploaderScreenSmokeTests.cs
@@ -125,6 +125,34 @@ public sealed class UploaderScreenSmokeTests
}
});
+ [Test]
+ public Task StartWithWindowsShowsWhatTaskManagerLeftWhenTheSettingsOpen() => ScreenHost.RunAsync(() =>
+ {
+ UiLanguage.Apply("en");
+ var startup = new SignInEntry { IsEnabled = true };
+ var vm = new SampleData().CreateViewModel(startup);
+ Assert.True(vm.StartWithWindows);
+
+ // The Uploader runs for the whole session: Task Manager turns its entry off meanwhile, and the box follows when
+ // the settings open.
+ startup.IsEnabled = false;
+ var changed = new List();
+ vm.PropertyChanged += (_, e) => changed.Add(e.PropertyName);
+ vm.OpenSettingsCommand.Execute(null);
+ Assert.False(vm.StartWithWindows, "shown as Task Manager left it");
+ Assert.Contains(nameof(MainViewModel.StartWithWindows), changed);
+ vm.CloseSettingsCommand.Execute(null);
+ return Task.CompletedTask;
+ });
+
+ /// A sign-in entry another program (Task Manager) can turn off.
+ private sealed class SignInEntry : Titano.Uploader.Infrastructure.IStartupRegistration
+ {
+ public bool IsEnabled { get; set; }
+
+ public void SetEnabled(bool enabled) => IsEnabled = enabled;
+ }
+
/// A on , shown off screen like --capture.
private sealed class UploaderScreen : IDisposable
{