Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6a358d9f78 |
|||
|
a2e6f4b38c |
|||
|
e881de05aa |
|||
|
e03b979f0b |
|||
|
fe1eb52a55 |
|||
|
c1c060799d |
52 changed files with 374 additions and 218 deletions
22
src/PostIt/PostIt/Controls/StatusBar.axaml
Normal file
22
src/PostIt/PostIt/Controls/StatusBar.axaml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
|
x:Class="PostIt.Controls.StatusBar"
|
||||||
|
x:DataType="vm:StatusNotice">
|
||||||
|
<Border Background="{Binding Background}"
|
||||||
|
BorderBrush="{Binding BorderBrush}"
|
||||||
|
BorderThickness="1"
|
||||||
|
CornerRadius="6"
|
||||||
|
Padding="8">
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
|
<TextBlock Text="{Binding Glyph}"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="{Binding Foreground}"
|
||||||
|
VerticalAlignment="Top"/>
|
||||||
|
<TextBlock Text="{Binding Message}"
|
||||||
|
Foreground="{Binding Foreground}"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
||||||
11
src/PostIt/PostIt/Controls/StatusBar.axaml.cs
Normal file
11
src/PostIt/PostIt/Controls/StatusBar.axaml.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace PostIt.Controls;
|
||||||
|
|
||||||
|
public partial class StatusBar : UserControl
|
||||||
|
{
|
||||||
|
public StatusBar()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
namespace PostIt.ViewModels;
|
||||||
|
|
||||||
|
public interface IActionStatusViewModel
|
||||||
|
{
|
||||||
|
string StatusMessage { get; set; }
|
||||||
|
StatusNotice ActionStatus { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ActionStatusViewModelExtensions
|
||||||
|
{
|
||||||
|
public static void SetInfoStatus(this IActionStatusViewModel viewModel, string message)
|
||||||
|
=> viewModel.SetStatus(message, StatusSeverity.Info);
|
||||||
|
|
||||||
|
public static void SetWarningStatus(this IActionStatusViewModel viewModel, string message)
|
||||||
|
=> viewModel.SetStatus(message, StatusSeverity.Warning);
|
||||||
|
|
||||||
|
public static void SetErrorStatus(this IActionStatusViewModel viewModel, string message)
|
||||||
|
=> viewModel.SetStatus(message, StatusSeverity.Error);
|
||||||
|
|
||||||
|
public static void SetStatus(this IActionStatusViewModel viewModel, string message, StatusSeverity severity)
|
||||||
|
{
|
||||||
|
var normalizedMessage = string.IsNullOrWhiteSpace(message) ? "Pret." : message.Trim();
|
||||||
|
|
||||||
|
viewModel.StatusMessage = normalizedMessage;
|
||||||
|
viewModel.ActionStatus = severity switch
|
||||||
|
{
|
||||||
|
StatusSeverity.Error => StatusNotice.Error(normalizedMessage),
|
||||||
|
StatusSeverity.Warning => StatusNotice.Warning(normalizedMessage),
|
||||||
|
_ => StatusNotice.Info(normalizedMessage),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,7 +13,7 @@ using Yavsc.Api.Client;
|
||||||
|
|
||||||
namespace PostIt.ViewModels;
|
namespace PostIt.ViewModels;
|
||||||
|
|
||||||
public partial class ActivitiesPageViewModel : ViewModelBase
|
public partial class ActivitiesPageViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
private readonly ActivityApiClient _client;
|
private readonly ActivityApiClient _client;
|
||||||
private readonly BillingApiClient _billingClient;
|
private readonly BillingApiClient _billingClient;
|
||||||
|
|
@ -43,6 +43,9 @@ public partial class ActivitiesPageViewModel : ViewModelBase
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = "Choisissez une activité.";
|
public partial string StatusMessage { get; set; } = "Choisissez une activité.";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Choisissez une activité.");
|
||||||
|
|
||||||
public ActivityInfo? CurrentActivity => SelectedSpecialization ?? SelectedActivity;
|
public ActivityInfo? CurrentActivity => SelectedSpecialization ?? SelectedActivity;
|
||||||
public string SelectedActivityLabel => SelectedActivity?.Name ?? "(aucune activité)";
|
public string SelectedActivityLabel => SelectedActivity?.Name ?? "(aucune activité)";
|
||||||
public string CurrentActivityLabel => CurrentActivity?.Name ?? "(aucune)";
|
public string CurrentActivityLabel => CurrentActivity?.Name ?? "(aucune)";
|
||||||
|
|
@ -86,11 +89,11 @@ public partial class ActivitiesPageViewModel : ViewModelBase
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,11 +105,11 @@ public partial class ActivitiesPageViewModel : ViewModelBase
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,7 +126,7 @@ public partial class ActivitiesPageViewModel : ViewModelBase
|
||||||
await ShowActivityAsync(first);
|
await ShowActivityAsync(first);
|
||||||
if (first is null)
|
if (first is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Aucune activité disponible.";
|
this.SetInfoStatus("Aucune activité disponible.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
|
|
@ -131,14 +134,14 @@ public partial class ActivitiesPageViewModel : ViewModelBase
|
||||||
Activities = new ObservableCollection<ActivityInfo>();
|
Activities = new ObservableCollection<ActivityInfo>();
|
||||||
Specializations = new ObservableCollection<ActivityInfo>();
|
Specializations = new ObservableCollection<ActivityInfo>();
|
||||||
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
||||||
StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Activities = new ObservableCollection<ActivityInfo>();
|
Activities = new ObservableCollection<ActivityInfo>();
|
||||||
Specializations = new ObservableCollection<ActivityInfo>();
|
Specializations = new ObservableCollection<ActivityInfo>();
|
||||||
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -230,19 +233,19 @@ public partial class ActivitiesPageViewModel : ViewModelBase
|
||||||
|
|
||||||
Performers = new ObservableCollection<ActivityUserDisplayItem>(items);
|
Performers = new ObservableCollection<ActivityUserDisplayItem>(items);
|
||||||
SelectedPerformer = null;
|
SelectedPerformer = null;
|
||||||
StatusMessage = $"{activity.Name} · {Performers.Count} utilisateur(s)";
|
this.SetInfoStatus($"{activity.Name} · {Performers.Count} utilisateur(s)");
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
||||||
SelectedPerformer = null;
|
SelectedPerformer = null;
|
||||||
StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
||||||
SelectedPerformer = null;
|
SelectedPerformer = null;
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -259,7 +262,7 @@ public partial class ActivitiesPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (SelectedPerformer is null || CurrentActivity is null)
|
if (SelectedPerformer is null || CurrentActivity is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez un utilisateur et une activité avec formulaire.";
|
this.SetWarningStatus("Sélectionnez un utilisateur et une activité avec formulaire.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace PostIt.ViewModels;
|
||||||
/// <c>CirclesPage</c> then calls
|
/// <c>CirclesPage</c> then calls
|
||||||
/// <see cref="CircleApiClient.AddMemberAsync"/>.</para>
|
/// <see cref="CircleApiClient.AddMemberAsync"/>.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class AddCircleMemberDialogViewModel : ViewModelBase
|
public partial class AddCircleMemberDialogViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
private readonly IUserDirectory _directory;
|
private readonly IUserDirectory _directory;
|
||||||
|
|
||||||
|
|
@ -46,7 +46,10 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase
|
||||||
public partial bool IsBusy { get; set; }
|
public partial bool IsBusy { get; set; }
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = string.Empty;
|
public partial string StatusMessage { get; set; } = "Pret.";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised when the user confirms a selection. The hosting
|
/// Raised when the user confirms a selection. The hosting
|
||||||
|
|
@ -79,7 +82,7 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase
|
||||||
if (string.IsNullOrWhiteSpace(SearchQuery))
|
if (string.IsNullOrWhiteSpace(SearchQuery))
|
||||||
{
|
{
|
||||||
Results.Clear();
|
Results.Clear();
|
||||||
StatusMessage = "Tapez un nom ou un email";
|
this.SetWarningStatus("Tapez un nom ou un email");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,11 +91,11 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
var hits = await _directory.SearchAsync(SearchQuery, CancellationToken.None).ConfigureAwait(true);
|
var hits = await _directory.SearchAsync(SearchQuery, CancellationToken.None).ConfigureAwait(true);
|
||||||
Results = new ObservableCollection<UserSummary>(hits ?? Array.Empty<UserSummary>());
|
Results = new ObservableCollection<UserSummary>(hits ?? Array.Empty<UserSummary>());
|
||||||
StatusMessage = $"{Results.Count} résultat(s)";
|
this.SetInfoStatus($"{Results.Count} résultat(s)");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -110,18 +113,20 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (Selected is null)
|
if (Selected is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez un utilisateur";
|
this.SetWarningStatus("Sélectionnez un utilisateur");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Confirmed?.Invoke(this, Selected);
|
Confirmed?.Invoke(this, Selected);
|
||||||
var app = App.Current as App;
|
var app = App.Current as App
|
||||||
|
?? throw new InvalidOperationException("Application PostIt indisponible.");
|
||||||
await app.GoBackAsync();
|
await app.GoBackAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
public async Task CloseAsync()
|
public async Task CloseAsync()
|
||||||
{
|
{
|
||||||
var app = App.Current as App;
|
var app = App.Current as App
|
||||||
|
?? throw new InvalidOperationException("Application PostIt indisponible.");
|
||||||
await app.GoBackAsync();
|
await app.GoBackAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ using Yavsc.Abstract.Workflow;
|
||||||
|
|
||||||
namespace PostIt.ViewModels;
|
namespace PostIt.ViewModels;
|
||||||
|
|
||||||
public partial class BillingQueriesPageViewModel : ViewModelBase
|
public partial class BillingQueriesPageViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
private readonly BillingApiClient _billingClient;
|
private readonly BillingApiClient _billingClient;
|
||||||
|
|
||||||
|
|
@ -36,6 +36,9 @@ public partial class BillingQueriesPageViewModel : ViewModelBase
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = "Chargement des commandes...";
|
public partial string StatusMessage { get; set; } = "Chargement des commandes...";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Chargement des commandes...");
|
||||||
|
|
||||||
public string Title => IsReadOnly
|
public string Title => IsReadOnly
|
||||||
? $"Demandes en cours ({Form.Title})"
|
? $"Demandes en cours ({Form.Title})"
|
||||||
: $"Commandes {Form.Title}";
|
: $"Commandes {Form.Title}";
|
||||||
|
|
@ -90,17 +93,17 @@ public partial class BillingQueriesPageViewModel : ViewModelBase
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Queries = new ObservableCollection<BillingQueryDisplayItem>(filtered);
|
Queries = new ObservableCollection<BillingQueryDisplayItem>(filtered);
|
||||||
StatusMessage = BuildLoadedStatusMessage(filtered.Count);
|
this.SetInfoStatus(BuildLoadedStatusMessage(filtered.Count));
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
Queries = new ObservableCollection<BillingQueryDisplayItem>();
|
Queries = new ObservableCollection<BillingQueryDisplayItem>();
|
||||||
StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Queries = new ObservableCollection<BillingQueryDisplayItem>();
|
Queries = new ObservableCollection<BillingQueryDisplayItem>();
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -113,13 +116,13 @@ public partial class BillingQueriesPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (IsReadOnly)
|
if (IsReadOnly)
|
||||||
{
|
{
|
||||||
StatusMessage = "Mode lecture seule: l'ouverture en modification est désactivée.";
|
this.SetWarningStatus("Mode lecture seule: l'ouverture en modification est désactivée.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedQuery is null)
|
if (SelectedQuery is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez une commande.";
|
this.SetWarningStatus("Sélectionnez une commande.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,11 +142,11 @@ public partial class BillingQueriesPageViewModel : ViewModelBase
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur lors de l'ouverture: {ex.Message}";
|
this.SetErrorStatus($"Erreur lors de l'ouverture: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace PostIt.ViewModels;
|
||||||
/// <see cref="OnAddMemberConfirmedAsync"/>. The "remove"
|
/// <see cref="OnAddMemberConfirmedAsync"/>. The "remove"
|
||||||
/// command is per-row and runs inline.</para>
|
/// command is per-row and runs inline.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class CirclesPageViewModel : ViewModelBase
|
public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
private readonly CircleApiClient _client;
|
private readonly CircleApiClient _client;
|
||||||
|
|
||||||
|
|
@ -63,8 +63,10 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
public partial bool IsBusy { get; set; }
|
public partial bool IsBusy { get; set; }
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = string.Empty;
|
public partial string StatusMessage { get; set; } = "Pret.";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
||||||
|
|
||||||
public CirclesPageViewModel(CircleApiClient client)
|
public CirclesPageViewModel(CircleApiClient client)
|
||||||
{
|
{
|
||||||
|
|
@ -100,11 +102,11 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
var list = await _client.GetMyCirclesAsync();
|
var list = await _client.GetMyCirclesAsync();
|
||||||
Circles = new ObservableCollection<CircleDto>(list ?? new());
|
Circles = new ObservableCollection<CircleDto>(list ?? new());
|
||||||
StatusMessage = $"{Circles.Count} cercle(s)";
|
this.SetInfoStatus($"{Circles.Count} cercle(s)");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -115,8 +117,10 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
internal async Task OpenAddMemberAsync()
|
internal async Task OpenAddMemberAsync()
|
||||||
{
|
{
|
||||||
var app = Application.Current as App;
|
var app = Application.Current as App
|
||||||
var services = app?.ServiceProvider;
|
?? throw new InvalidOperationException("Application PostIt indisponible.");
|
||||||
|
var services = app.ServiceProvider
|
||||||
|
?? throw new InvalidOperationException("ServiceProvider PostIt indisponible.");
|
||||||
var directory = services.GetRequiredService<IUserDirectory>();
|
var directory = services.GetRequiredService<IUserDirectory>();
|
||||||
AddCircleMemberDialogViewModel model =
|
AddCircleMemberDialogViewModel model =
|
||||||
new AddCircleMemberDialogViewModel(directory);
|
new AddCircleMemberDialogViewModel(directory);
|
||||||
|
|
@ -147,11 +151,11 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
var list = await _client.GetMembersAsync(circleId);
|
var list = await _client.GetMembersAsync(circleId);
|
||||||
Members = new ObservableCollection<CircleMemberDto>(list ?? new());
|
Members = new ObservableCollection<CircleMemberDto>(list ?? new());
|
||||||
StatusMessage = $"{Members.Count} membre(s)";
|
this.SetInfoStatus($"{Members.Count} membre(s)");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
Members = new ObservableCollection<CircleMemberDto>();
|
Members = new ObservableCollection<CircleMemberDto>();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
@ -166,7 +170,7 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
SelectedCircle = null;
|
SelectedCircle = null;
|
||||||
DraftName = string.Empty;
|
DraftName = string.Empty;
|
||||||
DraftPublic = false;
|
DraftPublic = false;
|
||||||
StatusMessage = "Nouveau cercle";
|
this.SetInfoStatus("Nouveau cercle");
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
|
|
@ -176,7 +180,7 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
SelectedCircle = circle;
|
SelectedCircle = circle;
|
||||||
DraftName = circle.Name;
|
DraftName = circle.Name;
|
||||||
DraftPublic = circle.Public;
|
DraftPublic = circle.Public;
|
||||||
StatusMessage = $"Édition de « {circle.Name} »";
|
this.SetInfoStatus($"Édition de « {circle.Name} »");
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
|
|
@ -184,7 +188,7 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(DraftName))
|
if (string.IsNullOrWhiteSpace(DraftName))
|
||||||
{
|
{
|
||||||
StatusMessage = "Le nom est obligatoire";
|
this.SetWarningStatus("Le nom est obligatoire");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,22 +202,22 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
Name = DraftName.Trim(),
|
Name = DraftName.Trim(),
|
||||||
Public = DraftPublic,
|
Public = DraftPublic,
|
||||||
});
|
});
|
||||||
StatusMessage = created is null
|
this.SetStatus(
|
||||||
? "Création échouée"
|
created is null ? "Création échouée" : $"Cercle « {created.Name} » créé",
|
||||||
: $"Cercle « {created.Name} » créé";
|
created is null ? StatusSeverity.Warning : StatusSeverity.Info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SelectedCircle.Name = DraftName.Trim();
|
SelectedCircle.Name = DraftName.Trim();
|
||||||
SelectedCircle.Public = DraftPublic;
|
SelectedCircle.Public = DraftPublic;
|
||||||
await _client.UpdateCircleAsync(SelectedCircle.Id, SelectedCircle);
|
await _client.UpdateCircleAsync(SelectedCircle.Id, SelectedCircle);
|
||||||
StatusMessage = $"Cercle « {SelectedCircle.Name} » mis à jour";
|
this.SetInfoStatus($"Cercle « {SelectedCircle.Name} » mis à jour");
|
||||||
}
|
}
|
||||||
await RefreshAsync();
|
await RefreshAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -229,7 +233,7 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _client.DeleteCircleAsync(circle.Id);
|
await _client.DeleteCircleAsync(circle.Id);
|
||||||
StatusMessage = $"Cercle « {circle.Name} » supprimé";
|
this.SetInfoStatus($"Cercle « {circle.Name} » supprimé");
|
||||||
// If the deleted circle was the selected one,
|
// If the deleted circle was the selected one,
|
||||||
// clear the selection so the Members view goes
|
// clear the selection so the Members view goes
|
||||||
// empty too (the partial setter on
|
// empty too (the partial setter on
|
||||||
|
|
@ -240,7 +244,7 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -261,7 +265,7 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _client.AddMemberAsync(SelectedCircle.Id, picked.Id);
|
await _client.AddMemberAsync(SelectedCircle.Id, picked.Id);
|
||||||
StatusMessage = $"« {picked.DisplayName} » ajouté au cercle";
|
this.SetInfoStatus($"« {picked.DisplayName} » ajouté au cercle");
|
||||||
await LoadMembersAsync(SelectedCircle.Id);
|
await LoadMembersAsync(SelectedCircle.Id);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -276,7 +280,7 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
var msg = ex.Message.Contains("409") || ex.Message.Contains("Conflict")
|
var msg = ex.Message.Contains("409") || ex.Message.Contains("Conflict")
|
||||||
? "Déjà membre du cercle"
|
? "Déjà membre du cercle"
|
||||||
: $"Erreur: {ex.Message}";
|
: $"Erreur: {ex.Message}";
|
||||||
StatusMessage = msg;
|
this.SetStatus(msg, msg == "Déjà membre du cercle" ? StatusSeverity.Warning : StatusSeverity.Error);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -297,11 +301,11 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
await _client.RemoveMemberAsync(SelectedCircle.Id, member.Id);
|
await _client.RemoveMemberAsync(SelectedCircle.Id, member.Id);
|
||||||
Members.Remove(member);
|
Members.Remove(member);
|
||||||
StatusMessage = $"« {member.UserName} » retiré du cercle";
|
this.SetInfoStatus($"« {member.UserName} » retiré du cercle");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ using Yavsc.Api.Client;
|
||||||
|
|
||||||
namespace PostIt.ViewModels;
|
namespace PostIt.ViewModels;
|
||||||
|
|
||||||
public partial class CommandFormsPageViewModel : ViewModelBase
|
public partial class CommandFormsPageViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
private readonly BillingApiClient _billingClient;
|
private readonly BillingApiClient _billingClient;
|
||||||
|
|
||||||
|
|
@ -25,7 +25,10 @@ public partial class CommandFormsPageViewModel : ViewModelBase
|
||||||
public partial CommandFormSummary? SelectedForm { get; set; }
|
public partial CommandFormSummary? SelectedForm { get; set; }
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; }
|
public partial string StatusMessage { get; set; } = "Pret.";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
||||||
|
|
||||||
public string Title => $"Formulaires pour {Performer.UserName}";
|
public string Title => $"Formulaires pour {Performer.UserName}";
|
||||||
public string ContextLabel => $"{Activity.Name} · {Forms.Count} formulaire(s)";
|
public string ContextLabel => $"{Activity.Name} · {Forms.Count} formulaire(s)";
|
||||||
|
|
@ -55,9 +58,11 @@ public partial class CommandFormsPageViewModel : ViewModelBase
|
||||||
.OrderBy(f => f.Title)
|
.OrderBy(f => f.Title)
|
||||||
.ThenBy(f => f.ActionName));
|
.ThenBy(f => f.ActionName));
|
||||||
SelectedForm = Forms.FirstOrDefault();
|
SelectedForm = Forms.FirstOrDefault();
|
||||||
StatusMessage = Forms.Count == 0
|
this.SetStatus(
|
||||||
|
Forms.Count == 0
|
||||||
? "Aucun formulaire n'est disponible pour cette activité."
|
? "Aucun formulaire n'est disponible pour cette activité."
|
||||||
: "Choisissez le formulaire à utiliser.";
|
: "Choisissez le formulaire à utiliser.",
|
||||||
|
Forms.Count == 0 ? StatusSeverity.Warning : StatusSeverity.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanOpenSelectedForm() => SelectedForm is not null;
|
private bool CanOpenSelectedForm() => SelectedForm is not null;
|
||||||
|
|
@ -71,7 +76,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (SelectedForm is null)
|
if (SelectedForm is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez un formulaire.";
|
this.SetWarningStatus("Sélectionnez un formulaire.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,7 +97,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (SelectedForm is null)
|
if (SelectedForm is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez un formulaire.";
|
this.SetWarningStatus("Sélectionnez un formulaire.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,7 +117,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (SelectedForm is null)
|
if (SelectedForm is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez un formulaire.";
|
this.SetWarningStatus("Sélectionnez un formulaire.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ using Yavsc.Models.Billing;
|
||||||
|
|
||||||
namespace PostIt.ViewModels;
|
namespace PostIt.ViewModels;
|
||||||
|
|
||||||
public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase
|
public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
protected readonly BillingApiClient _billingClient;
|
protected readonly BillingApiClient _billingClient;
|
||||||
|
|
||||||
|
|
@ -21,7 +21,10 @@ public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase
|
||||||
public partial bool IsBusy { get; set; }
|
public partial bool IsBusy { get; set; }
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; }
|
public partial string StatusMessage { get; set; } = "Pret.";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string Reason { get; set; } = string.Empty;
|
public partial string Reason { get; set; } = string.Empty;
|
||||||
|
|
@ -75,7 +78,7 @@ public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase
|
||||||
Form = form ?? throw new ArgumentNullException(nameof(form));
|
Form = form ?? throw new ArgumentNullException(nameof(form));
|
||||||
_billingClient = billingClient ?? throw new ArgumentNullException(nameof(billingClient));
|
_billingClient = billingClient ?? throw new ArgumentNullException(nameof(billingClient));
|
||||||
|
|
||||||
StatusMessage = SupportMessage;
|
this.SetInfoStatus(SupportMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnExistingQueryIdChanged(long? value)
|
partial void OnExistingQueryIdChanged(long? value)
|
||||||
|
|
|
||||||
|
|
@ -58,18 +58,20 @@ public partial class BrushViewModel : RdvViewModel
|
||||||
SelectedPrestation = AvailablePrestations.FirstOrDefault();
|
SelectedPrestation = AvailablePrestations.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMessage = AvailablePrestations.Count == 0
|
this.SetStatus(
|
||||||
|
AvailablePrestations.Count == 0
|
||||||
? "Aucune prestation coiffure disponible."
|
? "Aucune prestation coiffure disponible."
|
||||||
: SupportMessage;
|
: SupportMessage,
|
||||||
|
AvailablePrestations.Count == 0 ? StatusSeverity.Warning : StatusSeverity.Info);
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
StatusMessage = "Accès refusé au catalogue de prestations (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé au catalogue de prestations (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur lors du chargement des prestations: {ex.Message}";
|
this.SetErrorStatus($"Erreur lors du chargement des prestations: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -81,19 +83,19 @@ public partial class BrushViewModel : RdvViewModel
|
||||||
{
|
{
|
||||||
if (!Consent)
|
if (!Consent)
|
||||||
{
|
{
|
||||||
StatusMessage = "Le consentement est requis pour poster la commande.";
|
this.SetWarningStatus("Le consentement est requis pour poster la commande.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Address))
|
if (string.IsNullOrWhiteSpace(Address))
|
||||||
{
|
{
|
||||||
StatusMessage = "L'adresse du rendez-vous est requise.";
|
this.SetWarningStatus("L'adresse du rendez-vous est requise.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedPrestation is null)
|
if (SelectedPrestation is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez une prestation coiffure.";
|
this.SetWarningStatus("Sélectionnez une prestation coiffure.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,18 +145,18 @@ public partial class BrushViewModel : RdvViewModel
|
||||||
}).ConfigureAwait(true);
|
}).ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMessage = IsEditingExisting
|
this.SetInfoStatus(IsEditingExisting
|
||||||
? $"Commande #{ExistingQueryId} mise à jour sur {BillingRoute} pour {Performer.UserName}."
|
? $"Commande #{ExistingQueryId} mise à jour sur {BillingRoute} pour {Performer.UserName}."
|
||||||
: $"Commande transmise sur {BillingRoute} pour {Performer.UserName}.";
|
: $"Commande transmise sur {BillingRoute} pour {Performer.UserName}.");
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur lors de l'envoi de la commande: {ex.Message}";
|
this.SetErrorStatus($"Erreur lors de l'envoi de la commande: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -49,20 +49,20 @@ public partial class MBrushViewModel : BrushViewModel
|
||||||
{
|
{
|
||||||
if (!Consent)
|
if (!Consent)
|
||||||
{
|
{
|
||||||
StatusMessage = "Le consentement est requis pour poster la commande.";
|
this.SetWarningStatus("Le consentement est requis pour poster la commande.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Address))
|
if (string.IsNullOrWhiteSpace(Address))
|
||||||
{
|
{
|
||||||
StatusMessage = "L'adresse du rendez-vous est requise.";
|
this.SetWarningStatus("L'adresse du rendez-vous est requise.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var selectedPrestations = MultiPrestations.Where(x => x.IsSelected).ToList();
|
var selectedPrestations = MultiPrestations.Where(x => x.IsSelected).ToList();
|
||||||
if (selectedPrestations.Count == 0)
|
if (selectedPrestations.Count == 0)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez au moins une prestation coiffure.";
|
this.SetWarningStatus("Sélectionnez au moins une prestation coiffure.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,18 +109,18 @@ public partial class MBrushViewModel : BrushViewModel
|
||||||
}).ConfigureAwait(true);
|
}).ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMessage = IsEditingExisting
|
this.SetInfoStatus(IsEditingExisting
|
||||||
? $"Commande #{ExistingQueryId} mise à jour sur {BillingRoute} pour {Performer.UserName}."
|
? $"Commande #{ExistingQueryId} mise à jour sur {BillingRoute} pour {Performer.UserName}."
|
||||||
: $"Commande transmise sur {BillingRoute} pour {Performer.UserName}.";
|
: $"Commande transmise sur {BillingRoute} pour {Performer.UserName}.");
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex)
|
catch (HttpRequestException ex)
|
||||||
when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur lors de l'envoi de la commande: {ex.Message}";
|
this.SetErrorStatus($"Erreur lors de l'envoi de la commande: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public partial class RdvViewModel : BillingCommandPageViewModel
|
||||||
Longitude = existingQuery.Location.Longitude;
|
Longitude = existingQuery.Location.Longitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMessage = $"Commande #{existingQuery.Id} chargée.";
|
this.SetInfoStatus($"Commande #{existingQuery.Id} chargée.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand(CanExecute = nameof(CanUseCurrentLocation))]
|
[RelayCommand(CanExecute = nameof(CanUseCurrentLocation))]
|
||||||
|
|
@ -71,23 +71,23 @@ public partial class RdvViewModel : BillingCommandPageViewModel
|
||||||
var result = await Platform.TryGetCurrentLocationAsync(default).ConfigureAwait(true);
|
var result = await Platform.TryGetCurrentLocationAsync(default).ConfigureAwait(true);
|
||||||
if (!result.IsSuccess || !result.Latitude.HasValue || !result.Longitude.HasValue)
|
if (!result.IsSuccess || !result.Latitude.HasValue || !result.Longitude.HasValue)
|
||||||
{
|
{
|
||||||
StatusMessage = result.Message;
|
this.SetWarningStatus(result.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Latitude = result.Latitude.Value;
|
Latitude = result.Latitude.Value;
|
||||||
Longitude = result.Longitude.Value;
|
Longitude = result.Longitude.Value;
|
||||||
StatusMessage = string.IsNullOrWhiteSpace(Address)
|
this.SetInfoStatus(string.IsNullOrWhiteSpace(Address)
|
||||||
? "Position récupérée. Complétez l'adresse puis envoyez la commande."
|
? "Position récupérée. Complétez l'adresse puis envoyez la commande."
|
||||||
: result.Message;
|
: result.Message);
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
StatusMessage = "La récupération de la position a été annulée.";
|
this.SetWarningStatus("La récupération de la position a été annulée.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Impossible de récupérer la position: {ex.Message}";
|
this.SetErrorStatus($"Impossible de récupérer la position: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -118,26 +118,26 @@ public partial class RdvViewModel : BillingCommandPageViewModel
|
||||||
{
|
{
|
||||||
if (!IsSupported)
|
if (!IsSupported)
|
||||||
{
|
{
|
||||||
StatusMessage = SupportMessage;
|
this.SetWarningStatus(SupportMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Consent)
|
if (!Consent)
|
||||||
{
|
{
|
||||||
StatusMessage = "Le consentement est requis pour poster la commande.";
|
this.SetWarningStatus("Le consentement est requis pour poster la commande.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Address))
|
if (string.IsNullOrWhiteSpace(Address))
|
||||||
{
|
{
|
||||||
StatusMessage = "L'adresse du rendez-vous est requise.";
|
this.SetWarningStatus("L'adresse du rendez-vous est requise.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Reason))
|
if (string.IsNullOrWhiteSpace(Reason))
|
||||||
{
|
{
|
||||||
StatusMessage = "Le motif du rendez-vous est requis.";
|
this.SetWarningStatus("Le motif du rendez-vous est requis.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,17 +186,17 @@ public partial class RdvViewModel : BillingCommandPageViewModel
|
||||||
}).ConfigureAwait(true);
|
}).ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMessage = IsEditingExisting
|
this.SetInfoStatus(IsEditingExisting
|
||||||
? $"Commande #{ExistingQueryId} mise à jour sur {BillingRoute} pour {Performer.UserName}."
|
? $"Commande #{ExistingQueryId} mise à jour sur {BillingRoute} pour {Performer.UserName}."
|
||||||
: $"Commande transmise sur {BillingRoute} pour {Performer.UserName}.";
|
: $"Commande transmise sur {BillingRoute} pour {Performer.UserName}.");
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.";
|
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur lors de l'envoi: {ex.Message}";
|
this.SetErrorStatus($"Erreur lors de l'envoi: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ using PostIt.Helpers;
|
||||||
|
|
||||||
namespace PostIt.ViewModels;
|
namespace PostIt.ViewModels;
|
||||||
|
|
||||||
public partial class MainViewModel : ViewModelBase
|
public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
/// <summary>Window/tab title. Cosmetic — bound by
|
/// <summary>Window/tab title. Cosmetic — bound by
|
||||||
/// <c>MainPage.axaml</c> if at all. Not the post title.</summary>
|
/// <c>MainPage.axaml</c> if at all. Not the post title.</summary>
|
||||||
|
|
@ -54,6 +54,9 @@ public partial class MainViewModel : ViewModelBase
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; }
|
public partial string StatusMessage { get; set; }
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string SearchText { get; set; }
|
public partial string SearchText { get; set; }
|
||||||
|
|
||||||
|
|
@ -84,7 +87,7 @@ public partial class MainViewModel : ViewModelBase
|
||||||
Posts.Add(post);
|
Posts.Add(post);
|
||||||
}
|
}
|
||||||
ApplyFilter();
|
ApplyFilter();
|
||||||
StatusMessage = $"Loaded {Posts.Count} posts.";
|
this.SetInfoStatus($"{Posts.Count} billet(s) chargé(s).");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,7 +107,7 @@ public partial class MainViewModel : ViewModelBase
|
||||||
// than to send a request the server will reject.
|
// than to send a request the server will reject.
|
||||||
if (string.IsNullOrWhiteSpace(DraftTitle))
|
if (string.IsNullOrWhiteSpace(DraftTitle))
|
||||||
{
|
{
|
||||||
StatusMessage = "Title is required.";
|
this.SetWarningStatus("Le titre est obligatoire.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,7 +137,7 @@ public partial class MainViewModel : ViewModelBase
|
||||||
if (created is not null)
|
if (created is not null)
|
||||||
{
|
{
|
||||||
SelectedPost = created;
|
SelectedPost = created;
|
||||||
StatusMessage = $"Created post {created.Id}.";
|
this.SetInfoStatus($"Billet {created.Id} créé.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -150,7 +153,7 @@ public partial class MainViewModel : ViewModelBase
|
||||||
DateModified = DateTime.UtcNow,
|
DateModified = DateTime.UtcNow,
|
||||||
};
|
};
|
||||||
await BlogClient!.UpdatePostAsync(SelectedPost.Id, update);
|
await BlogClient!.UpdatePostAsync(SelectedPost.Id, update);
|
||||||
StatusMessage = $"Saved post {SelectedPost.Id}.";
|
this.SetInfoStatus($"Billet {SelectedPost.Id} enregistré.");
|
||||||
}
|
}
|
||||||
|
|
||||||
await RefreshPostsAsync();
|
await RefreshPostsAsync();
|
||||||
|
|
@ -162,14 +165,14 @@ public partial class MainViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (SelectedPost is null || SelectedPost.Id == 0)
|
if (SelectedPost is null || SelectedPost.Id == 0)
|
||||||
{
|
{
|
||||||
StatusMessage = "Select an existing post before deleting.";
|
this.SetWarningStatus("Sélectionnez un billet existant avant suppression.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ExecuteAsync(async () =>
|
await ExecuteAsync(async () =>
|
||||||
{
|
{
|
||||||
await BlogClient!.DeletePostAsync(SelectedPost.Id);
|
await BlogClient!.DeletePostAsync(SelectedPost.Id);
|
||||||
StatusMessage = $"Deleted post {SelectedPost.Id}.";
|
this.SetInfoStatus($"Billet {SelectedPost.Id} supprimé.");
|
||||||
SelectedPost = null;
|
SelectedPost = null;
|
||||||
await RefreshPostsAsync();
|
await RefreshPostsAsync();
|
||||||
});
|
});
|
||||||
|
|
@ -194,7 +197,7 @@ public partial class MainViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (SelectedPost is null || SelectedPost.Id == 0)
|
if (SelectedPost is null || SelectedPost.Id == 0)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez un billet existant pour changer sa publication.";
|
this.SetWarningStatus("Sélectionnez un billet existant pour changer sa publication.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,9 +214,9 @@ public partial class MainViewModel : ViewModelBase
|
||||||
// locally flipped state until the round-trip
|
// locally flipped state until the round-trip
|
||||||
// re-hydrates it.
|
// re-hydrates it.
|
||||||
SelectedPost.IsPublished = publish;
|
SelectedPost.IsPublished = publish;
|
||||||
StatusMessage = publish
|
this.SetInfoStatus(publish
|
||||||
? $"Billet {SelectedPost.Id} publié."
|
? $"Billet {SelectedPost.Id} publié."
|
||||||
: $"Billet {SelectedPost.Id} remis en brouillon.";
|
: $"Billet {SelectedPost.Id} remis en brouillon.");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,7 +250,7 @@ public partial class MainViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (SelectedPost is null)
|
if (SelectedPost is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Select an existing post before managing ACL.";
|
this.SetWarningStatus("Sélectionnez un billet existant avant de gérer l'ACL.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -346,7 +349,7 @@ public partial class MainViewModel : ViewModelBase
|
||||||
FilteredPosts = new ObservableCollection<BlogPostDto>();
|
FilteredPosts = new ObservableCollection<BlogPostDto>();
|
||||||
SelectedPost = null;
|
SelectedPost = null;
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
StatusMessage = "Ready";
|
this.SetInfoStatus("Prêt.");
|
||||||
Settings = settings ?? new Settings();
|
Settings = settings ?? new Settings();
|
||||||
SearchText = Settings.SearchText;
|
SearchText = Settings.SearchText;
|
||||||
WindowTitle = "PostIt";
|
WindowTitle = "PostIt";
|
||||||
|
|
@ -476,12 +479,12 @@ public partial class MainViewModel : ViewModelBase
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IsBusy = true;
|
IsBusy = true;
|
||||||
StatusMessage = "Working...";
|
this.SetInfoStatus("Traitement en cours...");
|
||||||
await action();
|
await action();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Error: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ public sealed class PostAclEntry
|
||||||
/// any 403 / 404 will surface as an exception caught by the
|
/// any 403 / 404 will surface as an exception caught by the
|
||||||
/// command and routed to <see cref="StatusMessage"/>.</para>
|
/// command and routed to <see cref="StatusMessage"/>.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class PostAclDialogViewModel : ViewModelBase
|
public partial class PostAclDialogViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
private readonly BlogAclApiClient _aclClient;
|
private readonly BlogAclApiClient _aclClient;
|
||||||
private readonly CircleApiClient _circleClient;
|
private readonly CircleApiClient _circleClient;
|
||||||
|
|
@ -61,7 +61,10 @@ public partial class PostAclDialogViewModel : ViewModelBase
|
||||||
public partial bool IsBusy { get; set; }
|
public partial bool IsBusy { get; set; }
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = string.Empty;
|
public partial string StatusMessage { get; set; } = "Pret.";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Idempotency gate for <see cref="LoadAsync"/>: the dialog
|
/// Idempotency gate for <see cref="LoadAsync"/>: the dialog
|
||||||
|
|
@ -115,12 +118,12 @@ public partial class PostAclDialogViewModel : ViewModelBase
|
||||||
AclEntries = new ObservableCollection<PostAclEntry>(AclEntries.Select(a => ToAclEntry(a.CircleId)));
|
AclEntries = new ObservableCollection<PostAclEntry>(AclEntries.Select(a => ToAclEntry(a.CircleId)));
|
||||||
|
|
||||||
|
|
||||||
StatusMessage = $"{AclEntries.Count} autorisation(s)";
|
this.SetInfoStatus($"{AclEntries.Count} autorisation(s)");
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -133,7 +136,7 @@ public partial class PostAclDialogViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (SelectedCircleToAdd is null)
|
if (SelectedCircleToAdd is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Sélectionnez un cercle à ajouter";
|
this.SetWarningStatus("Sélectionnez un cercle à ajouter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,7 +145,7 @@ public partial class PostAclDialogViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (AclEntries.Any(a => a.CircleId == SelectedCircleToAdd.Id))
|
if (AclEntries.Any(a => a.CircleId == SelectedCircleToAdd.Id))
|
||||||
{
|
{
|
||||||
StatusMessage = $"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé";
|
this.SetWarningStatus($"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,11 +157,11 @@ public partial class PostAclDialogViewModel : ViewModelBase
|
||||||
if (created is not null)
|
if (created is not null)
|
||||||
{
|
{
|
||||||
AclEntries.Add(ToAclEntry(created.CircleId));
|
AclEntries.Add(ToAclEntry(created.CircleId));
|
||||||
StatusMessage = $"Cercle « {SelectedCircleToAdd.Name} » autorisé";
|
this.SetInfoStatus($"Cercle « {SelectedCircleToAdd.Name} » autorisé");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StatusMessage = "Autorisation refusée par le serveur";
|
this.SetWarningStatus("Autorisation refusée par le serveur");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.Conflict)
|
catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.Conflict)
|
||||||
|
|
@ -166,11 +169,11 @@ public partial class PostAclDialogViewModel : ViewModelBase
|
||||||
// Conflict means the link already exists in backend. Resync
|
// Conflict means the link already exists in backend. Resync
|
||||||
// from the dedicated ACL API so the UI reflects server truth.
|
// from the dedicated ACL API so the UI reflects server truth.
|
||||||
await ReloadAclEntriesFromServerAsync();
|
await ReloadAclEntriesFromServerAsync();
|
||||||
StatusMessage = $"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé";
|
this.SetWarningStatus($"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -189,11 +192,11 @@ public partial class PostAclDialogViewModel : ViewModelBase
|
||||||
var existing = AclEntries.FirstOrDefault(e => e.CircleId == acl.CircleId);
|
var existing = AclEntries.FirstOrDefault(e => e.CircleId == acl.CircleId);
|
||||||
if (existing is not null)
|
if (existing is not null)
|
||||||
AclEntries.Remove(existing);
|
AclEntries.Remove(existing);
|
||||||
StatusMessage = "Autorisation révoquée";
|
this.SetInfoStatus("Autorisation révoquée");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,19 @@ public partial class Settings : ViewModelBase
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string SearchText { get; set; } = string.Empty;
|
public partial string SearchText { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
||||||
|
|
||||||
|
public void SetActionStatus(string message, StatusSeverity severity = StatusSeverity.Info)
|
||||||
|
{
|
||||||
|
ActionStatus = severity switch
|
||||||
|
{
|
||||||
|
StatusSeverity.Error => StatusNotice.Error(message),
|
||||||
|
StatusSeverity.Warning => StatusNotice.Warning(message),
|
||||||
|
_ => StatusNotice.Info(message),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Catch top-level mutations: the four ObservableProperty
|
/// Catch top-level mutations: the four ObservableProperty
|
||||||
/// setters above all funnel through here, and we flip
|
/// setters above all funnel through here, and we flip
|
||||||
|
|
@ -406,6 +419,8 @@ public partial class Settings : ViewModelBase
|
||||||
[RelayCommand(CanExecute = nameof(CanSave))]
|
[RelayCommand(CanExecute = nameof(CanSave))]
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
|
SetActionStatus("Enregistrement des parametres...", StatusSeverity.Info);
|
||||||
|
|
||||||
var configDir = Path.Combine(
|
var configDir = Path.Combine(
|
||||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||||
"PostIt");
|
"PostIt");
|
||||||
|
|
@ -425,10 +440,13 @@ public partial class Settings : ViewModelBase
|
||||||
File.SetUnixFileMode(configPath,
|
File.SetUnixFileMode(configPath,
|
||||||
UnixFileMode.UserRead | UnixFileMode.UserWrite);
|
UnixFileMode.UserRead | UnixFileMode.UserWrite);
|
||||||
IsDirty = false;
|
IsDirty = false;
|
||||||
|
SetActionStatus("Parametres sauvegardes.", StatusSeverity.Info);
|
||||||
|
|
||||||
Console.WriteLine($"💾 Settings saved to {configPath}");
|
Console.WriteLine($"💾 Settings saved to {configPath}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
SetActionStatus($"Echec sauvegarde parametres: {ex.Message}", StatusSeverity.Error);
|
||||||
Console.Error.WriteLine($"🩎 Error saving settings to {configPath}: {ex.Message}");
|
Console.Error.WriteLine($"🩎 Error saving settings to {configPath}: {ex.Message}");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace PostIt.ViewModels;
|
||||||
/// until the Yavsc.Org endpoint exists; the contract there will
|
/// until the Yavsc.Org endpoint exists; the contract there will
|
||||||
/// be <c>POST /api/signature/{devisId}</c> with this same payload.
|
/// be <c>POST /api/signature/{devisId}</c> with this same payload.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class SignaturePageViewModel : ViewModelBase
|
public partial class SignaturePageViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default capture surface, in DIPs. 3:1 ratio matches a
|
/// Default capture surface, in DIPs. 3:1 ratio matches a
|
||||||
|
|
@ -42,6 +42,9 @@ public partial class SignaturePageViewModel : ViewModelBase
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = "Prêt.";
|
public partial string StatusMessage { get; set; } = "Prêt.";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Prêt.");
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial int StrokeCount { get; set; }
|
public partial int StrokeCount { get; set; }
|
||||||
|
|
||||||
|
|
@ -107,7 +110,7 @@ public partial class SignaturePageViewModel : ViewModelBase
|
||||||
|
|
||||||
private void OnStrokeCompleted(object? sender, SignaturePadData data)
|
private void OnStrokeCompleted(object? sender, SignaturePadData data)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Trait terminé. {data.StrokeCount} trait(s).";
|
this.SetInfoStatus($"Trait terminé. {data.StrokeCount} trait(s).");
|
||||||
RefreshCounts();
|
RefreshCounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,7 +128,7 @@ public partial class SignaturePageViewModel : ViewModelBase
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
_control?.Clear();
|
_control?.Clear();
|
||||||
StatusMessage = "Effacé.";
|
this.SetInfoStatus("Effacé.");
|
||||||
RefreshCounts();
|
RefreshCounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,14 +137,14 @@ public partial class SignaturePageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
if (_control is null)
|
if (_control is null)
|
||||||
{
|
{
|
||||||
StatusMessage = "Contrôle non attaché.";
|
this.SetWarningStatus("Contrôle non attaché.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = _control.Snapshot();
|
var data = _control.Snapshot();
|
||||||
if (data.IsEmpty)
|
if (data.IsEmpty)
|
||||||
{
|
{
|
||||||
StatusMessage = "Rien à capturer.";
|
this.SetWarningStatus("Rien à capturer.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,11 +152,11 @@ public partial class SignaturePageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
var path = WriteCapture(data);
|
var path = WriteCapture(data);
|
||||||
LastCapturedPath = path;
|
LastCapturedPath = path;
|
||||||
StatusMessage = $"Capture enregistrée: {path}";
|
this.SetInfoStatus($"Capture enregistrée: {path}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StatusMessage = $"Erreur: {ex.Message}";
|
this.SetErrorStatus($"Erreur: {ex.Message}");
|
||||||
}
|
}
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
35
src/PostIt/PostIt/ViewModels/StatusNotice.cs
Normal file
35
src/PostIt/PostIt/ViewModels/StatusNotice.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
namespace PostIt.ViewModels;
|
||||||
|
|
||||||
|
public enum StatusSeverity
|
||||||
|
{
|
||||||
|
Info,
|
||||||
|
Warning,
|
||||||
|
Error
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class StatusNotice
|
||||||
|
{
|
||||||
|
public string Message { get; }
|
||||||
|
public StatusSeverity Severity { get; }
|
||||||
|
public string Glyph { get; }
|
||||||
|
public string Background { get; }
|
||||||
|
public string BorderBrush { get; }
|
||||||
|
public string Foreground { get; }
|
||||||
|
|
||||||
|
private StatusNotice(string message, StatusSeverity severity)
|
||||||
|
{
|
||||||
|
Message = string.IsNullOrWhiteSpace(message) ? "Pret." : message;
|
||||||
|
Severity = severity;
|
||||||
|
|
||||||
|
(Glyph, Background, BorderBrush, Foreground) = severity switch
|
||||||
|
{
|
||||||
|
StatusSeverity.Error => ("!", "#FDECEA", "#C62828", "#7F1D1D"),
|
||||||
|
StatusSeverity.Warning => ("~", "#FFF8E1", "#E6A700", "#7C4A03"),
|
||||||
|
_ => ("i", "#E8F0FE", "#5B8DEF", "#1E3A8A"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatusNotice Info(string message) => new(message, StatusSeverity.Info);
|
||||||
|
public static StatusNotice Warning(string message) => new(message, StatusSeverity.Warning);
|
||||||
|
public static StatusNotice Error(string message) => new(message, StatusSeverity.Error);
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<ContentPage xmlns="https://github.com/avaloniaui"
|
<ContentPage xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
xmlns:wf="using:Yavsc.Abstract.Workflow"
|
xmlns:wf="using:Yavsc.Abstract.Workflow"
|
||||||
x:Class="PostIt.Views.ActivitiesPage"
|
x:Class="PostIt.Views.ActivitiesPage"
|
||||||
x:DataType="vm:ActivitiesPageViewModel"
|
x:DataType="vm:ActivitiesPageViewModel"
|
||||||
|
|
@ -131,16 +132,8 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Grid.Row="2" ColumnDefinitions="*,Auto">
|
<Grid Grid.Row="2" ColumnDefinitions="*,Auto">
|
||||||
<TextBox Grid.Column="0"
|
<postitControls:StatusBar Grid.Column="0"
|
||||||
Text="{Binding StatusMessage}"
|
DataContext="{Binding ActionStatus}" />
|
||||||
IsReadOnly="True"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
BorderThickness="0"
|
|
||||||
BorderBrush="Transparent"
|
|
||||||
Padding="0"
|
|
||||||
Background="Transparent"
|
|
||||||
VerticalAlignment="Center" />
|
|
||||||
<ProgressBar Grid.Column="1" Width="120" IsIndeterminate="True" IsVisible="{Binding IsBusy}" />
|
<ProgressBar Grid.Column="1" Width="120" IsIndeterminate="True" IsVisible="{Binding IsBusy}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
x:Class="PostIt.Views.AddCircleMemberDialog"
|
x:Class="PostIt.Views.AddCircleMemberDialog"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
xmlns:services="using:PostIt.Services"
|
xmlns:services="using:PostIt.Services"
|
||||||
x:DataType="vm:AddCircleMemberDialogViewModel"
|
x:DataType="vm:AddCircleMemberDialogViewModel"
|
||||||
>
|
>
|
||||||
|
|
@ -47,8 +48,8 @@
|
||||||
|
|
||||||
<!-- Action buttons -->
|
<!-- Action buttons -->
|
||||||
<Grid Grid.Row="3" ColumnDefinitions="*,Auto,Auto" Margin="0,8,0,0">
|
<Grid Grid.Row="3" ColumnDefinitions="*,Auto,Auto" Margin="0,8,0,0">
|
||||||
<TextBlock Grid.Column="0" Text="{Binding StatusMessage}"
|
<postitControls:StatusBar Grid.Column="0"
|
||||||
VerticalAlignment="Center"/>
|
DataContext="{Binding ActionStatus}" />
|
||||||
<Button Grid.Column="1" Content="Ajouter"
|
<Button Grid.Column="1" Content="Ajouter"
|
||||||
x:Name="AddButton"
|
x:Name="AddButton"
|
||||||
Command="{Binding AddAsync}"
|
Command="{Binding AddAsync}"
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
|
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using Avalonia.Interactivity;
|
|
||||||
using Avalonia.VisualTree;
|
using Avalonia.VisualTree;
|
||||||
using PostIt.Services;
|
using PostIt.Services;
|
||||||
using PostIt.ViewModels;
|
using PostIt.ViewModels;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PostIt.Views;
|
namespace PostIt.Views;
|
||||||
|
|
||||||
|
|
@ -41,10 +39,4 @@ public partial class AddCircleMemberDialog : Avalonia.Controls.ContentPage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AddCircleMemberDialogViewModel? ViewModel
|
public AddCircleMemberDialogViewModel? ViewModel
|
||||||
=> DataContext as AddCircleMemberDialogViewModel;
|
=> DataContext as AddCircleMemberDialogViewModel;
|
||||||
|
|
||||||
private async Task OnCloseClicked(object? sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
App app = App.Current! as App;
|
|
||||||
await app!.GoBackAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<ContentPage xmlns="https://github.com/avaloniaui"
|
<ContentPage xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
x:Class="PostIt.Views.BillingQueriesPage"
|
x:Class="PostIt.Views.BillingQueriesPage"
|
||||||
x:DataType="vm:BillingQueriesPageViewModel"
|
x:DataType="vm:BillingQueriesPageViewModel"
|
||||||
Header="Commandes billing">
|
Header="Commandes billing">
|
||||||
|
|
@ -36,16 +37,8 @@
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
||||||
<Grid Grid.Row="3" ColumnDefinitions="*,Auto" Margin="0,12,0,0">
|
<Grid Grid.Row="3" ColumnDefinitions="*,Auto" Margin="0,12,0,0">
|
||||||
<TextBox Grid.Column="0"
|
<postitControls:StatusBar Grid.Column="0"
|
||||||
Text="{Binding StatusMessage}"
|
DataContext="{Binding ActionStatus}" />
|
||||||
IsReadOnly="True"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
BorderThickness="0"
|
|
||||||
BorderBrush="Transparent"
|
|
||||||
Padding="0"
|
|
||||||
Background="Transparent"
|
|
||||||
VerticalAlignment="Center" />
|
|
||||||
<ProgressBar Grid.Column="1" Width="120" IsIndeterminate="True" IsVisible="{Binding IsBusy}" />
|
<ProgressBar Grid.Column="1" Width="120" IsIndeterminate="True" IsVisible="{Binding IsBusy}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<ContentPage
|
<ContentPage
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
x:Class="PostIt.Views.CirclesPage"
|
x:Class="PostIt.Views.CirclesPage"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
xmlns:dtos="using:Yavsc.Api.Client.Dtos"
|
xmlns:dtos="using:Yavsc.Api.Client.Dtos"
|
||||||
|
|
@ -101,8 +102,8 @@
|
||||||
|
|
||||||
<!-- Status bar -->
|
<!-- Status bar -->
|
||||||
<Grid Grid.Row="2" ColumnDefinitions="*,Auto" Margin="12,0,12,12">
|
<Grid Grid.Row="2" ColumnDefinitions="*,Auto" Margin="12,0,12,12">
|
||||||
<TextBlock Grid.Column="0" Text="{Binding StatusMessage}"
|
<postitControls:StatusBar Grid.Column="0"
|
||||||
VerticalAlignment="Center"/>
|
DataContext="{Binding ActionStatus}" />
|
||||||
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
||||||
IsVisible="{Binding IsBusy}"
|
IsVisible="{Binding IsBusy}"
|
||||||
Width="120"/>
|
Width="120"/>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<ContentPage xmlns="https://github.com/avaloniaui"
|
<ContentPage xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
xmlns:wf="using:Yavsc.Abstract.Workflow"
|
xmlns:wf="using:Yavsc.Abstract.Workflow"
|
||||||
x:Class="PostIt.Views.CommandFormsPage"
|
x:Class="PostIt.Views.CommandFormsPage"
|
||||||
x:DataType="vm:CommandFormsPageViewModel"
|
x:DataType="vm:CommandFormsPageViewModel"
|
||||||
|
|
@ -41,16 +42,8 @@
|
||||||
<Button Grid.Column="4"
|
<Button Grid.Column="4"
|
||||||
Content="Demandes en cours (lecture seule)"
|
Content="Demandes en cours (lecture seule)"
|
||||||
Command="{Binding OpenOngoingQueriesCommand}" />
|
Command="{Binding OpenOngoingQueriesCommand}" />
|
||||||
<TextBox Grid.Column="6"
|
<postitControls:StatusBar Grid.Column="6"
|
||||||
Text="{Binding StatusMessage}"
|
DataContext="{Binding ActionStatus}" />
|
||||||
IsReadOnly="True"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
BorderThickness="0"
|
|
||||||
BorderBrush="Transparent"
|
|
||||||
Padding="0"
|
|
||||||
Background="Transparent"
|
|
||||||
VerticalAlignment="Center" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:cvm="using:PostIt.ViewModels.Commands"
|
xmlns:cvm="using:PostIt.ViewModels.Commands"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="PostIt.Views.Commands.BrushPage"
|
x:Class="PostIt.Views.Commands.BrushPage"
|
||||||
|
|
||||||
|
|
@ -93,16 +94,8 @@
|
||||||
Content="{Binding SubmitLabel}"
|
Content="{Binding SubmitLabel}"
|
||||||
Command="{Binding SubmitCommand}"
|
Command="{Binding SubmitCommand}"
|
||||||
IsEnabled="{Binding IsSupported}" />
|
IsEnabled="{Binding IsSupported}" />
|
||||||
<TextBox Grid.Column="2"
|
<postitControls:StatusBar Grid.Column="2"
|
||||||
Text="{Binding StatusMessage}"
|
DataContext="{Binding ActionStatus}" />
|
||||||
IsReadOnly="True"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
BorderThickness="0"
|
|
||||||
BorderBrush="Transparent"
|
|
||||||
Padding="0"
|
|
||||||
Background="Transparent"
|
|
||||||
VerticalAlignment="Center" />
|
|
||||||
<ProgressBar Grid.Column="3"
|
<ProgressBar Grid.Column="3"
|
||||||
Width="120"
|
Width="120"
|
||||||
IsIndeterminate="True"
|
IsIndeterminate="True"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<ContentPage xmlns="https://github.com/avaloniaui"
|
<ContentPage xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:cvm="using:PostIt.ViewModels.Commands"
|
xmlns:cvm="using:PostIt.ViewModels.Commands"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
x:Class="PostIt.Views.Commands.RdvPage"
|
x:Class="PostIt.Views.Commands.RdvPage"
|
||||||
x:DataType="cvm:RdvViewModel"
|
x:DataType="cvm:RdvViewModel"
|
||||||
Header="Commande billing">
|
Header="Commande billing">
|
||||||
|
|
@ -71,16 +72,8 @@
|
||||||
Content="{Binding SubmitLabel}"
|
Content="{Binding SubmitLabel}"
|
||||||
Command="{Binding SubmitCommand}"
|
Command="{Binding SubmitCommand}"
|
||||||
IsEnabled="{Binding IsSupported}" />
|
IsEnabled="{Binding IsSupported}" />
|
||||||
<TextBox Grid.Column="2"
|
<postitControls:StatusBar Grid.Column="2"
|
||||||
Text="{Binding StatusMessage}"
|
DataContext="{Binding ActionStatus}" />
|
||||||
IsReadOnly="True"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
BorderThickness="0"
|
|
||||||
BorderBrush="Transparent"
|
|
||||||
Padding="0"
|
|
||||||
Background="Transparent"
|
|
||||||
VerticalAlignment="Center" />
|
|
||||||
<ProgressBar Grid.Column="3"
|
<ProgressBar Grid.Column="3"
|
||||||
Width="120"
|
Width="120"
|
||||||
IsIndeterminate="True"
|
IsIndeterminate="True"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
xmlns:models="using:Yavsc.Blogspot"
|
xmlns:models="using:Yavsc.Blogspot"
|
||||||
xmlns:views="using:PostIt.Views"
|
xmlns:views="using:PostIt.Views"
|
||||||
xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
|
xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
|
||||||
|
|
@ -104,7 +105,8 @@
|
||||||
VerticalAlignment="Stretch">
|
VerticalAlignment="Stretch">
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
<TextBlock Grid.Row="3" Text="{Binding StatusMessage}" Foreground="Gray" />
|
<postitControls:StatusBar Grid.Row="3"
|
||||||
|
DataContext="{Binding ActionStatus}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
x:Class="PostIt.Views.PostAclDialog"
|
x:Class="PostIt.Views.PostAclDialog"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
xmlns:dtos="using:Yavsc.Api.Client.Dtos"
|
xmlns:dtos="using:Yavsc.Api.Client.Dtos"
|
||||||
x:DataType="vm:PostAclDialogViewModel"
|
x:DataType="vm:PostAclDialogViewModel"
|
||||||
>
|
>
|
||||||
|
|
@ -53,8 +54,8 @@
|
||||||
|
|
||||||
<!-- Status bar -->
|
<!-- Status bar -->
|
||||||
<Grid Grid.Row="3" ColumnDefinitions="*,Auto">
|
<Grid Grid.Row="3" ColumnDefinitions="*,Auto">
|
||||||
<TextBlock Grid.Column="0" Text="{Binding StatusMessage}"
|
<postitControls:StatusBar Grid.Column="0"
|
||||||
VerticalAlignment="Center"/>
|
DataContext="{Binding ActionStatus}" />
|
||||||
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
||||||
IsVisible="{Binding IsBusy}"
|
IsVisible="{Binding IsBusy}"
|
||||||
Width="120"/>
|
Width="120"/>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="cl:avalonia.Controls"
|
xmlns:controls="cl:avalonia.Controls"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
x:Class="PostIt.Views.SettingsPage"
|
x:Class="PostIt.Views.SettingsPage"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
x:DataType="vm:Settings"
|
x:DataType="vm:Settings"
|
||||||
|
|
@ -51,9 +52,7 @@
|
||||||
Opacity="0.8"
|
Opacity="0.8"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
|
|
||||||
<TextBlock x:Name="AvatarUploadStatusText"
|
<postitControls:StatusBar DataContext="{Binding ActionStatus}"/>
|
||||||
Text=""
|
|
||||||
TextWrapping="Wrap" />
|
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button x:Name="ChooseAvatarButton"
|
<Button x:Name="ChooseAvatarButton"
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Media;
|
|
||||||
using Avalonia.Platform.Storage;
|
using Avalonia.Platform.Storage;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using PostIt.Services;
|
using PostIt.Services;
|
||||||
|
using PostIt.ViewModels;
|
||||||
|
|
||||||
namespace PostIt.Views;
|
namespace PostIt.Views;
|
||||||
public partial class SettingsPage: ContentPage
|
public partial class SettingsPage: ContentPage
|
||||||
|
|
@ -28,12 +28,12 @@ public partial class SettingsPage: ContentPage
|
||||||
{
|
{
|
||||||
var statusVersion = Interlocked.Increment(ref _avatarStatusVersion);
|
var statusVersion = Interlocked.Increment(ref _avatarStatusVersion);
|
||||||
ChooseAvatarButton.IsEnabled = false;
|
ChooseAvatarButton.IsEnabled = false;
|
||||||
SetAvatarStatus("Sélection d'un fichier avatar...", Brushes.Gray);
|
SetAvatarStatus("Selection d'un fichier avatar...", StatusSeverity.Info);
|
||||||
|
|
||||||
var topLevel = TopLevel.GetTopLevel(this);
|
var topLevel = TopLevel.GetTopLevel(this);
|
||||||
if (topLevel is null)
|
if (topLevel is null)
|
||||||
{
|
{
|
||||||
SetAvatarStatus("Impossible d'accéder à la fenêtre active.", Brushes.IndianRed);
|
SetAvatarStatus("Impossible d'acceder a la fenetre active.", StatusSeverity.Error);
|
||||||
ChooseAvatarButton.IsEnabled = true;
|
ChooseAvatarButton.IsEnabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -54,27 +54,28 @@ public partial class SettingsPage: ContentPage
|
||||||
var file = files.FirstOrDefault();
|
var file = files.FirstOrDefault();
|
||||||
if (file is null)
|
if (file is null)
|
||||||
{
|
{
|
||||||
SetAvatarStatus("Upload annulé.", Brushes.Gray);
|
SetAvatarStatus("Upload annule.", StatusSeverity.Warning);
|
||||||
ChooseAvatarButton.IsEnabled = true;
|
ChooseAvatarButton.IsEnabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SetAvatarStatus("Upload avatar en cours...", Brushes.Gray);
|
SetAvatarStatus("Upload avatar en cours...", StatusSeverity.Info);
|
||||||
|
|
||||||
await using var stream = await file.OpenReadAsync();
|
await using var stream = await file.OpenReadAsync();
|
||||||
var api = ((App)App.Current!).ServiceProvider!.GetRequiredService<YavscApiClient>();
|
var api = ((App)App.Current!).ServiceProvider!.GetRequiredService<YavscApiClient>();
|
||||||
var message = await api.SetAvatarAsync(stream, file.Name, GetMimeType(file.Name));
|
var message = await api.SetAvatarAsync(stream, file.Name, GetMimeType(file.Name));
|
||||||
SetAvatarStatus(string.IsNullOrWhiteSpace(message)
|
SetAvatarStatus(string.IsNullOrWhiteSpace(message)
|
||||||
? "Avatar mis à jour."
|
? "Avatar mis a jour."
|
||||||
: message, Brushes.ForestGreen);
|
: message,
|
||||||
|
StatusSeverity.Info);
|
||||||
|
|
||||||
_ = ClearSuccessStatusLaterAsync(statusVersion);
|
_ = ClearSuccessStatusLaterAsync(statusVersion);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
SetAvatarStatus($"Échec upload avatar: {ex.Message}", Brushes.IndianRed);
|
SetAvatarStatus($"Echec upload avatar: {ex.Message}", StatusSeverity.Error);
|
||||||
Console.Error.WriteLine($"🩎 Avatar upload failed: {ex.Message}");
|
Console.Error.WriteLine($"🩎 Avatar upload failed: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
@ -89,16 +90,15 @@ public partial class SettingsPage: ContentPage
|
||||||
if (statusVersion != _avatarStatusVersion)
|
if (statusVersion != _avatarStatusVersion)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (AvatarUploadStatusText.Foreground == Brushes.ForestGreen)
|
SetAvatarStatus($"Avatar pret. Formats supportes: {AcceptedAvatarFormats}. Taille max: {MaxAvatarSizeMegabytes} MB.", StatusSeverity.Info);
|
||||||
{
|
|
||||||
SetAvatarStatus($"Avatar prêt. Formats supportés: {AcceptedAvatarFormats}. Taille max: {MaxAvatarSizeMegabytes} MB.", Brushes.Gray);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAvatarStatus(string message, IBrush color)
|
private void SetAvatarStatus(string message, StatusSeverity severity)
|
||||||
{
|
{
|
||||||
AvatarUploadStatusText.Foreground = color;
|
if (DataContext is Settings settings)
|
||||||
AvatarUploadStatusText.Text = message;
|
{
|
||||||
|
settings.SetActionStatus(message, severity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetMimeType(string fileName)
|
private static string GetMimeType(string fileName)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
xmlns:d="http://github.com/avaloniaui/avalonia"
|
xmlns:d="http://github.com/avaloniaui/avalonia"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
xmlns:controls="using:PostIt.Controls"
|
xmlns:controls="using:PostIt.Controls"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
x:Class="PostIt.Views.SignaturePage"
|
x:Class="PostIt.Views.SignaturePage"
|
||||||
x:DataType="vm:SignaturePageViewModel"
|
x:DataType="vm:SignaturePageViewModel"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
|
|
@ -59,10 +60,8 @@
|
||||||
<Button Content="Capturer" Command="{Binding CaptureAsync}" />
|
<Button Content="Capturer" Command="{Binding CaptureAsync}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock Grid.Row="3"
|
<postitControls:StatusBar Grid.Row="3"
|
||||||
Text="{Binding StatusMessage}"
|
DataContext="{Binding ActionStatus}" />
|
||||||
Foreground="Gray"
|
|
||||||
TextWrapping="Wrap" />
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="4"
|
<TextBlock Grid.Row="4"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
using Yavsc.Services;
|
using Yavsc.Services;
|
||||||
|
|
||||||
namespace Yavsc.Billing
|
namespace Yavsc.Billing
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
namespace Yavsc.Blogspot;
|
namespace Yavsc.Blogspot;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
using Yavsc.Abstract.Identity.Security;
|
using Yavsc.Abstract.Identity.Security;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Chat
|
namespace Yavsc.Abstract.Chat
|
||||||
{
|
{
|
||||||
public static class ChatHubConstants
|
public static class ChatHubConstants
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Chat
|
namespace Yavsc.Abstract.Chat
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using System.Text;
|
#nullable enable annotations
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
using Yavsc.ViewModels.UserFiles;
|
using Yavsc.ViewModels.UserFiles;
|
||||||
|
|
||||||
namespace Yavsc.Server.Helpers
|
namespace Yavsc.Server.Helpers
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Helpers
|
namespace Yavsc.Abstract.Helpers
|
||||||
{
|
{
|
||||||
public enum ErrorCode {
|
public enum ErrorCode {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
using Yavsc.Server.Helpers;
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.ViewModels.UserFiles
|
namespace Yavsc.ViewModels.UserFiles
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
//
|
//
|
||||||
// GDate.cs
|
// GDate.cs
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
//
|
//
|
||||||
// MessageWithPayloadResponse.cs
|
// MessageWithPayloadResponse.cs
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Yavsc.Attributes.Validation;
|
using Yavsc.Attributes.Validation;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
namespace Yavsc.Abstract.Identity
|
#nullable enable annotations
|
||||||
|
|
||||||
|
namespace Yavsc.Abstract.Identity
|
||||||
{
|
{
|
||||||
public interface IApplicationUser
|
public interface IApplicationUser
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Identity
|
namespace Yavsc.Abstract.Identity
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using Yavsc.Abstract.Identity;
|
#nullable enable annotations
|
||||||
|
|
||||||
|
using Yavsc.Abstract.Identity;
|
||||||
|
|
||||||
namespace Yavsc.Interfaces
|
namespace Yavsc.Interfaces
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
|
|
||||||
using Yavsc.Interfaces;
|
using Yavsc.Interfaces;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
//
|
//
|
||||||
// BookQueryEvent.cs
|
// BookQueryEvent.cs
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
using Yavsc.Abstract.Identity;
|
using Yavsc.Abstract.Identity;
|
||||||
using Yavsc.Models.Relationship;
|
using Yavsc.Models.Relationship;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
// Copyright (C) 2016 Paul Schneider
|
#nullable enable annotations
|
||||||
|
|
||||||
|
// Copyright (C) 2016 Paul Schneider
|
||||||
//
|
//
|
||||||
// This file is part of yavsc.
|
// This file is part of yavsc.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
namespace Yavsc.Workflow
|
namespace Yavsc.Workflow
|
||||||
{
|
{
|
||||||
public interface IPerformerProfile
|
public interface IPerformerProfile
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable enable annotations
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue