private void handleLicenceError(LicenceError error) { if (_activationWindow != null) { _activationWindow.setBlockedView(false); } string message = null; switch (error) { case LicenceError.ERROR_INVALID_KEY: message = Properties.Strings.activation_error_invalid_key; break; case LicenceError.ERROR_NO_INTERNET_CONNECTION: message = Properties.Strings.activation_error_no_internet_connection; break; case LicenceError.ERROR_KEY_IS_ALREADY_USED: message = Properties.Strings.activation_error_key_is_already_used; break; case LicenceError.ERROR_INVALID_MACHINE: message = Properties.Strings.activation_error_activated_on_another_machine; break; case LicenceError.ERROR_SERVER_PROBLEM: message = Properties.Strings.activation_error_server_problem; break; } string title = Properties.Strings.error_text; System.Windows.Forms.MessageBox.Show(message, title, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); }
private void onActivationRequestCompleted(bool success, JObject response) { bool result = false; LicenceError error = LicenceError.ERROR_NONE; if (response != null) { JToken resultToken = response.GetValue("result"); if (resultToken != null) { JToken successToken = resultToken["success"]; if (successToken != null) { result = (bool)successToken; } else { JToken errorCodeToken = resultToken["errorcode"]; if (errorCodeToken != null) { error = (LicenceError)((int)errorCodeToken); } else { error = LicenceError.ERROR_SERVER_PROBLEM; } } } else { error = LicenceError.ERROR_SERVER_PROBLEM; } } else { error = LicenceError.ERROR_SERVER_PROBLEM; } if (result == true) { activateProduct(_userKey); } else { handleLicenceError(error); } }