public void Load() { WeatherProvider = new WeatherProvider(); var weatherData = Assembly.GetExecutingAssembly().GetManifestResourceStream("Widget.Weather.Weather.data"); //CurrentWeather = (WeatherData)XmlSerializable.Load(typeof(WeatherData), Envi.WidgetsRoot + "\\Weather\\Weather.data") ?? new WeatherData(); CurrentWeather = (WeatherData)XmlSerializable.Load(typeof(WeatherData), weatherData) ?? new WeatherData(); currentLocation = new LocationData {Code = WidgetDerived.Settings.LocationCode}; UpdateWeatherUI(); weatherTimer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(WidgetDerived.Settings.RefreshInterval) }; weatherTimer.Tick += WeatherTimerTick; weatherTimer.Start(); tileAnimTimer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(15)}; tileAnimTimer.Tick += TileAnimTimerTick; if (!string.IsNullOrEmpty(WidgetDerived.Settings.LocationCode)) { RefreshWeather(); if (Envi.AnimationEnabled) tileAnimTimer.Start(); } else { WeatherPanel.Visibility = Visibility.Collapsed; Tip.Visibility = Visibility.Visible; } }
public void Load() { WeatherProvider = new WeatherProvider(); var weatherData = Assembly.GetExecutingAssembly().GetManifestResourceStream("Widget.Weather.Weather.data"); //CurrentWeather = (WeatherData)XmlSerializable.Load(typeof(WeatherData), Envi.WidgetsRoot + "\\Weather\\Weather.data") ?? new WeatherData(); CurrentWeather = (WeatherData)XmlSerializable.Load(typeof(WeatherData), weatherData) ?? new WeatherData(); currentLocation = new LocationData { Code = WidgetDerived.Settings.LocationCode }; UpdateWeatherUI(); weatherTimer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(WidgetDerived.Settings.RefreshInterval) }; weatherTimer.Tick += WeatherTimerTick; weatherTimer.Start(); tileAnimTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(15) }; tileAnimTimer.Tick += TileAnimTimerTick; if (!string.IsNullOrEmpty(WidgetDerived.Settings.LocationCode)) { RefreshWeather(); if (Envi.AnimationEnabled) { tileAnimTimer.Start(); } } else { WeatherPanel.Visibility = Visibility.Collapsed; Tip.Visibility = Visibility.Visible; } }