private async Task <double> GetTankWN8(PlayerVehicleStatistics vehicleStats)
        {
            if (referencialWN8Data == null)
            {
                var dataProvider = new ReferentialWN8DataRestService();
                referencialWN8Data = await dataProvider.GetReferencialWN8DataAsync();
            }

            var tankReferentialData = referencialWN8Data.data
                                      .Where(data => data.IDNum == Int32.Parse(vehicleStats.tank_id))
                                      .FirstOrDefault();

            var wn8calc = new CalculatorWN8
            {
                AverageDamage  = (double)vehicleStats.all.damage_dealt / vehicleStats.all.battles,
                AverageDefense = (double)vehicleStats.all.dropped_capture_points / vehicleStats.all.battles,
                AverageFrag    = (double)vehicleStats.all.frags / vehicleStats.all.battles,
                AverageSpot    = (double)vehicleStats.all.spotted / vehicleStats.all.battles,
                WinRate        = (double)vehicleStats.all.wins / vehicleStats.all.battles,

                ExpectedDamage  = tankReferentialData.expDamage,
                ExpectedDefense = tankReferentialData.expDef,
                ExpectedFrag    = tankReferentialData.expFrag,
                ExpectedSpot    = tankReferentialData.expSpot,
                ExpectedWinRate = tankReferentialData.expWinRate
            };

            return(wn8calc.GetWN8Value());
        }
        public async Task <ReferencialWN8Data> GetReferencialWN8DataAsync()
        {
            ReferencialWN8Data referencialWN8Data = null;

            try
            {
                HttpResponseMessage response = await client.GetAsync(endpointXVM);

                if (response.IsSuccessStatusCode)
                {
                    string content = await response.Content.ReadAsStringAsync();

                    var settings = new JsonSerializerSettings
                    {
                        NullValueHandling     = NullValueHandling.Ignore,
                        MissingMemberHandling = MissingMemberHandling.Ignore
                    };

                    referencialWN8Data = JsonConvert.DeserializeObject <ReferencialWN8Data>(content, settings);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("\tERROR {0}", ex.Message);
            }

            return(referencialWN8Data);
        }
 public VehiclesVisibleDataProvider()
 {
     referencialWN8Data = null;
 }