public FilterWheelVM(IProfileService profileService, IFilterWheelMediator filterWheelMediator, IFocuserMediator focuserMediator, IApplicationStatusMediator applicationStatusMediator) : base(profileService) { Title = "LblFilterWheel"; ImageGeometry = (System.Windows.Media.GeometryGroup)System.Windows.Application.Current.Resources["FWSVG"]; this.filterWheelMediator = filterWheelMediator; this.filterWheelMediator.RegisterHandler(this); this.focuserMediator = focuserMediator; this.applicationStatusMediator = applicationStatusMediator; ChooseFWCommand = new AsyncCommand <bool>(() => ChooseFW()); CancelChooseFWCommand = new RelayCommand(CancelChooseFW); DisconnectCommand = new AsyncCommand <bool>(() => DisconnectFW()); RefreshFWListCommand = new RelayCommand(RefreshFWList, o => !(FW?.Connected == true)); ChangeFilterCommand = new AsyncCommand <bool>(async() => { _changeFilterCancellationSource?.Dispose(); _changeFilterCancellationSource = new CancellationTokenSource(); await ChangeFilter(TargetFilter, _changeFilterCancellationSource.Token); return(true); }, (object o) => FilterWheelInfo.Connected && !FilterWheelInfo.IsMoving); profileService.ProfileChanged += (object sender, EventArgs e) => { RefreshFWList(null); }; }
public OptionsVM(IProfileService profileService, IFilterWheelMediator filterWheelMediator) : base(profileService) { Title = "LblOptions"; CanClose = false; ImageGeometry = (System.Windows.Media.GeometryGroup)System.Windows.Application.Current.Resources["SettingsSVG"]; this.filterWheelMediator = filterWheelMediator; OpenWebRequestCommand = new RelayCommand(OpenWebRequest); OpenImageFileDiagCommand = new RelayCommand(OpenImageFileDiag); OpenSharpCapSensorAnalysisFolderDiagCommand = new RelayCommand(OpenSharpCapSensorAnalysisFolderDiag); OpenSequenceTemplateDiagCommand = new RelayCommand(OpenSequenceTemplateDiag); OpenSequenceCommandAtCompletionDiagCommand = new RelayCommand(OpenSequenceCommandAtCompletionDiag); OpenSequenceFolderDiagCommand = new RelayCommand(OpenSequenceFolderDiag); OpenCygwinFileDiagCommand = new RelayCommand(OpenCygwinFileDiag); OpenPS2FileDiagCommand = new RelayCommand(OpenPS2FileDiag); OpenPHD2DiagCommand = new RelayCommand(OpenPHD2FileDiag); OpenASPSFileDiagCommand = new RelayCommand(OpenASPSFileDiag); OpenASTAPFileDiagCommand = new RelayCommand(OpenASTAPFileDiag); OpenLogFolderCommand = new RelayCommand(OpenLogFolder); ToggleColorsCommand = new RelayCommand(ToggleColors); DownloadIndexesCommand = new RelayCommand(DownloadIndexes); OpenSkyAtlasImageRepositoryDiagCommand = new RelayCommand(OpenSkyAtlasImageRepositoryDiag); OpenSkySurveyCacheDirectoryDiagCommand = new RelayCommand(OpenSkySurveyCacheDirectoryDiag); ImportFiltersCommand = new RelayCommand(ImportFilters); AddFilterCommand = new RelayCommand(AddFilter); SetAutoFocusFilterCommand = new RelayCommand(SetAutoFocusFilter); RemoveFilterCommand = new RelayCommand(RemoveFilter); AddProfileCommand = new RelayCommand(AddProfile); CloneProfileCommand = new RelayCommand(CloneProfile, (object o) => { return(SelectedProfile != null); }); RemoveProfileCommand = new RelayCommand(RemoveProfile, (object o) => { return(SelectedProfile != null && SelectedProfile.Id != profileService.ActiveProfile.Id); }); SelectProfileCommand = new RelayCommand(SelectProfile, (o) => { return(SelectedProfile != null); }); CopyToCustomSchemaCommand = new RelayCommand(CopyToCustomSchema, (object o) => ActiveProfile.ColorSchemaSettings.ColorSchema?.Name != "Custom"); CopyToAlternativeCustomSchemaCommand = new RelayCommand(CopyToAlternativeCustomSchema, (object o) => ActiveProfile.ColorSchemaSettings.ColorSchema?.Name != "Alternative Custom"); SiteFromGPSCommand = new AsyncCommand <bool>(() => Task.Run(SiteFromGPS)); SiteFromPlanetariumCommand = new AsyncCommand <bool>(() => Task.Run(SiteFromPlanetarium)); ImagePatterns = ImagePatterns.CreateExample(); ScanForIndexFiles(); profileService.LocaleChanged += (object sender, EventArgs e) => { ImagePatterns = ImagePatterns.CreateExample(); RaisePropertyChanged(nameof(FileTypes)); }; profileService.LocationChanged += (object sender, EventArgs e) => { RaisePropertyChanged(nameof(Latitude)); RaisePropertyChanged(nameof(Longitude)); }; profileService.ProfileChanged += (object sender, EventArgs e) => { ProfileChanged(); }; }
public ImagingVM( IProfileService profileService, IImagingMediator imagingMediator, ICameraMediator cameraMediator, ITelescopeMediator telescopeMediator, IFilterWheelMediator filterWheelMediator, IFocuserMediator focuserMediator, IRotatorMediator rotatorMediator, IGuiderMediator guiderMediator, IWeatherDataMediator weatherDataMediator, IApplicationStatusMediator applicationStatusMediator ) : base(profileService) { this.imagingMediator = imagingMediator; this.imagingMediator.RegisterHandler(this); this.cameraMediator = cameraMediator; this.cameraMediator.RegisterConsumer(this); this.telescopeMediator = telescopeMediator; this.telescopeMediator.RegisterConsumer(this); this.filterWheelMediator = filterWheelMediator; this.filterWheelMediator.RegisterConsumer(this); this.focuserMediator = focuserMediator; this.focuserMediator.RegisterConsumer(this); this.rotatorMediator = rotatorMediator; this.rotatorMediator.RegisterConsumer(this); this.guiderMediator = guiderMediator; this.applicationStatusMediator = applicationStatusMediator; this.weatherDataMediator = weatherDataMediator; this.weatherDataMediator.RegisterConsumer(this); progress = new Progress <ApplicationStatus>(p => Status = p); ImageControl = new ImageControlVM(profileService, cameraMediator, telescopeMediator, applicationStatusMediator); }
public FlatWizardVM(IProfileService profileService, IImagingVM imagingVM, ICameraMediator cameraMediator, IFilterWheelMediator filterWheelMediator, ITelescopeMediator telescopeMediator, IFlatDeviceMediator flatDeviceMediator, IApplicationResourceDictionary resourceDictionary, IApplicationStatusMediator applicationStatusMediator) : base(profileService) { Title = "LblFlatWizard"; ImageGeometry = (System.Windows.Media.GeometryGroup)resourceDictionary["FlatWizardSVG"]; ImagingVM = imagingVM; this.applicationStatusMediator = applicationStatusMediator; flatSequenceCts?.Dispose(); flatSequenceCts = new CancellationTokenSource(); var pauseTokenSource = new PauseTokenSource(); Gain = -1; StartFlatSequenceCommand = new AsyncCommand <bool>( () => StartSingleFlatCapture(new Progress <ApplicationStatus>(p => Status = p), pauseTokenSource.Token), (object o) => cameraInfo.Connected ); StartMultiFlatSequenceCommand = new AsyncCommand <bool>( () => StartMultiFlatCapture(new Progress <ApplicationStatus>(p => Status = p), pauseTokenSource.Token), (object o) => cameraInfo.Connected && filterWheelInfo.Connected ); SlewToZenithCommand = new AsyncCommand <bool>( () => SlewToZenith(), (object o) => telescopeInfo.Connected ); CancelFlatExposureSequenceCommand = new RelayCommand(CancelFindExposureTime); PauseFlatExposureSequenceCommand = new RelayCommand(obj => { IsPaused = true; pauseTokenSource.IsPaused = IsPaused; }); ResumeFlatExposureSequenceCommand = new RelayCommand(obj => { IsPaused = false; pauseTokenSource.IsPaused = IsPaused; }); FlatCount = profileService.ActiveProfile.FlatWizardSettings.FlatCount; DarkFlatCount = profileService.ActiveProfile.FlatWizardSettings.DarkFlatCount; BinningMode = profileService.ActiveProfile.FlatWizardSettings.BinningMode; Filters = new ObservableCollection <FlatWizardFilterSettingsWrapper>(); profileService.ProfileChanged += (sender, args) => { UpdateSingleFlatWizardFilterSettings(profileService); watchedFilterList.CollectionChanged -= FiltersCollectionChanged; watchedFilterList = profileService.ActiveProfile.FilterWheelSettings.FilterWheelFilters; watchedFilterList.CollectionChanged += FiltersCollectionChanged; UpdateFilterWheelsSettings(); }; watchedFilterList = profileService.ActiveProfile.FilterWheelSettings.FilterWheelFilters; watchedFilterList.CollectionChanged += FiltersCollectionChanged; // first update filters UpdateSingleFlatWizardFilterSettings(profileService); UpdateFilterWheelsSettings(); // then register consumer and get the cameraInfo so it's populated to all filters including the singleflatwizardfiltersettings this.cameraMediator = cameraMediator; cameraMediator.RegisterConsumer(this); this.filterWheelMediator = filterWheelMediator; filterWheelMediator.RegisterConsumer(this); this.telescopeMediator = telescopeMediator; this.telescopeMediator.RegisterConsumer(this); // register the flat panel mediator _flatDeviceMediator = flatDeviceMediator; _flatDeviceMediator.RegisterConsumer(this); TargetName = "FlatWizard"; }