Calling Thread.Sleep on your Silverlight application causes the UI thread to sleep. That means the application is not responsive.
If you want to delay something, you can use a storyboard.
Thread.Sleep(5000);this.Dispatcher.BeginInvoke(new Action(() =>{// Try to reconnect in the backgroundConnect.Execute(null);}));
❌ Code: Bad example - Using Thread.Sleep() causes your Silverlight application to freeze
Storyboard sb = new Storyboard() { Duration = TimeSpan.FromSeconds(5) };sb.Completed += (ds, de) => this.Dispatcher.BeginInvoke(new Action(() =>{// Try to reconnect in the backgroundConnect.Execute(null);}));sb.Begin();
✅ Code: Good example - Use a Storyboard with a duration of the delay and once the Storyboard is finished running