private void RefreshStats() { if (_gimmick == null) { return; } if (_isRefreshingStats) { return; } this.NameLabel.Text = _gimmick.Name; this.OwnerLabel.Text = _gimmick.Owner; _isRefreshingStats = true; ((MainViewController)this.MainViewController).BlockUI(); this.ViewOpenedButton.Enabled = false; this.ViewWorkingButton.Enabled = false; this.ViewClosedButton.Enabled = false; Dictionary <string, int> stats = null; _cts0 = new CancellationTokenSource(); AppController.RefreshStats(_cts0, _gimmick.GimmickId, (newStats) => { stats = newStats; }, (error) => { UIToast.MakeText(error, UIToastLength.Long).Show(); }, () => { if (stats != null) { LoadStatistics(stats); _isRefreshingStats = false; ((MainViewController)this.MainViewController).UnblockUI(); } else { AppController.Utility.ExecuteOnAsyncTask(_cts0.Token, () => { stats = AppController.GetStats(_gimmick.GimmickId); }, () => { LoadStatistics(stats); _isRefreshingStats = false; ((MainViewController)this.MainViewController).UnblockUI(); }); } }); }