feat(app): library, jobs, settings, server, welcome and about screens
Local-mode composition root (SQLite index, one JobEngine fed by a single handler registration list), keyset-paged library with thumbnail cache and hover scrub, live job list with throttled updates and the shell job bar, settings with live template validation and encoder self-test, server connection with trust-on-first-use and DPAPI token, first-run welcome, About with update check, and --capture screenshots with synthetic data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
94 files changed
+10130
-374
No files matched your search
@@ -0,0 +1,61 @@
|
||||
using System.Windows;
|
||||
using Titano.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// The login form (BRIEF §12.7). It calls back the connection with the credentials and stays open with the
|
||||
/// error sentence until the sign-in succeeds or the user cancels. The password never leaves the PasswordBox
|
||||
/// except for that call.
|
||||
/// </summary>
|
||||
public sealed partial class LoginDialog : TitanoWindow
|
||||
{
|
||||
private readonly Func<string, string, Task<string?>> _signIn;
|
||||
|
||||
private LoginDialog(string server, string? username, Func<string, string, Task<string?>> signIn)
|
||||
{
|
||||
_signIn = signIn;
|
||||
InitializeComponent();
|
||||
ServerText.Text = server;
|
||||
User.Text = username ?? string.Empty;
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
if (User.Text.Length == 0) User.Focus();
|
||||
else Password.Focus();
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>True when the user signed in.</summary>
|
||||
public static bool Ask(Window? owner, string server, string? username, Func<string, string, Task<string?>> signIn)
|
||||
{
|
||||
var dialog = new LoginDialog(server, username, signIn);
|
||||
if (owner is { IsVisible: true }) dialog.Owner = owner;
|
||||
else dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
return dialog.ShowDialog() == true;
|
||||
}
|
||||
|
||||
private void OnCancel(object sender, RoutedEventArgs e) => DialogResult = false;
|
||||
|
||||
private async void OnSignIn(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SignIn.IsEnabled = false;
|
||||
Error.Visibility = Visibility.Collapsed;
|
||||
try
|
||||
{
|
||||
var error = await _signIn(User.Text, Password.Password);
|
||||
if (error is null)
|
||||
{
|
||||
DialogResult = true;
|
||||
return;
|
||||
}
|
||||
Error.Text = error;
|
||||
Error.Visibility = Visibility.Visible;
|
||||
Password.Clear();
|
||||
Password.Focus();
|
||||
}
|
||||
finally
|
||||
{
|
||||
SignIn.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user