public void UpdateWeather() { Dispatcher.UIThread.InvokeAsync(() => { Rectangle dim = this.FindControl <Rectangle>("WeatherDim"); Image gif = this.FindControl <Image>("WeatherGif"); Uri uri = new Uri($"resm:Kermalis.PokemonBattleEngineClient.MISC.WEATHER_{battleView.Client.Battle.Weather}.gif?assembly=PokemonBattleEngineClient"); switch (battleView.Client.Battle.Weather) { case PBEWeather.Hailstorm: dim.Fill = hailstormDim; GifImage.SetSourceUri(gif, uri); dim.IsVisible = gif.IsVisible = true; break; case PBEWeather.HarshSunlight: dim.Fill = harshSunlightDim; dim.IsVisible = true; gif.IsVisible = false; break; case PBEWeather.Rain: dim.Fill = rainDim; GifImage.SetSourceUri(gif, uri); dim.IsVisible = gif.IsVisible = true; break; case PBEWeather.Sandstorm: dim.Fill = sandstormDim; dim.IsVisible = true; gif.IsVisible = false; break; default: dim.IsVisible = gif.IsVisible = false; break; } }); }