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