private void UpdateVoltTimeIndicator() { if (_ScopeView.ScalingTime) { _VoltTimeIndicator.Text = TimeBaseConverter.ToString(Oscilloscope.TimeBase); } else { _VoltTimeIndicator.Text = VoltsPerDivisionConverter.ToString(Oscilloscope.Channels [_ScopeView.SelectedChannel].VoltsPerDivision, Oscilloscope.Channels [_ScopeView.SelectedChannel].AttenuationFactor); } }
/// <summary> /// Registers the pinch recognizer. /// </summary> private void RegisterPinchRecognizer() { float startDistance; startDistance = 0.0f; pinchGesture = new UIPinchGestureRecognizer((pg) => { if (pg.State == UIGestureRecognizerState.Began) { if (pg.NumberOfTouches == 2) { CGPoint firstPoint = pg.LocationOfTouch(0, this); CGPoint secondPoint = pg.LocationOfTouch(1, this); startDistance = CalculateDistance(firstPoint, secondPoint); } VoltTimeIndicator.Hidden = false; } else if (pg.State == UIGestureRecognizerState.Changed) { float distance; if (pg.NumberOfTouches == 2) { CGPoint firstPoint = pg.LocationOfTouch(0, this); CGPoint secondPoint = pg.LocationOfTouch(1, this); distance = CalculateDistance(firstPoint, secondPoint); if (PointsAreHorizontal(firstPoint, secondPoint)) { if (distance > startDistance + 50) { startDistance = distance; wfs210.TimeBase = wfs210.TimeBase.Cycle(-1); } else if (distance < startDistance - 50) { startDistance = distance; wfs210.TimeBase = wfs210.TimeBase.Cycle(1); } VoltTimeIndicator.Text = TimeBaseConverter.ToString(wfs210.TimeBase); } else { if (distance > startDistance + 50) { startDistance = distance; Service.Execute(new NextVoltsPerDivisionCommand(SelectedChannel)); } else if (distance < startDistance - 50) { startDistance = distance; Service.Execute(new PreviousVoltsPerDivisionCommand(SelectedChannel)); } VoltTimeIndicator.Text = VoltsPerDivisionConverter.ToString(wfs210.Channels [SelectedChannel].VoltsPerDivision, wfs210.Channels [SelectedChannel].AttenuationFactor); } } } else if (pg.State == UIGestureRecognizerState.Ended) { VoltTimeIndicator.Hidden = true; ApplyMarkerValuesToScope(); OnNewData(null); Update(); } }); this.AddGestureRecognizer(pinchGesture); }
void UpdateTimeBaseText() { lblTimebase.Text = TimeBaseConverter.ToString(Oscilloscope.TimeBase); }