public void StartWebIntegration(List <ApplicationDataDetails> lstApplication) { try { if (lstApplication != null) { CfgApplication application = null; if (ConfigContainer.Instance().AllKeys.Contains("CfgApplication")) { application = ConfigContainer.Instance().GetValue("CfgApplication"); } if (application != null) { List <WebIntegrationData> lstWebIntegration = GetConfiguredIntegration <WebIntegrationData>("web-integration."); if (lstWebIntegration != null) { for (byte index = 0; index < lstWebIntegration.Count; index++) { if (lstWebIntegration[index].IsConditional && lstApplication.Any(x => x.ApplicationName == lstWebIntegration[index].ApplicationName)) { DesktopMessenger.totalWebIntegration++; lstWebIntegration[index].ApplicationData = lstApplication.SingleOrDefault(x => x.ApplicationName == lstWebIntegration[index].ApplicationName); UrlSubscriber objUrlIntegration = new UrlSubscriber(lstWebIntegration[index]); objUrlIntegration.Subscribe(newCallDataProvider); // If it is need , Need to call OnNext method. //objUrlIntegration.OnNext(null); } } } } } else { _logger.Warn("The web integration is null."); } } catch (Exception generalException) { _logger.Error("Error occurred as " + generalException.Message); _logger.Trace("Error trace: " + generalException.Message); } }
/// <summary> /// Its going to init the set of Web URL Integration. /// </summary> /// <param name="integrationMediaList">The integration media list.</param> private void InitWebUrlIntegration(System.Collections.Generic.Dictionary <string, bool> integrationMediaList = null) { System.Threading.Thread objThread = new System.Threading.Thread(() => { try { CfgApplication application = null; if (ConfigContainer.Instance().AllKeys.Contains("CfgApplication")) { application = ConfigContainer.Instance().GetValue("CfgApplication"); } if (application != null) { var file = Path.Combine(Path.Combine(System.Windows.Forms.Application.StartupPath, "Plugins"), "Pointel.Salesforce.Adapter.dll"); if (ConfigContainer.Instance().AllKeys.Contains("salesforce.enable.plugin") && ConfigContainer.Instance().GetAsBoolean("salesforce.enable.plugin") && File.Exists(file)) { if (application.Options.ContainsKey("salesforce-integration")) { KeyValueCollection salesforceSection = application.Options.GetAsKeyValueCollection("salesforce-integration"); if (salesforceSection.ContainsKey("sfdc.screen.popup") && salesforceSection.GetAsString("sfdc.screen.popup").ToLower() == "aid") { DesktopMessenger.totalWebIntegration += 1; } } } } List <WebIntegrationData> lstWebIntegration = GetConfiguredIntegration <WebIntegrationData>("web-integration."); //null; if (lstWebIntegration != null) { _logger.Trace("Number of web integration configured: " + lstWebIntegration.Count); for (byte index = 0; index < lstWebIntegration.Count; index++) { if (lstWebIntegration[index].IsEnableIntegration) { if (lstWebIntegration[index].ApplicationName.ToLower().Equals("lawson")) { if (integrationMediaList != null && integrationMediaList.ContainsKey("Lawson") && integrationMediaList["Lawson"]) { Settings.GetInstance().IsLawsonEnabled = integrationMediaList["Lawson"]; } else { continue; } } UrlSubscriber objUrlIntegration = new UrlSubscriber(lstWebIntegration[index]); if (lstWebIntegration[index].BrowserType == BrowserType.AID) { totalWebIntegration++; } objUrlIntegration.Subscribe(newCallDataProvider); } else { _logger.Warn("Integration disabled for the application '" + lstWebIntegration[index].ApplicationName + "'"); } } } } catch (Exception ex) { _logger.Error("Error occurred while subcribe URL Popup as " + ex.Message); } }); objThread.Start(); }