public static string Draw(IntentoTranslationProviderOptionsForm form, SmartRoutingState state) { if (state == null) { form.formMT.RoutingTable = new Dictionary <string, string>(defaultRoutingTable); form.formMT.comboBoxRouting.SelectedIndex = 0; ProviderState.Draw(form, null); return(null); } return(state.Draw()); }
public string Draw() { form.formApi.apiKey_tb.Text = apiKey; form.formApi.buttonSave.Enabled = CheckPossible; switch (apiKeyStatus) { case EApiKeyStatus.start: if (string.IsNullOrEmpty(apiKey)) { form.formApi.apiKey_tb.Enabled = true; form.formApi.apiKey_tb.BackColor = Color.LightPink; // "Enter your API key and press \"Check\" button." error_reason = Resource.ApiKeyNeededErrorMessage; } else { form.formApi.apiKey_tb.Enabled = false; form.formApi.apiKey_tb.BackColor = SystemColors.Window; // "API key verification in progress ...." error_reason = Resource.ApiKeyVerificationInProgressMessage; } break; case EApiKeyStatus.download: form.formApi.apiKey_tb.Enabled = false; form.formApi.apiKey_tb.BackColor = SystemColors.Window; // "API key verification in progress ...." error_reason = Resource.ApiKeyVerificationInProgressMessage; break; case EApiKeyStatus.ok: form.formApi.apiKey_tb.Enabled = true; form.formApi.apiKey_tb.BackColor = SystemColors.Window; error_reason = null; break; case EApiKeyStatus.error: form.formApi.apiKey_tb.Enabled = true; form.formApi.apiKey_tb.BackColor = Color.LightPink; break; case EApiKeyStatus.changed: form.formApi.apiKey_tb.Enabled = true; form.formApi.apiKey_tb.BackColor = Color.LightPink; if (string.IsNullOrEmpty(apiKey)) { // Enter your API key and press \"Check\" button. error_reason = Resource.ApiKeyNeededErrorMessage; } else { // "API key verification in progress ...." error_reason = Resource.ApiKeyVerificationInProgressMessage; } break; } ApiKey_Set_Panel(IsOK); if (!IsOK) { SmartRoutingState.Draw(form, null); return(error_reason); } return(SmartRoutingState.Draw(form, smartRoutingState)); }