public void GetRates() { Task.Factory.StartNew(() => { try { RateLimits limits = api.GetRateLimits(); Log.WriteLine("Finished getting new rate limits"); Dispatcher.Invoke((Action)(() => { SetRateLimits(limits); })); } catch (RateLimitHitException rex) { Log.WriteLine("Failed to get rate limits because of the rate limits on rate limits checking."); // Glorious invocation Dispatcher.Invoke((Action)(() => { TemporaryTextBox.SelectAll(); TemporaryTextBox.Selection.Text = "Rate limits are currently unavailable."; })); } }); }
public void SetRateLimits(RateLimits limits) { TemporaryTextBox.SelectAll(); TemporaryTextBox.Selection.Text = limits.ToString(); }