1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Device properties - Show layout error state

This commit is contained in:
Robert 2024-03-30 20:28:01 +01:00
parent 107b604c86
commit f152812064
3 changed files with 17 additions and 2 deletions

View File

@ -7,6 +7,7 @@ public class LayoutSelection : CorePropertyChanged
{ {
private string? _type; private string? _type;
private string? _parameter; private string? _parameter;
private string? _errorState;
/// <summary> /// <summary>
/// Gets or sets what kind of layout reference this is. /// Gets or sets what kind of layout reference this is.
@ -25,4 +26,13 @@ public class LayoutSelection : CorePropertyChanged
get => _parameter; get => _parameter;
set => SetAndNotify(ref _parameter, value); set => SetAndNotify(ref _parameter, value);
} }
/// <summary>
/// Gets or sets the error state of the layout reference.
/// </summary>
public string? ErrorState
{
get => _errorState;
set => SetAndNotify(ref _errorState, value);
}
} }

View File

@ -184,13 +184,14 @@ internal class DeviceService : IDeviceService
device.ApplyLayout(null, false, false); device.ApplyLayout(null, false, false);
else else
provider?.ApplyLayout(device, layout); provider?.ApplyLayout(device, layout);
UpdateLeds();
} }
catch (Exception e) catch (Exception e)
{ {
device.LayoutSelection.ErrorState = e.Message;
_logger.Error(e, "Failed to apply device layout"); _logger.Error(e, "Failed to apply device layout");
} }
UpdateLeds();
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@ -83,6 +83,10 @@
</Grid> </Grid>
<ContentControl Content="{CompiledBinding SelectedLayoutProvider}" ClipToBounds="False" /> <ContentControl Content="{CompiledBinding SelectedLayoutProvider}" ClipToBounds="False" />
<TextBlock TextAlignment="Right"
Classes="danger"
Text="{CompiledBinding Device.LayoutSelection.ErrorState}"
IsVisible="{CompiledBinding Device.LayoutSelection.ErrorState, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
<Border Classes="card-separator" /> <Border Classes="card-separator" />
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto"> <Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">