- board: columns in id order, per-column sort via config, column width presets (240/320/480) and custom 160-720 - column header new-card and edit/delete menu; card menu delete and move-to-column - card editor as one unit of work with dirty check and discard confirmation; nested tag picker writes new tags immediately - schema constraint violations mapped to typed exceptions and shown inside the modal - dialog service with owner stack so nested modals center on their parent and get FlowDirection - repository: filtered GetCards, CountCards; view-model tests
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
namespace YKanBan.ViewModels.Dialogs;
|
|
|
|
/// <summary>
|
|
/// Base class for modal dialog view models shown through <see cref="IDialogService"/>.
|
|
/// The dialog decides when it closes: it raises <see cref="CloseRequested"/>
|
|
/// with its result, and a close attempted by the window itself (title-bar close
|
|
/// button, Escape) is routed to <see cref="RequestCancelAsync"/> so that the
|
|
/// dialog can veto it, for example to ask before discarding edits.
|
|
/// </summary>
|
|
public abstract class DialogViewModelBase : ViewModelBase
|
|
{
|
|
/// <summary>
|
|
/// Raised when the dialog wants to close; the argument is the dialog result.
|
|
/// </summary>
|
|
public event EventHandler<bool>? CloseRequested;
|
|
|
|
/// <summary>
|
|
/// Handles a cancel request coming from the window (or a cancel button).
|
|
/// The default closes immediately with a negative result.
|
|
/// </summary>
|
|
/// <returns>A task completing once the request has been handled.</returns>
|
|
public virtual Task RequestCancelAsync()
|
|
{
|
|
Close(false);
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Asks the hosting window to close with the given result.
|
|
/// </summary>
|
|
/// <param name="result">The dialog result.</param>
|
|
protected void Close(bool result) => CloseRequested?.Invoke(this, result);
|
|
}
|