mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Device properties - Show custom LED data in in LEDS tab
Device properties - Show error when loading region info fails Tray - Fixed potential crash due to race condition
This commit is contained in:
parent
a74c81ba9d
commit
a53ca305f8
@ -36,6 +36,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings.Conditio
|
||||
base.OnInitialActivate();
|
||||
ActiveItem = _dataModelConditionsVmFactory.DataModelConditionGroupViewModel(DataBindingCondition.Condition, ConditionGroupType.General);
|
||||
ActiveItem.IsRootGroup = true;
|
||||
|
||||
ActiveItem.Update();
|
||||
ActiveItem.Updated += ActiveItemOnUpdated;
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared.Services;
|
||||
@ -15,25 +14,28 @@ namespace Artemis.UI.Screens.Settings.Device
|
||||
{
|
||||
private readonly IRgbService _rgbService;
|
||||
private bool _selectPhysicalLayout;
|
||||
private RegionInfoAutocompleteSource _autocompleteSource;
|
||||
private RegionInfo _selectedRegion;
|
||||
|
||||
public DeviceLayoutDialogViewModel(ArtemisDevice device, IRgbService rgbService)
|
||||
public DeviceLayoutDialogViewModel(ArtemisDevice device, IRgbService rgbService, IDialogService dialogService)
|
||||
{
|
||||
_rgbService = rgbService;
|
||||
Device = device;
|
||||
SelectPhysicalLayout = !device.DeviceProvider.CanDetectPhysicalLayout;
|
||||
|
||||
Task.Run(() => AutocompleteSource = new RegionInfoAutocompleteSource());
|
||||
try
|
||||
{
|
||||
AutocompleteSource = new RegionInfoAutocompleteSource();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dialogService.ShowExceptionDialog("Failed to get region information for keyboard layout selection", e);
|
||||
Session?.Close(false);
|
||||
}
|
||||
}
|
||||
|
||||
public ArtemisDevice Device { get; }
|
||||
|
||||
public RegionInfoAutocompleteSource AutocompleteSource
|
||||
{
|
||||
get => _autocompleteSource;
|
||||
set => SetAndNotify(ref _autocompleteSource, value);
|
||||
}
|
||||
public RegionInfoAutocompleteSource AutocompleteSource { get; }
|
||||
|
||||
public RegionInfo SelectedRegion
|
||||
{
|
||||
@ -87,7 +89,7 @@ namespace Artemis.UI.Screens.Settings.Device
|
||||
|
||||
public RegionInfoAutocompleteSource()
|
||||
{
|
||||
Regions = CultureInfo.GetCultures(CultureTypes.SpecificCultures).ToList()
|
||||
Regions = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
|
||||
.Select(c => new RegionInfo(c.LCID))
|
||||
.GroupBy(r => r.EnglishName)
|
||||
.Select(g => g.First())
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
IsReadOnly="True"
|
||||
CanUserAddRows="False"
|
||||
AutoGenerateColumns="False"
|
||||
materialDesign:DataGridAssist.CellPadding="13 8 8 8"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="8"
|
||||
materialDesign:DataGridAssist.CellPadding="5"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="5"
|
||||
SelectedItem="{Binding Parent.SelectedLed}"
|
||||
CanUserResizeRows="False"
|
||||
Margin="10">
|
||||
@ -31,6 +31,7 @@
|
||||
<materialDesign:DataGridTextColumn Binding="{Binding Layout.Image, Converter={StaticResource UriToFileNameConverter}, Mode=OneWay}" Header="Image file" />
|
||||
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Shape}" Header="Shape" />
|
||||
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Size}" Header="Size" Width="Auto" />
|
||||
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.CustomData}" Header="LED data" Width="Auto" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
@ -141,9 +141,13 @@ namespace Artemis.UI.Screens
|
||||
}
|
||||
|
||||
private void RootViewModelOnClosed(object sender, CloseEventArgs e)
|
||||
{
|
||||
if (_rootViewModel != null)
|
||||
{
|
||||
_rootViewModel.Closed -= RootViewModelOnClosed;
|
||||
_rootViewModel = null;
|
||||
}
|
||||
|
||||
OnMainWindowClosed();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user