diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/ConditionalDataBinding/DataBindingConditionViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/ConditionalDataBinding/DataBindingConditionViewModel.cs index 4361be98d..ff8df07a0 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/ConditionalDataBinding/DataBindingConditionViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/ConditionalDataBinding/DataBindingConditionViewModel.cs @@ -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; diff --git a/src/Artemis.UI/Screens/Settings/Device/DeviceLayoutDialogViewModel.cs b/src/Artemis.UI/Screens/Settings/Device/DeviceLayoutDialogViewModel.cs index 1f8dbe9f4..cd7010190 100644 --- a/src/Artemis.UI/Screens/Settings/Device/DeviceLayoutDialogViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Device/DeviceLayoutDialogViewModel.cs @@ -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()) diff --git a/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabView.xaml b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabView.xaml index 37831d39b..08b374383 100644 --- a/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabView.xaml +++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabView.xaml @@ -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 @@ + diff --git a/src/Artemis.UI/Screens/TrayViewModel.cs b/src/Artemis.UI/Screens/TrayViewModel.cs index c755054af..9b94f0594 100644 --- a/src/Artemis.UI/Screens/TrayViewModel.cs +++ b/src/Artemis.UI/Screens/TrayViewModel.cs @@ -142,8 +142,12 @@ namespace Artemis.UI.Screens private void RootViewModelOnClosed(object sender, CloseEventArgs e) { - _rootViewModel.Closed -= RootViewModelOnClosed; - _rootViewModel = null; + if (_rootViewModel != null) + { + _rootViewModel.Closed -= RootViewModelOnClosed; + _rootViewModel = null; + } + OnMainWindowClosed(); }