private void loadLastSavedData() { //TODO: Postavi city name, kako odgovor ne bi bio null RestResponse resp = rest_request.sendRequestToOpenWeather(client, rest_request.URL_Forecast); //something wen't wrong, or there is no internet connection if (resp.Root == null) { root = RootObjectIO.ReadRootFromFile(); if (root != null) { updateBasicTemperatureData(root); //Update data here, when fade out is finished updateDailyTemperatureData(); currentCity = $"{root.city.name},{root.city.country}"; dayDisplayedTextBlock.Text = $"Currenly showing data for {DateTime.Now.DayOfWeek}"; } else { //TODO: update the weather based on current location - IP LOCATOR loadDataForCurrentLocation(); } } }
private void backgroundFadeOutCompleted(object sender, EventArgs e) { //memorising the last updated location, in order for it to load at the beginning if (root != null) { updateBasicTemperatureData(root); //Update data here, when fade out is finished updateDailyTemperatureData(); //updating graph ReloadWeatherByHours(graphTemperatures, graphTimeIntervals); //updating text block identifying the graph dayDisplayedTextBlock.Text = $"Currenly showing data for {DateTime.Now.DayOfWeek}"; currentCity = $"{root.city.name},{root.city.country}"; RootObjectIO.WriteToFile(root); } DoubleAnimation da = new DoubleAnimation { From = 0, To = 1, Duration = new Duration(TimeSpan.FromSeconds(0.35)), AutoReverse = false }; ApplicationBackground.BeginAnimation(OpacityProperty, da); }