コード例 #1
0
        private async Task HandleAddress()
        {
            var latlon = GeolocationInfo.GetLatLong(address.address, "REDACTED");

            address.lat = latlon.lat;
            address.lon = latlon.lon;
            var sunTime = await GeolocationInfo.GetDayLengthSeconds(address.lat, address.lon, address.date.ToShortDateString());

            address.timeSeconds = sunTime.day_length;

            List <IBuildingModel> iBuildings = buildings.ToList <IBuildingModel>();


            iBuildings = SolarTimeCalculator.CalculateSunTime(iBuildings, address.timeSeconds);
            buildings.Clear();
            barData.Clear();
            foreach (var iBuild in iBuildings)
            {
                buildings.Add(new DisplayBuildingModel
                {
                    label            = iBuild.label,
                    height           = iBuild.height,
                    width            = iBuild.width,
                    riseLocation     = iBuild.riseLocation,
                    setLocation      = iBuild.setLocation,
                    seeSunRise       = iBuild.seeSunRise,
                    seeSunSet        = iBuild.seeSunSet,
                    afternoonSunTime = iBuild.afternoonSunTime,
                    morningSunTime   = iBuild.morningSunTime
                });
                barData.Add(new BarChartModel {
                    label = iBuild.label, morningSun = iBuild.morningSunTime, afternoonSun = iBuild.afternoonSunTime
                });
            }

            await barObj.RefreshLiveData();
        }