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();
|
base.OnInitialActivate();
|
||||||
ActiveItem = _dataModelConditionsVmFactory.DataModelConditionGroupViewModel(DataBindingCondition.Condition, ConditionGroupType.General);
|
ActiveItem = _dataModelConditionsVmFactory.DataModelConditionGroupViewModel(DataBindingCondition.Condition, ConditionGroupType.General);
|
||||||
ActiveItem.IsRootGroup = true;
|
ActiveItem.IsRootGroup = true;
|
||||||
|
|
||||||
ActiveItem.Update();
|
ActiveItem.Update();
|
||||||
ActiveItem.Updated += ActiveItemOnUpdated;
|
ActiveItem.Updated += ActiveItemOnUpdated;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
using Artemis.UI.Shared.Services;
|
using Artemis.UI.Shared.Services;
|
||||||
@ -15,25 +14,28 @@ namespace Artemis.UI.Screens.Settings.Device
|
|||||||
{
|
{
|
||||||
private readonly IRgbService _rgbService;
|
private readonly IRgbService _rgbService;
|
||||||
private bool _selectPhysicalLayout;
|
private bool _selectPhysicalLayout;
|
||||||
private RegionInfoAutocompleteSource _autocompleteSource;
|
|
||||||
private RegionInfo _selectedRegion;
|
private RegionInfo _selectedRegion;
|
||||||
|
|
||||||
public DeviceLayoutDialogViewModel(ArtemisDevice device, IRgbService rgbService)
|
public DeviceLayoutDialogViewModel(ArtemisDevice device, IRgbService rgbService, IDialogService dialogService)
|
||||||
{
|
{
|
||||||
_rgbService = rgbService;
|
_rgbService = rgbService;
|
||||||
Device = device;
|
Device = device;
|
||||||
SelectPhysicalLayout = !device.DeviceProvider.CanDetectPhysicalLayout;
|
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 ArtemisDevice Device { get; }
|
||||||
|
|
||||||
public RegionInfoAutocompleteSource AutocompleteSource
|
public RegionInfoAutocompleteSource AutocompleteSource { get; }
|
||||||
{
|
|
||||||
get => _autocompleteSource;
|
|
||||||
set => SetAndNotify(ref _autocompleteSource, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RegionInfo SelectedRegion
|
public RegionInfo SelectedRegion
|
||||||
{
|
{
|
||||||
@ -87,7 +89,7 @@ namespace Artemis.UI.Screens.Settings.Device
|
|||||||
|
|
||||||
public RegionInfoAutocompleteSource()
|
public RegionInfoAutocompleteSource()
|
||||||
{
|
{
|
||||||
Regions = CultureInfo.GetCultures(CultureTypes.SpecificCultures).ToList()
|
Regions = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
|
||||||
.Select(c => new RegionInfo(c.LCID))
|
.Select(c => new RegionInfo(c.LCID))
|
||||||
.GroupBy(r => r.EnglishName)
|
.GroupBy(r => r.EnglishName)
|
||||||
.Select(g => g.First())
|
.Select(g => g.First())
|
||||||
|
|||||||
@ -20,8 +20,8 @@
|
|||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
AutoGenerateColumns="False"
|
AutoGenerateColumns="False"
|
||||||
materialDesign:DataGridAssist.CellPadding="13 8 8 8"
|
materialDesign:DataGridAssist.CellPadding="5"
|
||||||
materialDesign:DataGridAssist.ColumnHeaderPadding="8"
|
materialDesign:DataGridAssist.ColumnHeaderPadding="5"
|
||||||
SelectedItem="{Binding Parent.SelectedLed}"
|
SelectedItem="{Binding Parent.SelectedLed}"
|
||||||
CanUserResizeRows="False"
|
CanUserResizeRows="False"
|
||||||
Margin="10">
|
Margin="10">
|
||||||
@ -31,6 +31,7 @@
|
|||||||
<materialDesign:DataGridTextColumn Binding="{Binding Layout.Image, Converter={StaticResource UriToFileNameConverter}, Mode=OneWay}" Header="Image file" />
|
<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.Shape}" Header="Shape" />
|
||||||
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Size}" Header="Size" Width="Auto" />
|
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Size}" Header="Size" Width="Auto" />
|
||||||
|
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.CustomData}" Header="LED data" Width="Auto" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@ -142,8 +142,12 @@ namespace Artemis.UI.Screens
|
|||||||
|
|
||||||
private void RootViewModelOnClosed(object sender, CloseEventArgs e)
|
private void RootViewModelOnClosed(object sender, CloseEventArgs e)
|
||||||
{
|
{
|
||||||
_rootViewModel.Closed -= RootViewModelOnClosed;
|
if (_rootViewModel != null)
|
||||||
_rootViewModel = null;
|
{
|
||||||
|
_rootViewModel.Closed -= RootViewModelOnClosed;
|
||||||
|
_rootViewModel = null;
|
||||||
|
}
|
||||||
|
|
||||||
OnMainWindowClosed();
|
OnMainWindowClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user