private void ProfileChanged(object sender, EventArgs e) { _flatDeviceSettings.PropertyChanged -= FlatDeviceSettingsChanged; profileService.ActiveProfile.FilterWheelSettings.PropertyChanged += FilterWheelSettingsChanged; RefreshFlatDeviceList(null); _flatDeviceSettings = profileService.ActiveProfile.FlatDeviceSettings; _flatDeviceSettings.PropertyChanged += FlatDeviceSettingsChanged; RaisePropertyChanged(nameof(Gains)); RaisePropertyChanged(nameof(BinningModes)); UpdateWizardValueBlocks(); }
public FlatDeviceVM(IProfileService profileService, IFlatDeviceMediator flatDeviceMediator, IApplicationStatusMediator applicationStatusMediator, IImageGeometryProvider imageGeometryProvider) : base(profileService) { _applicationStatusMediator = applicationStatusMediator; _flatDeviceMediator = flatDeviceMediator; _flatDeviceMediator.RegisterHandler(this); this.Title = "LblFlatDevice"; this.ImageGeometry = imageGeometryProvider.GetImageGeometry("LightBulbSVG"); ConnectCommand = new AsyncCommand <bool>(Connect); CancelConnectCommand = new RelayCommand(CancelConnectFlatDevice); DisconnectCommand = new AsyncCommand <bool>(() => DisconnectFlatDeviceDialog()); OpenCoverCommand = new AsyncCommand <bool>(OpenCover); CloseCoverCommand = new AsyncCommand <bool>(CloseCover); RefreshFlatDeviceListCommand = new RelayCommand(RefreshFlatDeviceList, o => _flatDevice?.Connected != true); SetBrightnessCommand = new RelayCommand(SetBrightness); ToggleLightCommand = new RelayCommand(ToggleLight); AddGainCommand = new RelayCommand(AddGain); AddBinningCommand = new RelayCommand(AddBinning); DeleteGainCommand = new RelayCommand(DeleteGainDialog); DeleteBinningCommand = new RelayCommand(DeleteBinningDialog); FlatDeviceChooserVM = new FlatDeviceChooserVM(profileService); FlatDeviceChooserVM.GetEquipment(); _updateTimer = new DeviceUpdateTimer( GetFlatDeviceValues, UpdateFlatDeviceValues, profileService.ActiveProfile.ApplicationSettings.DevicePollingInterval ); _flatDeviceSettings = profileService.ActiveProfile.FlatDeviceSettings; _flatDeviceSettings.PropertyChanged += FlatDeviceSettingsChanged; profileService.ProfileChanged += ProfileChanged; profileService.ActiveProfile.FilterWheelSettings.PropertyChanged += FilterWheelSettingsChanged; UpdateWizardValueBlocks(); }