private void RebuildGuideHistoryList() { lock (lockObj) { if (overallGuideSteps.Count > 0) { var collection = new LinkedList <HistoryStep>(); var startIndex = overallGuideSteps.Count - historySize; if (startIndex < 0) { startIndex = 0; } RMS.Clear(); for (int i = startIndex; i < overallGuideSteps.Count; i++) { var p = overallGuideSteps.ElementAt(i); RMS.AddDataPoint(p.RADistanceRaw, p.DECDistanceRaw); if (Scale == GuiderScaleEnum.ARCSECONDS) { p = p.AdjustPixelScale(PixelScale); } else { p = p.AdjustPixelScale(1); } collection.AddLast(p); } GuideSteps = new AsyncObservableLimitedSizedStack <HistoryStep>(historySize, collection); CalculateMaximumDurationY(); } } }
public GuideStepsHistory(int historySize, GuiderScaleEnum scale, double maxY) { RMS = new RMS(); PixelScale = 1; HistorySize = historySize; MaxY = maxY; Scale = scale; GuideSteps = new AsyncObservableLimitedSizedStack <HistoryStep>(historySize); MaxDurationY = 1; }
public ImageHistoryVM(IProfileService profileService) : base(profileService) { Title = "LblHFRHistory"; if (System.Windows.Application.Current != null) { ImageGeometry = (System.Windows.Media.GeometryGroup)System.Windows.Application.Current.Resources["HFRHistorySVG"]; } _nextStatHistoryId = 0; LimitedImageHistoryStack = new AsyncObservableLimitedSizedStack <ImageHistoryPoint>(100); AutoFocusPoints = new AsyncObservableCollection <ImageHistoryPoint>(); PlotClearCommand = new RelayCommand((object o) => PlotClear()); }
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); }; }