AcManager.Pages.Drive.QuickDrive.ViewModel.Update C# (CSharp) 메소드

Update() 개인적인 메소드

private Update ( CancellationToken cancellation ) : Task
cancellation System.Threading.CancellationToken
리턴 Task
            private async Task Update(CancellationToken cancellation) {
                GeoTagsEntry trackGeoTags = null, localGeoTags = null;

                if (!RealConditionsLocalWeather || RealConditionsTimezones) {
                    var track = SelectedTrack;
                    trackGeoTags = track.GeoTags;
                    if (trackGeoTags == null || trackGeoTags.IsEmptyOrInvalid) {
                        trackGeoTags = await TracksLocator.TryToLocateAsync(track);
                        if (cancellation.IsCancellationRequested) return;
                    }
                }

                if ((trackGeoTags == null || RealConditionsLocalWeather) && !string.IsNullOrWhiteSpace(SettingsHolder.Drive.LocalAddress)) {
                    localGeoTags = await TracksLocator.TryToLocateAsync(SettingsHolder.Drive.LocalAddress);
                    if (cancellation.IsCancellationRequested) return;
                }

                // Time
                var now = DateTime.Now;
                var time = now.Hour * 60 * 60 + now.Minute * 60 + now.Second;

                if (!RealConditionsManualTime) {
                    if (trackGeoTags == null || !RealConditionsTimezones) {
                        TryToSetTime(time);
                    } else {
                        var timeZone = await TimeZoneDeterminer.TryToDetermineAsync(trackGeoTags);
                        if (cancellation.IsCancellationRequested) return;

                        TryToSetTime((time + (int)(timeZone == null ? 0 : timeZone.BaseUtcOffset.TotalSeconds - TimeZoneInfo.Local.BaseUtcOffset.TotalSeconds) +
                                SecondsPerDay) % SecondsPerDay);
                    }
                }

                // Weather
                var tags = RealConditionsLocalWeather ? localGeoTags : trackGeoTags ?? localGeoTags;
                if (tags == null) return;

                var weather = await WeatherProvider.TryToGetWeatherAsync(tags);
                if (cancellation.IsCancellationRequested) return;

                if (weather != null) {
                    RealWeather = weather;
                    
                    TryToSetTemperature(weather.Temperature);
                    SelectedWeatherType = weather.Type;
                    TryToSetWeather();
                }
            }