Example #1
0
        public DeviceLayoutDialogViewModel(ArtemisDevice device, IRgbService rgbService)
        {
            _rgbService          = rgbService;
            Device               = device;
            SelectPhysicalLayout = !device.DeviceProvider.CanDetectPhysicalLayout;

            Task.Run(() =>
            {
                AutocompleteSource = new RegionInfoAutocompleteSource();
                SelectedRegion     = AutocompleteSource.Regions.FirstOrDefault(r => r.TwoLetterISORegionName == Device.LogicalLayout ||
                                                                               r.TwoLetterISORegionName == "US" && Device.LogicalLayout == "NA");
            });
        }
        public DeviceLayoutDialogViewModel(ArtemisDevice device, IRgbService rgbService, IDialogService dialogService)
        {
            _rgbService          = rgbService;
            Device               = device;
            SelectPhysicalLayout = !device.DeviceProvider.CanDetectPhysicalLayout;

            try
            {
                AutocompleteSource = new RegionInfoAutocompleteSource();
            }
            catch (Exception e)
            {
                dialogService.ShowExceptionDialog("Failed to get region information for keyboard layout selection", e);
                Session?.Close(false);
            }
        }