/// <summary> /// /// </summary> /// <param name="_form"></param> /// <param name="_options"></param> /// <param name="fromForm">Call from event, change of form check box may result recourcing</param> public AuthState(ProviderState providerState, IntentoMTFormOptions _options, bool fromForm = false) : base(providerState, _options) { this.providerState = providerState; formMT = providerState.form.formMT; options = _options; // set mode of checkBoxUseOwnCred if (!providerState.billable || !providerState.stock_model) // Auth Required { formMT.groupBoxBillingAccount.Enabled = true; //if (!fromForm) //{ // Internal_Change_checkBoxUseOwnCred_Checked(formMT, true); // formMT.checkBoxUseOwnCred.Enabled = false; //} mode = StateModeEnum.required; } else if (!providerState.own_auth) // Auth Prohibited { formMT.groupBoxBillingAccount.Enabled = false; //if (!fromForm) // Internal_Change_checkBoxUseOwnCred_Checked(formMT, false); mode = StateModeEnum.prohibited; } else { // Auth optional formMT.groupBoxBillingAccount.Enabled = true; //if (!fromForm) // Internal_Change_checkBoxUseOwnCred_Checked(formMT, options.UseCustomAuth); mode = StateModeEnum.optional; } if (!providerState.IsOK) { // smart routing return; } // Get credentials from Options providerDataAuthDict = new Dictionary <string, string>(); Dictionary <string, string> auth = options.authDict(); if (providerState.providerAuthList != null) { foreach (string key in providerState.providerAuthList) { if (auth != null && auth.ContainsKey(key)) { providerDataAuthDict[key] = auth[key]; } else { providerDataAuthDict[key] = ""; } } } }
public string Draw() { form.formMT.RoutingTable = routingTable; if (routing != null) { form.formMT.comboBoxRouting.SelectedValue = routing; } return(ProviderState.Draw(form, providerState)); }
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 static string Draw(IntentoTranslationProviderOptionsForm form, ProviderState state) { if (state == null) { form.formMT.groupBoxProvider.Enabled = false; Providers_ComboBox_BackColor_State(form.formMT, false); AuthState.Draw(form, null); return(null); } return(state.Draw()); }
private void CreateChildStates() { if (IsOK) { providerState = new ProviderState(this, options); if (SmartRouting) { providerState.ClearOptions(options); providerState = null; } } else { providerState = null; } }
public static void FillOptions(ProviderState state, IntentoMTFormOptions options) { if (state == null) { options.ProviderId = null; options.ProviderName = null; options.Format = null; AuthState.FillOptions(null, options); } else { options.ProviderId = state.currentProviderId; options.ProviderName = state.CurrentProviderName; options.Format = state.format; AuthState.FillOptions(state.GetAuthState(), options); } }
public static void FillOptions(SmartRoutingState state, IntentoMTFormOptions options) { if (state == null) { options.Routing = "best"; options.RoutingDisplayName = Resource.BestSmartRouteDescription; options.SmartRouting = true; ProviderState.FillOptions(null, options); } else { options.SmartRouting = state.SmartRouting; options.Routing = state.Routing; options.RoutingDisplayName = state.RoutingDescription; ProviderState.FillOptions(state.providerState, options); } if (options.SmartRouting) { options.Format = "[\"text\",\"html\",\"xml\"]"; } }
protected Dictionary <string, dynamic> ProcessModels(ProviderState providerState, IList <dynamic> raw) { // check for name duplicates and provide special naming for duplicates Dictionary <string, List <dynamic> > data = new Dictionary <string, List <dynamic> >(); foreach (dynamic item in raw) { string name = item.name; if (data.ContainsKey(name)) { data[name].Add(item); } else { data[name] = new List <dynamic> { item } }; } Dictionary <string, dynamic> res = new Dictionary <string, dynamic>(); foreach (KeyValuePair <string, List <dynamic> > pair in data) { if (pair.Value.Count == 1) { res[MakeModelName(pair.Value[0])] = pair.Value[0]; } else { foreach (dynamic item in pair.Value) { string name = MakeModelName(item, true, providerState.currentProviderId.Contains("google")); res[name] = item; } } } return(res); } }
/// <summary> /// /// </summary> /// <param name="_form"></param> /// <param name="_options"></param> /// <param name="fromForm">Call from event, change of form check box may result recourcing</param> public GlossaryState(AuthState authState, IntentoMTFormOptions _options, bool fromForm = false) : base(authState, _options) { this.authState = authState; providerState = authState.providerState; }
/// <summary> /// /// </summary> /// <param name="_form"></param> /// <param name="_options"></param> /// <param name="fromForm">Call from event, change of form check box may result recourcing</param> public ModelState(AuthState authState, IntentoMTFormOptions _options) : base(authState, _options) { this.authState = authState; providerState = authState.providerState; }