postit: replace inferred status severity with explicit setters
This commit is contained in:
parent
3e37a857c5
commit
37d6551a23
14 changed files with 165 additions and 198 deletions
|
|
@ -30,7 +30,7 @@ namespace PostIt.ViewModels;
|
|||
/// until the Yavsc.Org endpoint exists; the contract there will
|
||||
/// be <c>POST /api/signature/{devisId}</c> with this same payload.
|
||||
/// </summary>
|
||||
public partial class SignaturePageViewModel : ViewModelBase
|
||||
public partial class SignaturePageViewModel : ViewModelBase, IActionStatusViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Default capture surface, in DIPs. 3:1 ratio matches a
|
||||
|
|
@ -43,12 +43,7 @@ public partial class SignaturePageViewModel : ViewModelBase
|
|||
public partial string StatusMessage { get; set; } = "Prêt.";
|
||||
|
||||
[ObservableProperty]
|
||||
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.FromMessage("Prêt.");
|
||||
|
||||
partial void OnStatusMessageChanged(string value)
|
||||
{
|
||||
ActionStatus = StatusNotice.FromMessage(value);
|
||||
}
|
||||
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Prêt.");
|
||||
|
||||
[ObservableProperty]
|
||||
public partial int StrokeCount { get; set; }
|
||||
|
|
@ -115,7 +110,7 @@ public partial class SignaturePageViewModel : ViewModelBase
|
|||
|
||||
private void OnStrokeCompleted(object? sender, SignaturePadData data)
|
||||
{
|
||||
StatusMessage = $"Trait terminé. {data.StrokeCount} trait(s).";
|
||||
this.SetInfoStatus($"Trait terminé. {data.StrokeCount} trait(s).");
|
||||
RefreshCounts();
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +128,7 @@ public partial class SignaturePageViewModel : ViewModelBase
|
|||
public void Clear()
|
||||
{
|
||||
_control?.Clear();
|
||||
StatusMessage = "Effacé.";
|
||||
this.SetInfoStatus("Effacé.");
|
||||
RefreshCounts();
|
||||
}
|
||||
|
||||
|
|
@ -142,14 +137,14 @@ public partial class SignaturePageViewModel : ViewModelBase
|
|||
{
|
||||
if (_control is null)
|
||||
{
|
||||
StatusMessage = "Contrôle non attaché.";
|
||||
this.SetWarningStatus("Contrôle non attaché.");
|
||||
return;
|
||||
}
|
||||
|
||||
var data = _control.Snapshot();
|
||||
if (data.IsEmpty)
|
||||
{
|
||||
StatusMessage = "Rien à capturer.";
|
||||
this.SetWarningStatus("Rien à capturer.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -157,11 +152,11 @@ public partial class SignaturePageViewModel : ViewModelBase
|
|||
{
|
||||
var path = WriteCapture(data);
|
||||
LastCapturedPath = path;
|
||||
StatusMessage = $"Capture enregistrée: {path}";
|
||||
this.SetInfoStatus($"Capture enregistrée: {path}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StatusMessage = $"Erreur: {ex.Message}";
|
||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||
}
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue