postit: persist settings save and apply ApiUrl changes without restart #51
12 changed files with 159 additions and 40 deletions
postit: unify action status bar with severity across settings/activities/circles/rdv
commit
c1c060799d
22
src/PostIt/PostIt/Controls/StatusBar.axaml
Normal file
22
src/PostIt/PostIt/Controls/StatusBar.axaml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
|
x:Class="PostIt.Controls.StatusBar"
|
||||||
|
x:DataType="vm:StatusNotice">
|
||||||
|
<Border Background="{Binding Background}"
|
||||||
|
BorderBrush="{Binding BorderBrush}"
|
||||||
|
BorderThickness="1"
|
||||||
|
CornerRadius="6"
|
||||||
|
Padding="8">
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
|
<TextBlock Text="{Binding Glyph}"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="{Binding Foreground}"
|
||||||
|
VerticalAlignment="Top"/>
|
||||||
|
<TextBlock Text="{Binding Message}"
|
||||||
|
Foreground="{Binding Foreground}"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
||||||
11
src/PostIt/PostIt/Controls/StatusBar.axaml.cs
Normal file
11
src/PostIt/PostIt/Controls/StatusBar.axaml.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace PostIt.Controls;
|
||||||
|
|
||||||
|
public partial class StatusBar : UserControl
|
||||||
|
{
|
||||||
|
public StatusBar()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -43,6 +43,14 @@ public partial class ActivitiesPageViewModel : ViewModelBase
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = "Choisissez une activité.";
|
public partial string StatusMessage { get; set; } = "Choisissez une activité.";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Choisissez une activité.");
|
||||||
|
|
||||||
|
partial void OnStatusMessageChanged(string value)
|
||||||
|
{
|
||||||
|
ActionStatus = StatusNotice.FromMessage(value);
|
||||||
|
}
|
||||||
|
|
||||||
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)";
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,14 @@ public partial class CirclesPageViewModel : ViewModelBase
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string StatusMessage { get; set; } = string.Empty;
|
public partial string StatusMessage { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
||||||
|
|
||||||
|
partial void OnStatusMessageChanged(string value)
|
||||||
|
{
|
||||||
|
ActionStatus = StatusNotice.FromMessage(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public CirclesPageViewModel(CircleApiClient client)
|
public CirclesPageViewModel(CircleApiClient client)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase
|
||||||
[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 Reason { get; set; } = string.Empty;
|
public partial string Reason { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
@ -89,6 +92,11 @@ public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase
|
||||||
OnPropertyChanged(nameof(CanUseCurrentLocation));
|
OnPropertyChanged(nameof(CanUseCurrentLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partial void OnStatusMessageChanged(string value)
|
||||||
|
{
|
||||||
|
ActionStatus = StatusNotice.FromMessage(value);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task InitializeAsync(BillingQueryDetailsDto? existingQuery = null)
|
public async Task InitializeAsync(BillingQueryDetailsDto? existingQuery = null)
|
||||||
{
|
{
|
||||||
await LoadAsync();
|
await LoadAsync();
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,19 @@ public partial class Settings : ViewModelBase
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public partial string SearchText { get; set; } = string.Empty;
|
public partial string SearchText { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
|
||||||
|
|
||||||
|
public void SetActionStatus(string message, StatusSeverity severity = StatusSeverity.Info)
|
||||||
|
{
|
||||||
|
ActionStatus = severity switch
|
||||||
|
{
|
||||||
|
StatusSeverity.Error => StatusNotice.Error(message),
|
||||||
|
StatusSeverity.Warning => StatusNotice.Warning(message),
|
||||||
|
_ => StatusNotice.Info(message),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Catch top-level mutations: the four ObservableProperty
|
/// Catch top-level mutations: the four ObservableProperty
|
||||||
/// setters above all funnel through here, and we flip
|
/// setters above all funnel through here, and we flip
|
||||||
|
|
@ -406,6 +419,8 @@ public partial class Settings : ViewModelBase
|
||||||
[RelayCommand(CanExecute = nameof(CanSave))]
|
[RelayCommand(CanExecute = nameof(CanSave))]
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
|
SetActionStatus("Enregistrement des parametres...", StatusSeverity.Info);
|
||||||
|
|
||||||
var configDir = Path.Combine(
|
var configDir = Path.Combine(
|
||||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||||
"PostIt");
|
"PostIt");
|
||||||
|
|
@ -425,10 +440,13 @@ public partial class Settings : ViewModelBase
|
||||||
File.SetUnixFileMode(configPath,
|
File.SetUnixFileMode(configPath,
|
||||||
UnixFileMode.UserRead | UnixFileMode.UserWrite);
|
UnixFileMode.UserRead | UnixFileMode.UserWrite);
|
||||||
IsDirty = false;
|
IsDirty = false;
|
||||||
|
SetActionStatus("Parametres sauvegardes.", StatusSeverity.Info);
|
||||||
|
|
||||||
Console.WriteLine($"💾 Settings saved to {configPath}");
|
Console.WriteLine($"💾 Settings saved to {configPath}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
SetActionStatus($"Echec sauvegarde parametres: {ex.Message}", StatusSeverity.Error);
|
||||||
Console.Error.WriteLine($"🩎 Error saving settings to {configPath}: {ex.Message}");
|
Console.Error.WriteLine($"🩎 Error saving settings to {configPath}: {ex.Message}");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
58
src/PostIt/PostIt/ViewModels/StatusNotice.cs
Normal file
58
src/PostIt/PostIt/ViewModels/StatusNotice.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
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);
|
||||||
|
|
||||||
|
public static StatusNotice FromMessage(string? message)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(message))
|
||||||
|
{
|
||||||
|
return Info("Pret.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = message.Trim();
|
||||||
|
var lower = text.ToLowerInvariant();
|
||||||
|
|
||||||
|
if (lower.StartsWith("erreur") || lower.StartsWith("echec") || lower.StartsWith("impossible"))
|
||||||
|
{
|
||||||
|
return Error(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lower.Contains("refuse") || lower.Contains("annule") || lower.Contains("obligatoire") || lower.Contains("deja"))
|
||||||
|
{
|
||||||
|
return Warning(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Info(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<ContentPage xmlns="https://github.com/avaloniaui"
|
<ContentPage xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
xmlns:wf="using:Yavsc.Abstract.Workflow"
|
xmlns:wf="using:Yavsc.Abstract.Workflow"
|
||||||
x:Class="PostIt.Views.ActivitiesPage"
|
x:Class="PostIt.Views.ActivitiesPage"
|
||||||
x:DataType="vm:ActivitiesPageViewModel"
|
x:DataType="vm:ActivitiesPageViewModel"
|
||||||
|
|
@ -131,16 +132,8 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Grid.Row="2" ColumnDefinitions="*,Auto">
|
<Grid Grid.Row="2" ColumnDefinitions="*,Auto">
|
||||||
<TextBox Grid.Column="0"
|
<postitControls:StatusBar Grid.Column="0"
|
||||||
Text="{Binding StatusMessage}"
|
DataContext="{Binding ActionStatus}" />
|
||||||
IsReadOnly="True"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
BorderThickness="0"
|
|
||||||
BorderBrush="Transparent"
|
|
||||||
Padding="0"
|
|
||||||
Background="Transparent"
|
|
||||||
VerticalAlignment="Center" />
|
|
||||||
<ProgressBar Grid.Column="1" Width="120" IsIndeterminate="True" IsVisible="{Binding IsBusy}" />
|
<ProgressBar Grid.Column="1" Width="120" IsIndeterminate="True" IsVisible="{Binding IsBusy}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<ContentPage
|
<ContentPage
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
x:Class="PostIt.Views.CirclesPage"
|
x:Class="PostIt.Views.CirclesPage"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
xmlns:dtos="using:Yavsc.Api.Client.Dtos"
|
xmlns:dtos="using:Yavsc.Api.Client.Dtos"
|
||||||
|
|
@ -101,8 +102,8 @@
|
||||||
|
|
||||||
<!-- Status bar -->
|
<!-- Status bar -->
|
||||||
<Grid Grid.Row="2" ColumnDefinitions="*,Auto" Margin="12,0,12,12">
|
<Grid Grid.Row="2" ColumnDefinitions="*,Auto" Margin="12,0,12,12">
|
||||||
<TextBlock Grid.Column="0" Text="{Binding StatusMessage}"
|
<postitControls:StatusBar Grid.Column="0"
|
||||||
VerticalAlignment="Center"/>
|
DataContext="{Binding ActionStatus}" />
|
||||||
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
||||||
IsVisible="{Binding IsBusy}"
|
IsVisible="{Binding IsBusy}"
|
||||||
Width="120"/>
|
Width="120"/>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<ContentPage xmlns="https://github.com/avaloniaui"
|
<ContentPage xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:cvm="using:PostIt.ViewModels.Commands"
|
xmlns:cvm="using:PostIt.ViewModels.Commands"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
x:Class="PostIt.Views.Commands.RdvPage"
|
x:Class="PostIt.Views.Commands.RdvPage"
|
||||||
x:DataType="cvm:RdvViewModel"
|
x:DataType="cvm:RdvViewModel"
|
||||||
Header="Commande billing">
|
Header="Commande billing">
|
||||||
|
|
@ -71,16 +72,8 @@
|
||||||
Content="{Binding SubmitLabel}"
|
Content="{Binding SubmitLabel}"
|
||||||
Command="{Binding SubmitCommand}"
|
Command="{Binding SubmitCommand}"
|
||||||
IsEnabled="{Binding IsSupported}" />
|
IsEnabled="{Binding IsSupported}" />
|
||||||
<TextBox Grid.Column="2"
|
<postitControls:StatusBar Grid.Column="2"
|
||||||
Text="{Binding StatusMessage}"
|
DataContext="{Binding ActionStatus}" />
|
||||||
IsReadOnly="True"
|
|
||||||
AcceptsReturn="True"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
BorderThickness="0"
|
|
||||||
BorderBrush="Transparent"
|
|
||||||
Padding="0"
|
|
||||||
Background="Transparent"
|
|
||||||
VerticalAlignment="Center" />
|
|
||||||
<ProgressBar Grid.Column="3"
|
<ProgressBar Grid.Column="3"
|
||||||
Width="120"
|
Width="120"
|
||||||
IsIndeterminate="True"
|
IsIndeterminate="True"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="cl:avalonia.Controls"
|
xmlns:controls="cl:avalonia.Controls"
|
||||||
|
xmlns:postitControls="using:PostIt.Controls"
|
||||||
x:Class="PostIt.Views.SettingsPage"
|
x:Class="PostIt.Views.SettingsPage"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
x:DataType="vm:Settings"
|
x:DataType="vm:Settings"
|
||||||
|
|
@ -51,9 +52,7 @@
|
||||||
Opacity="0.8"
|
Opacity="0.8"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
|
|
||||||
<TextBlock x:Name="AvatarUploadStatusText"
|
<postitControls:StatusBar DataContext="{Binding ActionStatus}"/>
|
||||||
Text=""
|
|
||||||
TextWrapping="Wrap" />
|
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button x:Name="ChooseAvatarButton"
|
<Button x:Name="ChooseAvatarButton"
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Media;
|
|
||||||
using Avalonia.Platform.Storage;
|
using Avalonia.Platform.Storage;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using PostIt.Services;
|
using PostIt.Services;
|
||||||
|
using PostIt.ViewModels;
|
||||||
|
|
||||||
namespace PostIt.Views;
|
namespace PostIt.Views;
|
||||||
public partial class SettingsPage: ContentPage
|
public partial class SettingsPage: ContentPage
|
||||||
|
|
@ -28,12 +28,12 @@ public partial class SettingsPage: ContentPage
|
||||||
{
|
{
|
||||||
var statusVersion = Interlocked.Increment(ref _avatarStatusVersion);
|
var statusVersion = Interlocked.Increment(ref _avatarStatusVersion);
|
||||||
ChooseAvatarButton.IsEnabled = false;
|
ChooseAvatarButton.IsEnabled = false;
|
||||||
SetAvatarStatus("Sélection d'un fichier avatar...", Brushes.Gray);
|
SetAvatarStatus("Selection d'un fichier avatar...", StatusSeverity.Info);
|
||||||
|
|
||||||
var topLevel = TopLevel.GetTopLevel(this);
|
var topLevel = TopLevel.GetTopLevel(this);
|
||||||
if (topLevel is null)
|
if (topLevel is null)
|
||||||
{
|
{
|
||||||
SetAvatarStatus("Impossible d'accéder à la fenêtre active.", Brushes.IndianRed);
|
SetAvatarStatus("Impossible d'acceder a la fenetre active.", StatusSeverity.Error);
|
||||||
ChooseAvatarButton.IsEnabled = true;
|
ChooseAvatarButton.IsEnabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -54,27 +54,28 @@ public partial class SettingsPage: ContentPage
|
||||||
var file = files.FirstOrDefault();
|
var file = files.FirstOrDefault();
|
||||||
if (file is null)
|
if (file is null)
|
||||||
{
|
{
|
||||||
SetAvatarStatus("Upload annulé.", Brushes.Gray);
|
SetAvatarStatus("Upload annule.", StatusSeverity.Warning);
|
||||||
ChooseAvatarButton.IsEnabled = true;
|
ChooseAvatarButton.IsEnabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SetAvatarStatus("Upload avatar en cours...", Brushes.Gray);
|
SetAvatarStatus("Upload avatar en cours...", StatusSeverity.Info);
|
||||||
|
|
||||||
await using var stream = await file.OpenReadAsync();
|
await using var stream = await file.OpenReadAsync();
|
||||||
var api = ((App)App.Current!).ServiceProvider!.GetRequiredService<YavscApiClient>();
|
var api = ((App)App.Current!).ServiceProvider!.GetRequiredService<YavscApiClient>();
|
||||||
var message = await api.SetAvatarAsync(stream, file.Name, GetMimeType(file.Name));
|
var message = await api.SetAvatarAsync(stream, file.Name, GetMimeType(file.Name));
|
||||||
SetAvatarStatus(string.IsNullOrWhiteSpace(message)
|
SetAvatarStatus(string.IsNullOrWhiteSpace(message)
|
||||||
? "Avatar mis à jour."
|
? "Avatar mis a jour."
|
||||||
: message, Brushes.ForestGreen);
|
: message,
|
||||||
|
StatusSeverity.Info);
|
||||||
|
|
||||||
_ = ClearSuccessStatusLaterAsync(statusVersion);
|
_ = ClearSuccessStatusLaterAsync(statusVersion);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
SetAvatarStatus($"Échec upload avatar: {ex.Message}", Brushes.IndianRed);
|
SetAvatarStatus($"Echec upload avatar: {ex.Message}", StatusSeverity.Error);
|
||||||
Console.Error.WriteLine($"🩎 Avatar upload failed: {ex.Message}");
|
Console.Error.WriteLine($"🩎 Avatar upload failed: {ex.Message}");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
@ -89,16 +90,15 @@ public partial class SettingsPage: ContentPage
|
||||||
if (statusVersion != _avatarStatusVersion)
|
if (statusVersion != _avatarStatusVersion)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (AvatarUploadStatusText.Foreground == Brushes.ForestGreen)
|
SetAvatarStatus($"Avatar pret. Formats supportes: {AcceptedAvatarFormats}. Taille max: {MaxAvatarSizeMegabytes} MB.", StatusSeverity.Info);
|
||||||
{
|
|
||||||
SetAvatarStatus($"Avatar prêt. Formats supportés: {AcceptedAvatarFormats}. Taille max: {MaxAvatarSizeMegabytes} MB.", Brushes.Gray);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAvatarStatus(string message, IBrush color)
|
private void SetAvatarStatus(string message, StatusSeverity severity)
|
||||||
{
|
{
|
||||||
AvatarUploadStatusText.Foreground = color;
|
if (DataContext is Settings settings)
|
||||||
AvatarUploadStatusText.Text = message;
|
{
|
||||||
|
settings.SetActionStatus(message, severity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetMimeType(string fileName)
|
private static string GetMimeType(string fileName)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue