partial void LoginClicked(NSButton sender) { ActivityIndicator.StartAnimation(this); ViewUsageButton.Enabled = false; // Try and validate the hash code, in the background so we don't lock the UI UsageChecker.ValidateHashCode(HashCode.StringValue, (success) => { BeginInvokeOnMainThread(() => { // Update UI with what we found out ActivityIndicator.StopAnimation(this); ViewUsageButton.Enabled = true; if (success) { OnLoggedIn(HashCode.StringValue); } else { NSAlert.WithMessage("Error", "OK", null, null, "The Hash Code you entered is incorrect, please double-check the code you entered.").RunModal(); } }); }); }