private StopZoneDouble ConvertZoneTodouble(StopZone zone) { StopZoneDouble stDouble = new StopZoneDouble(); if (zone == null) { return(stDouble); } if (GetQuarter(zone.From) == Quarter.TopRight) { stDouble.From = 40 - (zone.From.Z * 10); } else if (GetQuarter(zone.From) == Quarter.TopLeft) { stDouble.From = -(zone.From.Z * 10); } else if (GetQuarter(zone.From) == Quarter.DownLeft) { stDouble.From = 20 - (-(zone.From.Z * 10)); } else if (GetQuarter(zone.From) == Quarter.DownRight) { stDouble.From = 20 + (zone.From.Z * 10); } if (GetQuarter(zone.To) == Quarter.TopRight) { stDouble.TO = 40 - (zone.To.Z * 10); } else if (GetQuarter(zone.To) == Quarter.TopLeft) { stDouble.TO = -(zone.To.Z * 10); } else if (GetQuarter(zone.To) == Quarter.DownLeft) { stDouble.TO = 20 - (-(zone.To.Z * 10)); } else if (GetQuarter(zone.To) == Quarter.DownRight) { stDouble.TO = 20 + (zone.To.Z * 10); } return(stDouble); }
private void ValuesHandler(AccelerometerReading reading) { //Set current position if (reading.Acceleration != null) { _currentPosition = reading.Acceleration; } if (_isFirstTime) { if (_currentPosition != null) { _basePosition = _currentPosition; } _baseQuarter = GetQuarter(_basePosition); _portrateFreeZonePoint = new StopZoneDouble(); _portrateFreeZonePoint.From = ConvertPositionToDouble(_basePosition) + 2; _portrateFreeZonePoint.TO = ConvertPositionToDouble(_basePosition) - 2; _portrateStopZonePoint = new StopZoneDouble(); _portrateStopZonePoint.From = ConvertPositionToDouble(_portrateStopZone.From); _portrateStopZonePoint.TO = ConvertPositionToDouble(_portrateStopZone.To); _isFirstTime = false; } _panDirection = Directions.None; _currentPositionPoint = ConvertPositionToDouble(_currentPosition); NavigateRightLeftHandler(_currentPosition); NavigateUpDownHandler(_currentPositionPoint); PanTo(_panDirection); RunStoryBoard(_panDirection); }