示例#1
0
        public static FlightViewData <T> Create(Vector3 speed, float altitude, float glideRatio, float gforce, ParachuteLine?holdLines,
                                                Vector2 linePull)
        {
            var metricData = new FlightViewData <T>(
                speed: new Measure <Vector3>((speed * 60 * 60) / 1000, "km/h"),
                altitude: new Measure <float>(altitude, "m"),
                glideRatio: glideRatio,
                gforce: gforce,
                activeParachuteLines: holdLines,
                leftLinePull: linePull.x,
                rightLinePull: linePull.y);

            if (typeof(T) == typeof(MeasureSystem.Imperial))
            {
                return(new FlightViewData <T>(
                           speed: new Measure <Vector3>(MeasureSystem.KmhToMph(metricData.Speed.Value), "mph"),
                           altitude: new Measure <float>(MeasureSystem.MetersToFeet(metricData.Altitude.Value), "feet"),
                           glideRatio: metricData.GlideRatio,
                           gforce: metricData.Gforce,
                           activeParachuteLines: metricData.ActiveParachuteLines,
                           leftLinePull: linePull.x,
                           rightLinePull: linePull.y));
            }
            return(metricData);
        }
示例#2
0
        public async Task <GetWeatherApiResponse> GetAsync(string zipCode, MeasureSystem units)
        {
            var response = await _client.GetAsync($"weather?zip={zipCode}&units={units.ToStringName()}");

            if (!response.IsSuccessStatusCode)
            {
                throw new BadRequestException(ErrorCodes.BADREQUEST_API_RESPONSE, "No information was found for the entered data");
            }

            var result = JsonConvert.DeserializeObject <GetWeatherApiResponse>(await response.Content.ReadAsStringAsync());

            return(result);
        }