/// <summary> /// Next / Import / Update. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonNext_Click(object sender, EventArgs e) { // Are at the last page ? if (MultiPanel.SelectedPage == ResultPage) { Complete(); return; } // We are at the first page if (!ValidateChildren()) { return; } // If the args have not been invalidated since the last time... if (m_creationArgs != null) { MultiPanel.SelectedPage = ResultPage; return; } // Display a warning if the cached timer hasn't expired yet if (m_updateMode && m_apiKey.CachedUntil > DateTime.UtcNow) { KeyPicture.Image = Resources.KeyWrong32; KeyLabel.Text = @"Cached timer not expired yet."; CharactersGroupBox.Text = @"Warning report"; CachedWarningLabel.Text = String.Format(CultureConstants.DefaultCulture, CachedWarningLabel.Text, m_apiKey.CachedUntil.ToLocalTime()); ResultsMultiPanel.SelectedPage = CachedWarningPage; Throbber.State = ThrobberState.Stopped; MultiPanel.SelectedPage = ResultPage; return; } MultiPanel.SelectedPage = WaitingPage; Throbber.State = ThrobberState.Rotating; // Are we updating existing API key ? if (m_updateMode) { m_apiKey.TryUpdateAsync(VerificationCodeTextBox.Text, OnUpdated); return; } // Or creating a new one ? long id; bool apiKeyExists = false; if (Int64.TryParse(IDTextBox.Text, out id)) { apiKeyExists = EveMonClient.APIKeys.Any(apiKey => apiKey.ID == id && apiKey.VerificationCode == VerificationCodeTextBox.Text); } // Does this API key already exists in our list ? if (apiKeyExists) { KeyPicture.Image = Resources.KeyWrong32; KeyLabel.Text = "API key already in list."; CharactersGroupBox.Text = "Error report"; ResultsMultiPanel.SelectedPage = APIKeyExistsErrorPage; Throbber.State = ThrobberState.Stopped; MultiPanel.SelectedPage = ResultPage; } else { APIKey.TryAddOrUpdateAsync(id, VerificationCodeTextBox.Text, OnUpdated); } }