public void UnSubcribe() { try { communicateUI = null; callData = null; if (newCallDataProvider != null) { newCallDataProvider.CloseIntegration(); } //if (fileSubscriber != null) // fileSubscriber.Unsubscribe(); if (portSubscriber != null) { portSubscriber.Unsubscribe(); } //if (urlSubscriber != null) // urlSubscriber.Unsubscribe(); //if (pipeSubscriber != null) // pipeSubscriber.Unsubscribe(); } catch (Exception generalException) { _logger.Error("UnSubcribe()" + generalException.ToString()); } }
public void Subscribe(IDesktopCommunicator messagetoClient) { try { communicateUI = messagetoClient; } catch (Exception generalException) { _logger.Error("Error occurred while subscribing Plugin " + generalException.ToString()); } Settings settings = Settings.GetInstance(); if (settings.EnableCrmDbCommunication) { try { if (callData.CrmDbData.CrmDbFormat.Equals("SqlServer")) { Settings.GetInstance().cn = new SqlConnection(callData.CrmDbData.ConnectionSqlPath); Settings.GetInstance().cn.Open(); } else if (callData.CrmDbData.CrmDbFormat.Equals("Oracle")) { Settings.GetInstance().connection = new OracleConnection(callData.CrmDbData.ConnectionOraclePath); Settings.GetInstance().connection.Open(); } } catch (Exception exception) { DesktopMessenger.communicateUI.NotifyDesktopErrorMessage(exception.Message.ToString()); _logger.Error("Could not open db connection" + exception.ToString()); } } if (setting.EnableURLCommunication) { newCallDataProvider.NotifyLoginURL(); } }