Compare commits
52 changed files with 218 additions and 374 deletions
|
|
@ -1,22 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace PostIt.Controls;
|
|
||||||
|
|
||||||
public partial class StatusBar : UserControl
|
|
||||||
{
|
|
||||||
public StatusBar()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
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, IActionStatusViewModel
|
public partial class ActivitiesPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private readonly ActivityApiClient _client;
|
private readonly ActivityApiClient _client;
|
||||||
private readonly BillingApiClient _billingClient;
|
private readonly BillingApiClient _billingClient;
|
||||||
|
|
@ -43,9 +43,6 @@ public partial class ActivitiesPageViewModel : ViewModelBase, IActionStatusViewM
|
||||||
[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)";
|
||||||
|
|
@ -89,11 +86,11 @@ public partial class ActivitiesPageViewModel : ViewModelBase, IActionStatusViewM
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,11 +102,11 @@ public partial class ActivitiesPageViewModel : ViewModelBase, IActionStatusViewM
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,7 +123,7 @@ public partial class ActivitiesPageViewModel : ViewModelBase, IActionStatusViewM
|
||||||
await ShowActivityAsync(first);
|
await ShowActivityAsync(first);
|
||||||
if (first is null)
|
if (first is null)
|
||||||
{
|
{
|
||||||
this.SetInfoStatus("Aucune activité disponible.");
|
StatusMessage = "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)
|
||||||
|
|
@ -134,14 +131,14 @@ public partial class ActivitiesPageViewModel : ViewModelBase, IActionStatusViewM
|
||||||
Activities = new ObservableCollection<ActivityInfo>();
|
Activities = new ObservableCollection<ActivityInfo>();
|
||||||
Specializations = new ObservableCollection<ActivityInfo>();
|
Specializations = new ObservableCollection<ActivityInfo>();
|
||||||
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
Performers = new ObservableCollection<ActivityUserDisplayItem>();
|
||||||
this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "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>();
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -233,19 +230,19 @@ public partial class ActivitiesPageViewModel : ViewModelBase, IActionStatusViewM
|
||||||
|
|
||||||
Performers = new ObservableCollection<ActivityUserDisplayItem>(items);
|
Performers = new ObservableCollection<ActivityUserDisplayItem>(items);
|
||||||
SelectedPerformer = null;
|
SelectedPerformer = null;
|
||||||
this.SetInfoStatus($"{activity.Name} · {Performers.Count} utilisateur(s)");
|
StatusMessage = $"{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;
|
||||||
this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "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;
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -262,7 +259,7 @@ public partial class ActivitiesPageViewModel : ViewModelBase, IActionStatusViewM
|
||||||
{
|
{
|
||||||
if (SelectedPerformer is null || CurrentActivity is null)
|
if (SelectedPerformer is null || CurrentActivity is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez un utilisateur et une activité avec formulaire.");
|
StatusMessage = "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, IActionStatusViewModel
|
public partial class AddCircleMemberDialogViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private readonly IUserDirectory _directory;
|
private readonly IUserDirectory _directory;
|
||||||
|
|
||||||
|
|
@ -46,10 +46,7 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase, IActionStat
|
||||||
public partial bool IsBusy { get; set; }
|
public partial bool IsBusy { get; set; }
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = "Pret.";
|
public partial string StatusMessage { get; set; } = string.Empty;
|
||||||
|
|
||||||
[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
|
||||||
|
|
@ -82,7 +79,7 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase, IActionStat
|
||||||
if (string.IsNullOrWhiteSpace(SearchQuery))
|
if (string.IsNullOrWhiteSpace(SearchQuery))
|
||||||
{
|
{
|
||||||
Results.Clear();
|
Results.Clear();
|
||||||
this.SetWarningStatus("Tapez un nom ou un email");
|
StatusMessage = "Tapez un nom ou un email";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,11 +88,11 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase, IActionStat
|
||||||
{
|
{
|
||||||
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>());
|
||||||
this.SetInfoStatus($"{Results.Count} résultat(s)");
|
StatusMessage = $"{Results.Count} résultat(s)";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -113,20 +110,18 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase, IActionStat
|
||||||
{
|
{
|
||||||
if (Selected is null)
|
if (Selected is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez un utilisateur");
|
StatusMessage = "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, IActionStatusViewModel
|
public partial class BillingQueriesPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private readonly BillingApiClient _billingClient;
|
private readonly BillingApiClient _billingClient;
|
||||||
|
|
||||||
|
|
@ -36,9 +36,6 @@ public partial class BillingQueriesPageViewModel : ViewModelBase, IActionStatusV
|
||||||
[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}";
|
||||||
|
|
@ -93,17 +90,17 @@ public partial class BillingQueriesPageViewModel : ViewModelBase, IActionStatusV
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Queries = new ObservableCollection<BillingQueryDisplayItem>(filtered);
|
Queries = new ObservableCollection<BillingQueryDisplayItem>(filtered);
|
||||||
this.SetInfoStatus(BuildLoadedStatusMessage(filtered.Count));
|
StatusMessage = 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>();
|
||||||
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "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>();
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -116,13 +113,13 @@ public partial class BillingQueriesPageViewModel : ViewModelBase, IActionStatusV
|
||||||
{
|
{
|
||||||
if (IsReadOnly)
|
if (IsReadOnly)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Mode lecture seule: l'ouverture en modification est désactivée.");
|
StatusMessage = "Mode lecture seule: l'ouverture en modification est désactivée.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedQuery is null)
|
if (SelectedQuery is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez une commande.");
|
StatusMessage = "Sélectionnez une commande.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,11 +139,11 @@ public partial class BillingQueriesPageViewModel : ViewModelBase, IActionStatusV
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur lors de l'ouverture: {ex.Message}");
|
StatusMessage = $"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, IActionStatusViewModel
|
public partial class CirclesPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private readonly CircleApiClient _client;
|
private readonly CircleApiClient _client;
|
||||||
|
|
||||||
|
|
@ -63,10 +63,8 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
public partial bool IsBusy { get; set; }
|
public partial bool IsBusy { get; set; }
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = "Pret.";
|
public partial string StatusMessage { get; set; } = string.Empty;
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
|
||||||
|
|
||||||
public CirclesPageViewModel(CircleApiClient client)
|
public CirclesPageViewModel(CircleApiClient client)
|
||||||
{
|
{
|
||||||
|
|
@ -102,11 +100,11 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
{
|
{
|
||||||
var list = await _client.GetMyCirclesAsync();
|
var list = await _client.GetMyCirclesAsync();
|
||||||
Circles = new ObservableCollection<CircleDto>(list ?? new());
|
Circles = new ObservableCollection<CircleDto>(list ?? new());
|
||||||
this.SetInfoStatus($"{Circles.Count} cercle(s)");
|
StatusMessage = $"{Circles.Count} cercle(s)";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -117,10 +115,8 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
internal async Task OpenAddMemberAsync()
|
internal async Task OpenAddMemberAsync()
|
||||||
{
|
{
|
||||||
var app = Application.Current as App
|
var app = Application.Current as App;
|
||||||
?? throw new InvalidOperationException("Application PostIt indisponible.");
|
var services = app?.ServiceProvider;
|
||||||
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);
|
||||||
|
|
@ -151,11 +147,11 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
{
|
{
|
||||||
var list = await _client.GetMembersAsync(circleId);
|
var list = await _client.GetMembersAsync(circleId);
|
||||||
Members = new ObservableCollection<CircleMemberDto>(list ?? new());
|
Members = new ObservableCollection<CircleMemberDto>(list ?? new());
|
||||||
this.SetInfoStatus($"{Members.Count} membre(s)");
|
StatusMessage = $"{Members.Count} membre(s)";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
Members = new ObservableCollection<CircleMemberDto>();
|
Members = new ObservableCollection<CircleMemberDto>();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
@ -170,7 +166,7 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
SelectedCircle = null;
|
SelectedCircle = null;
|
||||||
DraftName = string.Empty;
|
DraftName = string.Empty;
|
||||||
DraftPublic = false;
|
DraftPublic = false;
|
||||||
this.SetInfoStatus("Nouveau cercle");
|
StatusMessage = "Nouveau cercle";
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
|
|
@ -180,7 +176,7 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
SelectedCircle = circle;
|
SelectedCircle = circle;
|
||||||
DraftName = circle.Name;
|
DraftName = circle.Name;
|
||||||
DraftPublic = circle.Public;
|
DraftPublic = circle.Public;
|
||||||
this.SetInfoStatus($"Édition de « {circle.Name} »");
|
StatusMessage = $"Édition de « {circle.Name} »";
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
|
|
@ -188,7 +184,7 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(DraftName))
|
if (string.IsNullOrWhiteSpace(DraftName))
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Le nom est obligatoire");
|
StatusMessage = "Le nom est obligatoire";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,22 +198,22 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
Name = DraftName.Trim(),
|
Name = DraftName.Trim(),
|
||||||
Public = DraftPublic,
|
Public = DraftPublic,
|
||||||
});
|
});
|
||||||
this.SetStatus(
|
StatusMessage = created is null
|
||||||
created is null ? "Création échouée" : $"Cercle « {created.Name} » créé",
|
? "Création échouée"
|
||||||
created is null ? StatusSeverity.Warning : StatusSeverity.Info);
|
: $"Cercle « {created.Name} » créé";
|
||||||
}
|
}
|
||||||
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);
|
||||||
this.SetInfoStatus($"Cercle « {SelectedCircle.Name} » mis à jour");
|
StatusMessage = $"Cercle « {SelectedCircle.Name} » mis à jour";
|
||||||
}
|
}
|
||||||
await RefreshAsync();
|
await RefreshAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -233,7 +229,7 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _client.DeleteCircleAsync(circle.Id);
|
await _client.DeleteCircleAsync(circle.Id);
|
||||||
this.SetInfoStatus($"Cercle « {circle.Name} » supprimé");
|
StatusMessage = $"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
|
||||||
|
|
@ -244,7 +240,7 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -265,7 +261,7 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _client.AddMemberAsync(SelectedCircle.Id, picked.Id);
|
await _client.AddMemberAsync(SelectedCircle.Id, picked.Id);
|
||||||
this.SetInfoStatus($"« {picked.DisplayName} » ajouté au cercle");
|
StatusMessage = $"« {picked.DisplayName} » ajouté au cercle";
|
||||||
await LoadMembersAsync(SelectedCircle.Id);
|
await LoadMembersAsync(SelectedCircle.Id);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -280,7 +276,7 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
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}";
|
||||||
this.SetStatus(msg, msg == "Déjà membre du cercle" ? StatusSeverity.Warning : StatusSeverity.Error);
|
StatusMessage = msg;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -301,11 +297,11 @@ public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewMode
|
||||||
{
|
{
|
||||||
await _client.RemoveMemberAsync(SelectedCircle.Id, member.Id);
|
await _client.RemoveMemberAsync(SelectedCircle.Id, member.Id);
|
||||||
Members.Remove(member);
|
Members.Remove(member);
|
||||||
this.SetInfoStatus($"« {member.UserName} » retiré du cercle");
|
StatusMessage = $"« {member.UserName} » retiré du cercle";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ using Yavsc.Api.Client;
|
||||||
|
|
||||||
namespace PostIt.ViewModels;
|
namespace PostIt.ViewModels;
|
||||||
|
|
||||||
public partial class CommandFormsPageViewModel : ViewModelBase, IActionStatusViewModel
|
public partial class CommandFormsPageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private readonly BillingApiClient _billingClient;
|
private readonly BillingApiClient _billingClient;
|
||||||
|
|
||||||
|
|
@ -25,10 +25,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase, IActionStatusVie
|
||||||
public partial CommandFormSummary? SelectedForm { get; set; }
|
public partial CommandFormSummary? SelectedForm { get; set; }
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = "Pret.";
|
public partial string StatusMessage { get; set; }
|
||||||
|
|
||||||
[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)";
|
||||||
|
|
@ -58,11 +55,9 @@ public partial class CommandFormsPageViewModel : ViewModelBase, IActionStatusVie
|
||||||
.OrderBy(f => f.Title)
|
.OrderBy(f => f.Title)
|
||||||
.ThenBy(f => f.ActionName));
|
.ThenBy(f => f.ActionName));
|
||||||
SelectedForm = Forms.FirstOrDefault();
|
SelectedForm = Forms.FirstOrDefault();
|
||||||
this.SetStatus(
|
StatusMessage = Forms.Count == 0
|
||||||
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;
|
||||||
|
|
@ -76,7 +71,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase, IActionStatusVie
|
||||||
{
|
{
|
||||||
if (SelectedForm is null)
|
if (SelectedForm is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez un formulaire.");
|
StatusMessage = "Sélectionnez un formulaire.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,7 +92,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase, IActionStatusVie
|
||||||
{
|
{
|
||||||
if (SelectedForm is null)
|
if (SelectedForm is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez un formulaire.");
|
StatusMessage = "Sélectionnez un formulaire.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,7 +112,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase, IActionStatusVie
|
||||||
{
|
{
|
||||||
if (SelectedForm is null)
|
if (SelectedForm is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez un formulaire.");
|
StatusMessage = "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, IActionStatusViewModel
|
public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase
|
||||||
{
|
{
|
||||||
protected readonly BillingApiClient _billingClient;
|
protected readonly BillingApiClient _billingClient;
|
||||||
|
|
||||||
|
|
@ -21,10 +21,7 @@ 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; } = "Pret.";
|
public partial string StatusMessage { get; set; }
|
||||||
|
|
||||||
[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;
|
||||||
|
|
@ -78,7 +75,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));
|
||||||
|
|
||||||
this.SetInfoStatus(SupportMessage);
|
StatusMessage = SupportMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnExistingQueryIdChanged(long? value)
|
partial void OnExistingQueryIdChanged(long? value)
|
||||||
|
|
|
||||||
|
|
@ -58,20 +58,18 @@ public partial class BrushViewModel : RdvViewModel
|
||||||
SelectedPrestation = AvailablePrestations.FirstOrDefault();
|
SelectedPrestation = AvailablePrestations.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.SetStatus(
|
StatusMessage = AvailablePrestations.Count == 0
|
||||||
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)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Accès refusé au catalogue de prestations (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "Accès refusé au catalogue de prestations (scope 'api'). Déconnectez puis reconnectez-vous.";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur lors du chargement des prestations: {ex.Message}");
|
StatusMessage = $"Erreur lors du chargement des prestations: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -83,19 +81,19 @@ public partial class BrushViewModel : RdvViewModel
|
||||||
{
|
{
|
||||||
if (!Consent)
|
if (!Consent)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Le consentement est requis pour poster la commande.");
|
StatusMessage = "Le consentement est requis pour poster la commande.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Address))
|
if (string.IsNullOrWhiteSpace(Address))
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("L'adresse du rendez-vous est requise.");
|
StatusMessage = "L'adresse du rendez-vous est requise.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedPrestation is null)
|
if (SelectedPrestation is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez une prestation coiffure.");
|
StatusMessage = "Sélectionnez une prestation coiffure.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,18 +143,18 @@ public partial class BrushViewModel : RdvViewModel
|
||||||
}).ConfigureAwait(true);
|
}).ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.SetInfoStatus(IsEditingExisting
|
StatusMessage = 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)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur lors de l'envoi de la commande: {ex.Message}");
|
StatusMessage = $"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)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Le consentement est requis pour poster la commande.");
|
StatusMessage = "Le consentement est requis pour poster la commande.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Address))
|
if (string.IsNullOrWhiteSpace(Address))
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("L'adresse du rendez-vous est requise.");
|
StatusMessage = "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)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez au moins une prestation coiffure.");
|
StatusMessage = "Sélectionnez au moins une prestation coiffure.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,18 +109,18 @@ public partial class MBrushViewModel : BrushViewModel
|
||||||
}).ConfigureAwait(true);
|
}).ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.SetInfoStatus(IsEditingExisting
|
StatusMessage = 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)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur lors de l'envoi de la commande: {ex.Message}");
|
StatusMessage = $"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;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.SetInfoStatus($"Commande #{existingQuery.Id} chargée.");
|
StatusMessage = $"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)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus(result.Message);
|
StatusMessage = result.Message;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Latitude = result.Latitude.Value;
|
Latitude = result.Latitude.Value;
|
||||||
Longitude = result.Longitude.Value;
|
Longitude = result.Longitude.Value;
|
||||||
this.SetInfoStatus(string.IsNullOrWhiteSpace(Address)
|
StatusMessage = 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)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("La récupération de la position a été annulée.");
|
StatusMessage = "La récupération de la position a été annulée.";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Impossible de récupérer la position: {ex.Message}");
|
StatusMessage = $"Impossible de récupérer la position: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -118,26 +118,26 @@ public partial class RdvViewModel : BillingCommandPageViewModel
|
||||||
{
|
{
|
||||||
if (!IsSupported)
|
if (!IsSupported)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus(SupportMessage);
|
StatusMessage = SupportMessage;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Consent)
|
if (!Consent)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Le consentement est requis pour poster la commande.");
|
StatusMessage = "Le consentement est requis pour poster la commande.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Address))
|
if (string.IsNullOrWhiteSpace(Address))
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("L'adresse du rendez-vous est requise.");
|
StatusMessage = "L'adresse du rendez-vous est requise.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Reason))
|
if (string.IsNullOrWhiteSpace(Reason))
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Le motif du rendez-vous est requis.");
|
StatusMessage = "Le motif du rendez-vous est requis.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,17 +186,17 @@ public partial class RdvViewModel : BillingCommandPageViewModel
|
||||||
}).ConfigureAwait(true);
|
}).ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.SetInfoStatus(IsEditingExisting
|
StatusMessage = 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)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.");
|
StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous.";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur lors de l'envoi: {ex.Message}");
|
StatusMessage = $"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, IActionStatusViewModel
|
public partial class MainViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
/// <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,9 +54,6 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
[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; }
|
||||||
|
|
||||||
|
|
@ -87,7 +84,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
Posts.Add(post);
|
Posts.Add(post);
|
||||||
}
|
}
|
||||||
ApplyFilter();
|
ApplyFilter();
|
||||||
this.SetInfoStatus($"{Posts.Count} billet(s) chargé(s).");
|
StatusMessage = $"Loaded {Posts.Count} posts.";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,7 +104,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
// 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))
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Le titre est obligatoire.");
|
StatusMessage = "Title is required.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,7 +134,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
if (created is not null)
|
if (created is not null)
|
||||||
{
|
{
|
||||||
SelectedPost = created;
|
SelectedPost = created;
|
||||||
this.SetInfoStatus($"Billet {created.Id} créé.");
|
StatusMessage = $"Created post {created.Id}.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -153,7 +150,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
DateModified = DateTime.UtcNow,
|
DateModified = DateTime.UtcNow,
|
||||||
};
|
};
|
||||||
await BlogClient!.UpdatePostAsync(SelectedPost.Id, update);
|
await BlogClient!.UpdatePostAsync(SelectedPost.Id, update);
|
||||||
this.SetInfoStatus($"Billet {SelectedPost.Id} enregistré.");
|
StatusMessage = $"Saved post {SelectedPost.Id}.";
|
||||||
}
|
}
|
||||||
|
|
||||||
await RefreshPostsAsync();
|
await RefreshPostsAsync();
|
||||||
|
|
@ -165,14 +162,14 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
if (SelectedPost is null || SelectedPost.Id == 0)
|
if (SelectedPost is null || SelectedPost.Id == 0)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez un billet existant avant suppression.");
|
StatusMessage = "Select an existing post before deleting.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ExecuteAsync(async () =>
|
await ExecuteAsync(async () =>
|
||||||
{
|
{
|
||||||
await BlogClient!.DeletePostAsync(SelectedPost.Id);
|
await BlogClient!.DeletePostAsync(SelectedPost.Id);
|
||||||
this.SetInfoStatus($"Billet {SelectedPost.Id} supprimé.");
|
StatusMessage = $"Deleted post {SelectedPost.Id}.";
|
||||||
SelectedPost = null;
|
SelectedPost = null;
|
||||||
await RefreshPostsAsync();
|
await RefreshPostsAsync();
|
||||||
});
|
});
|
||||||
|
|
@ -197,7 +194,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
if (SelectedPost is null || SelectedPost.Id == 0)
|
if (SelectedPost is null || SelectedPost.Id == 0)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez un billet existant pour changer sa publication.");
|
StatusMessage = "Sélectionnez un billet existant pour changer sa publication.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,9 +211,9 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
// 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;
|
||||||
this.SetInfoStatus(publish
|
StatusMessage = publish
|
||||||
? $"Billet {SelectedPost.Id} publié."
|
? $"Billet {SelectedPost.Id} publié."
|
||||||
: $"Billet {SelectedPost.Id} remis en brouillon.");
|
: $"Billet {SelectedPost.Id} remis en brouillon.";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,7 +247,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
{
|
{
|
||||||
if (SelectedPost is null)
|
if (SelectedPost is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez un billet existant avant de gérer l'ACL.");
|
StatusMessage = "Select an existing post before managing ACL.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -349,7 +346,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
FilteredPosts = new ObservableCollection<BlogPostDto>();
|
FilteredPosts = new ObservableCollection<BlogPostDto>();
|
||||||
SelectedPost = null;
|
SelectedPost = null;
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
this.SetInfoStatus("Prêt.");
|
StatusMessage = "Ready";
|
||||||
Settings = settings ?? new Settings();
|
Settings = settings ?? new Settings();
|
||||||
SearchText = Settings.SearchText;
|
SearchText = Settings.SearchText;
|
||||||
WindowTitle = "PostIt";
|
WindowTitle = "PostIt";
|
||||||
|
|
@ -479,12 +476,12 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IsBusy = true;
|
IsBusy = true;
|
||||||
this.SetInfoStatus("Traitement en cours...");
|
StatusMessage = "Working...";
|
||||||
await action();
|
await action();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Error: {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, IActionStatusViewModel
|
public partial class PostAclDialogViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private readonly BlogAclApiClient _aclClient;
|
private readonly BlogAclApiClient _aclClient;
|
||||||
private readonly CircleApiClient _circleClient;
|
private readonly CircleApiClient _circleClient;
|
||||||
|
|
@ -61,10 +61,7 @@ public partial class PostAclDialogViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
public partial bool IsBusy { get; set; }
|
public partial bool IsBusy { get; set; }
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = "Pret.";
|
public partial string StatusMessage { get; set; } = string.Empty;
|
||||||
|
|
||||||
[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
|
||||||
|
|
@ -118,12 +115,12 @@ public partial class PostAclDialogViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
AclEntries = new ObservableCollection<PostAclEntry>(AclEntries.Select(a => ToAclEntry(a.CircleId)));
|
AclEntries = new ObservableCollection<PostAclEntry>(AclEntries.Select(a => ToAclEntry(a.CircleId)));
|
||||||
|
|
||||||
|
|
||||||
this.SetInfoStatus($"{AclEntries.Count} autorisation(s)");
|
StatusMessage = $"{AclEntries.Count} autorisation(s)";
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -136,7 +133,7 @@ public partial class PostAclDialogViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
{
|
{
|
||||||
if (SelectedCircleToAdd is null)
|
if (SelectedCircleToAdd is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Sélectionnez un cercle à ajouter");
|
StatusMessage = "Sélectionnez un cercle à ajouter";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,7 +142,7 @@ public partial class PostAclDialogViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
{
|
{
|
||||||
if (AclEntries.Any(a => a.CircleId == SelectedCircleToAdd.Id))
|
if (AclEntries.Any(a => a.CircleId == SelectedCircleToAdd.Id))
|
||||||
{
|
{
|
||||||
this.SetWarningStatus($"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé");
|
StatusMessage = $"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,11 +154,11 @@ public partial class PostAclDialogViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
if (created is not null)
|
if (created is not null)
|
||||||
{
|
{
|
||||||
AclEntries.Add(ToAclEntry(created.CircleId));
|
AclEntries.Add(ToAclEntry(created.CircleId));
|
||||||
this.SetInfoStatus($"Cercle « {SelectedCircleToAdd.Name} » autorisé");
|
StatusMessage = $"Cercle « {SelectedCircleToAdd.Name} » autorisé";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Autorisation refusée par le serveur");
|
StatusMessage = "Autorisation refusée par le serveur";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.Conflict)
|
catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.Conflict)
|
||||||
|
|
@ -169,11 +166,11 @@ public partial class PostAclDialogViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
// 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();
|
||||||
this.SetWarningStatus($"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé");
|
StatusMessage = $"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -192,11 +189,11 @@ public partial class PostAclDialogViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
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);
|
||||||
this.SetInfoStatus("Autorisation révoquée");
|
StatusMessage = "Autorisation révoquée";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,19 +31,6 @@ 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
|
||||||
|
|
@ -419,8 +406,6 @@ 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");
|
||||||
|
|
@ -440,13 +425,10 @@ 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, IActionStatusViewModel
|
public partial class SignaturePageViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default capture surface, in DIPs. 3:1 ratio matches a
|
/// Default capture surface, in DIPs. 3:1 ratio matches a
|
||||||
|
|
@ -42,9 +42,6 @@ public partial class SignaturePageViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
[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; }
|
||||||
|
|
||||||
|
|
@ -110,7 +107,7 @@ public partial class SignaturePageViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
|
|
||||||
private void OnStrokeCompleted(object? sender, SignaturePadData data)
|
private void OnStrokeCompleted(object? sender, SignaturePadData data)
|
||||||
{
|
{
|
||||||
this.SetInfoStatus($"Trait terminé. {data.StrokeCount} trait(s).");
|
StatusMessage = $"Trait terminé. {data.StrokeCount} trait(s).";
|
||||||
RefreshCounts();
|
RefreshCounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +125,7 @@ public partial class SignaturePageViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
_control?.Clear();
|
_control?.Clear();
|
||||||
this.SetInfoStatus("Effacé.");
|
StatusMessage = "Effacé.";
|
||||||
RefreshCounts();
|
RefreshCounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,14 +134,14 @@ public partial class SignaturePageViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
{
|
{
|
||||||
if (_control is null)
|
if (_control is null)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Contrôle non attaché.");
|
StatusMessage = "Contrôle non attaché.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = _control.Snapshot();
|
var data = _control.Snapshot();
|
||||||
if (data.IsEmpty)
|
if (data.IsEmpty)
|
||||||
{
|
{
|
||||||
this.SetWarningStatus("Rien à capturer.");
|
StatusMessage = "Rien à capturer.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,11 +149,11 @@ public partial class SignaturePageViewModel : ViewModelBase, IActionStatusViewMo
|
||||||
{
|
{
|
||||||
var path = WriteCapture(data);
|
var path = WriteCapture(data);
|
||||||
LastCapturedPath = path;
|
LastCapturedPath = path;
|
||||||
this.SetInfoStatus($"Capture enregistrée: {path}");
|
StatusMessage = $"Capture enregistrée: {path}";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.SetErrorStatus($"Erreur: {ex.Message}");
|
StatusMessage = $"Erreur: {ex.Message}";
|
||||||
}
|
}
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
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,7 +1,6 @@
|
||||||
<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"
|
||||||
|
|
@ -132,8 +131,16 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Grid.Row="2" ColumnDefinitions="*,Auto">
|
<Grid Grid.Row="2" ColumnDefinitions="*,Auto">
|
||||||
<postitControls:StatusBar Grid.Column="0"
|
<TextBox Grid.Column="0"
|
||||||
DataContext="{Binding ActionStatus}" />
|
Text="{Binding StatusMessage}"
|
||||||
|
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,7 +3,6 @@
|
||||||
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"
|
||||||
>
|
>
|
||||||
|
|
@ -48,8 +47,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">
|
||||||
<postitControls:StatusBar Grid.Column="0"
|
<TextBlock Grid.Column="0" Text="{Binding StatusMessage}"
|
||||||
DataContext="{Binding ActionStatus}" />
|
VerticalAlignment="Center"/>
|
||||||
<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,8 +1,10 @@
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
@ -39,4 +41,10 @@ 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,7 +1,6 @@
|
||||||
<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">
|
||||||
|
|
@ -37,8 +36,16 @@
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|
||||||
<Grid Grid.Row="3" ColumnDefinitions="*,Auto" Margin="0,12,0,0">
|
<Grid Grid.Row="3" ColumnDefinitions="*,Auto" Margin="0,12,0,0">
|
||||||
<postitControls:StatusBar Grid.Column="0"
|
<TextBox Grid.Column="0"
|
||||||
DataContext="{Binding ActionStatus}" />
|
Text="{Binding StatusMessage}"
|
||||||
|
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,7 +1,6 @@
|
||||||
<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"
|
||||||
|
|
@ -102,8 +101,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">
|
||||||
<postitControls:StatusBar Grid.Column="0"
|
<TextBlock Grid.Column="0" Text="{Binding StatusMessage}"
|
||||||
DataContext="{Binding ActionStatus}" />
|
VerticalAlignment="Center"/>
|
||||||
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
||||||
IsVisible="{Binding IsBusy}"
|
IsVisible="{Binding IsBusy}"
|
||||||
Width="120"/>
|
Width="120"/>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<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"
|
||||||
|
|
@ -42,8 +41,16 @@
|
||||||
<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}" />
|
||||||
<postitControls:StatusBar Grid.Column="6"
|
<TextBox Grid.Column="6"
|
||||||
DataContext="{Binding ActionStatus}" />
|
Text="{Binding StatusMessage}"
|
||||||
|
IsReadOnly="True"
|
||||||
|
AcceptsReturn="True"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
BorderThickness="0"
|
||||||
|
BorderBrush="Transparent"
|
||||||
|
Padding="0"
|
||||||
|
Background="Transparent"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
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"
|
||||||
|
|
||||||
|
|
@ -94,8 +93,16 @@
|
||||||
Content="{Binding SubmitLabel}"
|
Content="{Binding SubmitLabel}"
|
||||||
Command="{Binding SubmitCommand}"
|
Command="{Binding SubmitCommand}"
|
||||||
IsEnabled="{Binding IsSupported}" />
|
IsEnabled="{Binding IsSupported}" />
|
||||||
<postitControls:StatusBar Grid.Column="2"
|
<TextBox Grid.Column="2"
|
||||||
DataContext="{Binding ActionStatus}" />
|
Text="{Binding StatusMessage}"
|
||||||
|
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,7 +1,6 @@
|
||||||
<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">
|
||||||
|
|
@ -72,8 +71,16 @@
|
||||||
Content="{Binding SubmitLabel}"
|
Content="{Binding SubmitLabel}"
|
||||||
Command="{Binding SubmitCommand}"
|
Command="{Binding SubmitCommand}"
|
||||||
IsEnabled="{Binding IsSupported}" />
|
IsEnabled="{Binding IsSupported}" />
|
||||||
<postitControls:StatusBar Grid.Column="2"
|
<TextBox Grid.Column="2"
|
||||||
DataContext="{Binding ActionStatus}" />
|
Text="{Binding StatusMessage}"
|
||||||
|
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,7 +3,6 @@
|
||||||
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"
|
||||||
|
|
@ -105,8 +104,7 @@
|
||||||
VerticalAlignment="Stretch">
|
VerticalAlignment="Stretch">
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
<postitControls:StatusBar Grid.Row="3"
|
<TextBlock Grid.Row="3" Text="{Binding StatusMessage}" Foreground="Gray" />
|
||||||
DataContext="{Binding ActionStatus}" />
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
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"
|
||||||
>
|
>
|
||||||
|
|
@ -54,8 +53,8 @@
|
||||||
|
|
||||||
<!-- Status bar -->
|
<!-- Status bar -->
|
||||||
<Grid Grid.Row="3" ColumnDefinitions="*,Auto">
|
<Grid Grid.Row="3" ColumnDefinitions="*,Auto">
|
||||||
<postitControls:StatusBar Grid.Column="0"
|
<TextBlock Grid.Column="0" Text="{Binding StatusMessage}"
|
||||||
DataContext="{Binding ActionStatus}" />
|
VerticalAlignment="Center"/>
|
||||||
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
||||||
IsVisible="{Binding IsBusy}"
|
IsVisible="{Binding IsBusy}"
|
||||||
Width="120"/>
|
Width="120"/>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
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"
|
||||||
|
|
@ -52,7 +51,9 @@
|
||||||
Opacity="0.8"
|
Opacity="0.8"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
|
|
||||||
<postitControls:StatusBar DataContext="{Binding ActionStatus}"/>
|
<TextBlock x:Name="AvatarUploadStatusText"
|
||||||
|
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("Selection d'un fichier avatar...", StatusSeverity.Info);
|
SetAvatarStatus("Sélection d'un fichier avatar...", Brushes.Gray);
|
||||||
|
|
||||||
var topLevel = TopLevel.GetTopLevel(this);
|
var topLevel = TopLevel.GetTopLevel(this);
|
||||||
if (topLevel is null)
|
if (topLevel is null)
|
||||||
{
|
{
|
||||||
SetAvatarStatus("Impossible d'acceder a la fenetre active.", StatusSeverity.Error);
|
SetAvatarStatus("Impossible d'accéder à la fenêtre active.", Brushes.IndianRed);
|
||||||
ChooseAvatarButton.IsEnabled = true;
|
ChooseAvatarButton.IsEnabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -54,28 +54,27 @@ public partial class SettingsPage: ContentPage
|
||||||
var file = files.FirstOrDefault();
|
var file = files.FirstOrDefault();
|
||||||
if (file is null)
|
if (file is null)
|
||||||
{
|
{
|
||||||
SetAvatarStatus("Upload annule.", StatusSeverity.Warning);
|
SetAvatarStatus("Upload annulé.", Brushes.Gray);
|
||||||
ChooseAvatarButton.IsEnabled = true;
|
ChooseAvatarButton.IsEnabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SetAvatarStatus("Upload avatar en cours...", StatusSeverity.Info);
|
SetAvatarStatus("Upload avatar en cours...", Brushes.Gray);
|
||||||
|
|
||||||
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 a jour."
|
? "Avatar mis à jour."
|
||||||
: message,
|
: message, Brushes.ForestGreen);
|
||||||
StatusSeverity.Info);
|
|
||||||
|
|
||||||
_ = ClearSuccessStatusLaterAsync(statusVersion);
|
_ = ClearSuccessStatusLaterAsync(statusVersion);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
SetAvatarStatus($"Echec upload avatar: {ex.Message}", StatusSeverity.Error);
|
SetAvatarStatus($"Échec upload avatar: {ex.Message}", Brushes.IndianRed);
|
||||||
Console.Error.WriteLine($"🩎 Avatar upload failed: {ex.Message}");
|
Console.Error.WriteLine($"🩎 Avatar upload failed: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
@ -90,15 +89,16 @@ public partial class SettingsPage: ContentPage
|
||||||
if (statusVersion != _avatarStatusVersion)
|
if (statusVersion != _avatarStatusVersion)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetAvatarStatus($"Avatar pret. Formats supportes: {AcceptedAvatarFormats}. Taille max: {MaxAvatarSizeMegabytes} MB.", StatusSeverity.Info);
|
if (AvatarUploadStatusText.Foreground == Brushes.ForestGreen)
|
||||||
|
{
|
||||||
|
SetAvatarStatus($"Avatar prêt. Formats supportés: {AcceptedAvatarFormats}. Taille max: {MaxAvatarSizeMegabytes} MB.", Brushes.Gray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAvatarStatus(string message, StatusSeverity severity)
|
private void SetAvatarStatus(string message, IBrush color)
|
||||||
{
|
{
|
||||||
if (DataContext is Settings settings)
|
AvatarUploadStatusText.Foreground = color;
|
||||||
{
|
AvatarUploadStatusText.Text = message;
|
||||||
settings.SetActionStatus(message, severity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetMimeType(string fileName)
|
private static string GetMimeType(string fileName)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
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"
|
||||||
|
|
@ -60,8 +59,10 @@
|
||||||
<Button Content="Capturer" Command="{Binding CaptureAsync}" />
|
<Button Content="Capturer" Command="{Binding CaptureAsync}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<postitControls:StatusBar Grid.Row="3"
|
<TextBlock Grid.Row="3"
|
||||||
DataContext="{Binding ActionStatus}" />
|
Text="{Binding StatusMessage}"
|
||||||
|
Foreground="Gray"
|
||||||
|
TextWrapping="Wrap" />
|
||||||
|
|
||||||
<TextBlock Grid.Row="4"
|
<TextBlock Grid.Row="4"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
using Yavsc.Services;
|
using Yavsc.Services;
|
||||||
|
|
||||||
namespace Yavsc.Billing
|
namespace Yavsc.Billing
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
namespace Yavsc.Blogspot;
|
namespace Yavsc.Blogspot;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
using Yavsc.Abstract.Identity.Security;
|
using Yavsc.Abstract.Identity.Security;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Chat
|
namespace Yavsc.Abstract.Chat
|
||||||
{
|
{
|
||||||
public static class ChatHubConstants
|
public static class ChatHubConstants
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Chat
|
namespace Yavsc.Abstract.Chat
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
#nullable enable annotations
|
using System.Text;
|
||||||
|
|
||||||
using System.Text;
|
|
||||||
using Yavsc.ViewModels.UserFiles;
|
using Yavsc.ViewModels.UserFiles;
|
||||||
|
|
||||||
namespace Yavsc.Server.Helpers
|
namespace Yavsc.Server.Helpers
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Helpers
|
namespace Yavsc.Abstract.Helpers
|
||||||
{
|
{
|
||||||
public enum ErrorCode {
|
public enum ErrorCode {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
using Yavsc.Server.Helpers;
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.ViewModels.UserFiles
|
namespace Yavsc.ViewModels.UserFiles
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// GDate.cs
|
// GDate.cs
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// MessageWithPayloadResponse.cs
|
// MessageWithPayloadResponse.cs
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#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,6 +1,4 @@
|
||||||
#nullable enable annotations
|
namespace Yavsc.Abstract.Identity
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Identity
|
|
||||||
{
|
{
|
||||||
public interface IApplicationUser
|
public interface IApplicationUser
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
namespace Yavsc.Abstract.Identity
|
namespace Yavsc.Abstract.Identity
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
#nullable enable annotations
|
using Yavsc.Abstract.Identity;
|
||||||
|
|
||||||
using Yavsc.Abstract.Identity;
|
|
||||||
|
|
||||||
namespace Yavsc.Interfaces
|
namespace Yavsc.Interfaces
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
|
|
||||||
using Yavsc.Interfaces;
|
using Yavsc.Interfaces;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// BookQueryEvent.cs
|
// BookQueryEvent.cs
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
using Yavsc.Abstract.Identity;
|
using Yavsc.Abstract.Identity;
|
||||||
using Yavsc.Models.Relationship;
|
using Yavsc.Models.Relationship;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
#nullable enable annotations
|
// Copyright (C) 2016 Paul Schneider
|
||||||
|
|
||||||
// Copyright (C) 2016 Paul Schneider
|
|
||||||
//
|
//
|
||||||
// This file is part of yavsc.
|
// This file is part of yavsc.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#nullable enable annotations
|
|
||||||
|
|
||||||
namespace Yavsc.Workflow
|
namespace Yavsc.Workflow
|
||||||
{
|
{
|
||||||
public interface IPerformerProfile
|
public interface IPerformerProfile
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#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