public AnchorablePlateSolverVM(IProfileService profileService, ICameraMediator cameraMediator, ITelescopeMediator telescopeMediator, IImagingMediator imagingMediator, IApplicationStatusMediator applicationStatusMediator) : base(profileService) { Title = "LblPlateSolving"; this.cameraMediator = cameraMediator; this.cameraMediator.RegisterConsumer(this); this.telescopeMediator = telescopeMediator; this.telescopeMediator.RegisterConsumer(this); this.imagingMediator = imagingMediator; this.applicationStatusMediator = applicationStatusMediator; ImageGeometry = (System.Windows.Media.GeometryGroup)System.Windows.Application.Current.Resources["PlatesolveSVG"]; SolveCommand = new AsyncCommand <bool>(() => CaptureSolveSyncAndReslew(new Progress <ApplicationStatus>(p => Status = p))); CancelSolveCommand = new RelayCommand(CancelSolve); SnapExposureDuration = profileService.ActiveProfile.PlateSolveSettings.ExposureTime; SnapFilter = profileService.ActiveProfile.PlateSolveSettings.Filter; RepeatThreshold = profileService.ActiveProfile.PlateSolveSettings.Threshold; SlewToTarget = profileService.ActiveProfile.PlateSolveSettings.SlewToTarget; profileService.ProfileChanged += (object sender, EventArgs e) => { SnapExposureDuration = profileService.ActiveProfile.PlateSolveSettings.ExposureTime; SnapFilter = profileService.ActiveProfile.PlateSolveSettings.Filter; RepeatThreshold = profileService.ActiveProfile.PlateSolveSettings.Threshold; SlewToTarget = profileService.ActiveProfile.PlateSolveSettings.SlewToTarget; }; }
public GuiderChooserVM(IProfileService profileService, ICameraMediator cameraMediator, ITelescopeMediator telescopeMediator) : base(profileService) { this.cameraMediator = cameraMediator; this.profileService = profileService; this.telescopeMediator = telescopeMediator; GetEquipment(); }
public CameraVM(IProfileService profileService, ICameraMediator cameraMediator, ITelescopeMediator telescopeMediator, IApplicationStatusMediator applicationStatusMediator) : base(profileService) { Title = "LblCamera"; ImageGeometry = (System.Windows.Media.GeometryGroup)System.Windows.Application.Current.Resources["CameraSVG"]; CameraChooserVM = new CameraChooserVM(profileService, telescopeMediator); CameraChooserVM.GetEquipment(); this.cameraMediator = cameraMediator; this.cameraMediator.RegisterHandler(this); this.applicationStatusMediator = applicationStatusMediator; ChooseCameraCommand = new AsyncCommand <bool>(ChooseCamera); CancelConnectCameraCommand = new RelayCommand(CancelConnectCamera); DisconnectCommand = new AsyncCommand <bool>(() => DisconnectDiag()); CoolCamCommand = new AsyncCommand <bool>(() => { _cancelChangeTemperatureCts?.Dispose(); _cancelChangeTemperatureCts = new CancellationTokenSource(); return(CoolCamera(TargetTemp, TimeSpan.FromMinutes(CoolingDuration), new Progress <ApplicationStatus>(p => Status = p), _cancelChangeTemperatureCts.Token)); }, (object o) => !TempChangeRunning); WarmCamCommand = new AsyncCommand <bool>(() => { _cancelChangeTemperatureCts?.Dispose(); _cancelChangeTemperatureCts = new CancellationTokenSource(); return(WarmCamera(TimeSpan.FromMinutes(WarmingDuration), new Progress <ApplicationStatus>(p => Status = p), _cancelChangeTemperatureCts.Token)); }, (object o) => !TempChangeRunning); CancelCoolCamCommand = new RelayCommand(CancelCoolCamera); RefreshCameraListCommand = new RelayCommand(RefreshCameraList, o => !(Cam?.Connected == true)); TempChangeRunning = false; CoolerPowerHistory = new AsyncObservableLimitedSizedStack <KeyValuePair <DateTime, double> >(100); CCDTemperatureHistory = new AsyncObservableLimitedSizedStack <KeyValuePair <DateTime, double> >(100); ToggleDewHeaterOnCommand = new RelayCommand(ToggleDewHeaterOn); updateTimer = new DeviceUpdateTimer( GetCameraValues, UpdateCameraValues, profileService.ActiveProfile.ApplicationSettings.DevicePollingInterval ); profileService.ProfileChanged += (object sender, EventArgs e) => { RefreshCameraList(null); }; }
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 ImageControlVM(IProfileService profileService, ICameraMediator cameraMediator, ITelescopeMediator telescopeMediator, IApplicationStatusMediator applicationStatusMediator) : base(profileService) { Title = "LblImage"; ImageGeometry = (System.Windows.Media.GeometryGroup)System.Windows.Application.Current.Resources["PictureSVG"]; this.cameraMediator = cameraMediator; this.cameraMediator.RegisterConsumer(this); this.telescopeMediator = telescopeMediator; this.applicationStatusMediator = applicationStatusMediator; AutoStretch = profileService.ActiveProfile.ImageSettings.AutoStretch; DetectStars = profileService.ActiveProfile.ImageSettings.DetectStars; ShowCrossHair = false; ShowBahtinovAnalyzer = false; ShowSubSampler = false; _progress = new Progress <ApplicationStatus>(p => Status = p); PrepareImageCommand = new AsyncCommand <bool>(() => ProcessImageHelper()); PlateSolveImageCommand = new AsyncCommand <bool>(() => PlateSolveImage(), (object o) => Image != null); CancelPlateSolveImageCommand = new RelayCommand(CancelPlateSolveImage); DragStartCommand = new RelayCommand(BahtinovDragStart); DragStopCommand = new RelayCommand(BahtinovDragStop); DragMoveCommand = new RelayCommand(BahtinovDragMove); SubSampleDragStartCommand = new RelayCommand(SubSampleDragStart); SubSampleDragStopCommand = new RelayCommand(SubSampleDragStop); SubSampleDragMoveCommand = new RelayCommand(SubSampleDragMove); InspectAberrationCommand = new AsyncCommand <bool>(() => InspectAberration(), (object o) => Image != null); PixelPeepStartCommand = new RelayCommand(PixelPeeperStart); PixelPeepMoveCommand = new RelayCommand(PixelPeeperMove); PixelPeepEndCommand = new RelayCommand(PixelPeeperStop); BahtinovRectangle = new ObservableRectangle(-1, -1, 200, 200); SubSampleRectangle = new ObservableRectangle(-1, -1, 600, 600); BahtinovRectangle.PropertyChanged += Rectangle_PropertyChanged; SubSampleRectangle.PropertyChanged += SubSampleRectangle_PropertyChanged; }
public AnchorableSnapshotVM( IProfileService profileService, IImagingMediator imagingMediator, ICameraMediator cameraMediator, IApplicationStatusMediator applicationStatusMediator) : base(profileService) { Title = "LblImaging"; ImageGeometry = (System.Windows.Media.GeometryGroup)System.Windows.Application.Current.Resources["ImagingSVG"]; this.applicationStatusMediator = applicationStatusMediator; this.cameraMediator = cameraMediator; this.cameraMediator.RegisterConsumer(this); this.imagingMediator = imagingMediator; progress = new Progress <ApplicationStatus>(p => Status = p); SnapCommand = new AsyncCommand <bool>(() => SnapImage(progress)); CancelSnapCommand = new RelayCommand(CancelSnapImage); StartLiveViewCommand = new AsyncCommand <bool>(StartLiveView); StopLiveViewCommand = new RelayCommand(StopLiveView); SnapFilter = profileService.ActiveProfile.FilterWheelSettings.FilterWheelFilters?.FirstOrDefault(x => x.Name == profileService.ActiveProfile.SnapShotControlSettings.Filter?.Name); profileService.ProfileChanged += (object sender, EventArgs e) => { SnapFilter = profileService.ActiveProfile.FilterWheelSettings.FilterWheelFilters?.FirstOrDefault(x => x.Name == profileService.ActiveProfile.SnapShotControlSettings.Filter?.Name); }; }
public SynchronizedPHD2Guider(IProfileService profileService, ICameraMediator cameraMediator) { this.profileService = profileService; this.cameraMediator = cameraMediator; }
public FramingAssistantVM(IProfileService profileService, ICameraMediator cameraMediator, ITelescopeMediator telescopeMediator, IApplicationStatusMediator applicationStatusMediator) : base(profileService) { this.cameraMediator = cameraMediator; this.cameraMediator.RegisterConsumer(this); this.telescopeMediator = telescopeMediator; this.applicationStatusMediator = applicationStatusMediator; Opacity = 0.2; SkyMapAnnotator = new SkyMapAnnotator(telescopeMediator); var defaultCoordinates = new Coordinates(0, 0, Epoch.J2000, Coordinates.RAType.Degrees); DSO = new DeepSkyObject(string.Empty, defaultCoordinates, profileService.ActiveProfile.ApplicationSettings.SkyAtlasImageRepository); FramingAssistantSource = profileService.ActiveProfile.FramingAssistantSettings.LastSelectedImageSource; CameraPixelSize = profileService.ActiveProfile.CameraSettings.PixelSize; FocalLength = profileService.ActiveProfile.TelescopeSettings.FocalLength; _statusUpdate = new Progress <ApplicationStatus>(p => Status = p); LoadImageCommand = new AsyncCommand <bool>(async() => { return(await LoadImage()); }); CancelLoadImageFromFileCommand = new RelayCommand((object o) => { CancelLoadImage(); }); _progress = new Progress <int>((p) => DownloadProgressValue = p); CancelLoadImageCommand = new RelayCommand((object o) => { CancelLoadImage(); }); DragStartCommand = new RelayCommand(DragStart); DragStopCommand = new RelayCommand(DragStop); DragMoveCommand = new RelayCommand(DragMove); ClearCacheCommand = new RelayCommand(ClearCache, (object o) => Cache != null); RefreshSkyMapAnnotationCommand = new RelayCommand((object o) => SkyMapAnnotator.UpdateSkyMap(), (object o) => SkyMapAnnotator.Initialized); MouseWheelCommand = new RelayCommand(MouseWheel); CoordsFromPlanetariumCommand = new AsyncCommand <bool>(() => Task.Run(CoordsFromPlanetarium)); DeepSkyObjectSearchVM = new DeepSkyObjectSearchVM(); DeepSkyObjectSearchVM.PropertyChanged += DeepSkyObjectSearchVM_PropertyChanged; SetSequenceCoordinatesCommand = new AsyncCommand <bool>(async(object parameter) => { var vm = (ApplicationVM)Application.Current.Resources["AppVM"]; vm.ChangeTab(ApplicationTab.SEQUENCE); var deepSkyObjects = new List <DeepSkyObject>(); foreach (var rect in CameraRectangles) { var name = rect.Id > 0 ? DSO?.Name + string.Format(" {0} ", Locale.Loc.Instance["LblPanel"]) + rect.Id : DSO?.Name; var dso = new DeepSkyObject(name, rect.Coordinates, profileService.ActiveProfile.ApplicationSettings.SkyAtlasImageRepository); dso.Rotation = Rectangle.DisplayedRotation; deepSkyObjects.Add(dso); } bool msgResult = false; if (parameter.ToString() == "Replace") { msgResult = await vm.SeqVM.SetSequenceCoordiantes(deepSkyObjects); } else if (parameter.ToString() == "Add") { msgResult = await vm.SeqVM.SetSequenceCoordiantes(deepSkyObjects, false); } ImageParameter = null; GC.Collect(); GC.WaitForPendingFinalizers(); return(msgResult); }, (object o) => Rectangle?.Coordinates != null); RecenterCommand = new AsyncCommand <bool>(async() => { DSO.Coordinates = Rectangle.Coordinates; await LoadImageCommand.ExecuteAsync(null); return(true); }, (object o) => Rectangle?.Coordinates != null); SlewToCoordinatesCommand = new AsyncCommand <bool>(async() => { return(await telescopeMediator.SlewToCoordinatesAsync(Rectangle.Coordinates)); }, (object o) => Rectangle?.Coordinates != null); var appSettings = profileService.ActiveProfile.ApplicationSettings; appSettings.PropertyChanged += ApplicationSettings_PropertyChanged; profileService.ProfileChanged += (object sender, EventArgs e) => { appSettings.PropertyChanged -= ApplicationSettings_PropertyChanged; this.FocalLength = profileService.ActiveProfile.TelescopeSettings.FocalLength; this.CameraPixelSize = profileService.ActiveProfile.CameraSettings.PixelSize; RaisePropertyChanged(nameof(CameraPixelSize)); RaisePropertyChanged(nameof(FocalLength)); RaisePropertyChanged(nameof(FieldOfView)); RaisePropertyChanged(nameof(CameraWidth)); RaisePropertyChanged(nameof(CameraHeight)); appSettings = profileService.ActiveProfile.ApplicationSettings; appSettings.PropertyChanged += ApplicationSettings_PropertyChanged; ApplicationSettings_PropertyChanged(null, null); }; resizeTimer = new DispatcherTimer(DispatcherPriority.ApplicationIdle, _dispatcher); resizeTimer.Interval = TimeSpan.FromMilliseconds(500); resizeTimer.Tick += ResizeTimer_Tick; ScrollViewerSizeChangedCommand = new RelayCommand((parameter) => { resizeTimer.Stop(); if (ImageParameter != null && FramingAssistantSource == SkySurveySource.SKYATLAS) { resizeTimer.Start(); } }); profileService.LocationChanged += (object sender, EventArgs e) => { DSO = new DeepSkyObject(DSO.Name, DSO.Coordinates, profileService.ActiveProfile.ApplicationSettings.SkyAtlasImageRepository); }; InitializeCache(); }
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"; }
public PolarAlignmentVM( IProfileService profileService, ICameraMediator cameraMediator, ITelescopeMediator telescopeMediator, IImagingMediator imagingMediator, IApplicationStatusMediator applicationStatusMediator ) : base(profileService) { Title = "LblPolarAlignment"; ImageGeometry = (System.Windows.Media.GeometryGroup)System.Windows.Application.Current.Resources["PolarAlignSVG"]; this.cameraMediator = cameraMediator; this.cameraMediator.RegisterConsumer(this); this.imagingMediator = imagingMediator; this.telescopeMediator = telescopeMediator; this.telescopeMediator.RegisterConsumer(this); this.applicationStatusMediator = applicationStatusMediator; updateValues = new DispatcherTimer(); updateValues.Interval = TimeSpan.FromSeconds(10); updateValues.Tick += UpdateValues_Tick; MeasureAzimuthErrorCommand = new AsyncCommand <bool>( () => MeasurePolarError(new Progress <ApplicationStatus>(p => AzimuthPolarErrorStatus = p), Direction.AZIMUTH), (p) => (TelescopeInfo?.Connected == true && CameraInfo?.Connected == true)); MeasureAltitudeErrorCommand = new AsyncCommand <bool>( () => MeasurePolarError(new Progress <ApplicationStatus>(p => AltitudePolarErrorStatus = p), Direction.ALTITUDE), (p) => (TelescopeInfo?.Connected == true && CameraInfo?.Connected == true)); SlewToAltitudeMeridianOffsetCommand = new AsyncCommand <bool>( () => SlewToMeridianOffset(AltitudeMeridianOffset, AltitudeDeclination), (p) => (TelescopeInfo?.Connected == true)); SlewToAzimuthMeridianOffsetCommand = new AsyncCommand <bool>( () => SlewToMeridianOffset(AzimuthMeridianOffset, AzimuthDeclination), (p) => (TelescopeInfo?.Connected == true)); DARVSlewCommand = new AsyncCommand <bool>( () => Darvslew(new Progress <ApplicationStatus>(p => Status = p), new Progress <string>(p => DarvStatus = p)), (p) => (TelescopeInfo?.Connected == true && CameraInfo?.Connected == true)); CancelDARVSlewCommand = new RelayCommand( Canceldarvslew, (p) => cancelDARVSlewToken != null); CancelMeasureAltitudeErrorCommand = new RelayCommand( CancelMeasurePolarError, (p) => cancelMeasureErrorToken != null); CancelMeasureAzimuthErrorCommand = new RelayCommand( CancelMeasurePolarError, (p) => cancelMeasureErrorToken != null); DARVSlewDuration = 60; DARVSlewRate = 0.01; SnapExposureDuration = 2; profileService.ProfileChanged += (object sender, EventArgs e) => { RaisePropertyChanged(nameof(AzimuthMeridianOffset)); RaisePropertyChanged(nameof(AzimuthDeclination)); RaisePropertyChanged(nameof(AltitudeMeridianOffset)); RaisePropertyChanged(nameof(AltitudeDeclination)); }; }
public GuiderVM(IProfileService profileService, IGuiderMediator guiderMediator, ICameraMediator cameraMediator, IApplicationStatusMediator applicationStatusMediator, ITelescopeMediator telescopeMediator) : base(profileService) { Title = "LblGuider"; ImageGeometry = (System.Windows.Media.GeometryGroup)System.Windows.Application.Current.Resources["GuiderSVG"]; this.guiderMediator = guiderMediator; this.guiderMediator.RegisterHandler(this); this.applicationStatusMediator = applicationStatusMediator; ConnectGuiderCommand = new AsyncCommand <bool>(Connect); CancelConnectGuiderCommand = new RelayCommand(CancelConnectGuider); GuiderChooserVM = new GuiderChooserVM(profileService, cameraMediator, telescopeMediator); DisconnectGuiderCommand = new RelayCommand((object o) => Disconnect(), (object o) => Guider?.Connected == true); ClearGraphCommand = new RelayCommand((object o) => ResetGraphValues()); GuideStepsHistory = new GuideStepsHistory(HistorySize, GuiderScale, GuiderMaxY); profileService.ProfileChanged += (object sender, EventArgs e) => { GuiderChooserVM.GetEquipment(); }; }