public void UnSubscribe() { MonitoringMessageEvent = null; try { _monitoredAppMessageCalls.PublishUnsubscribeMessage(); } catch (Exception ex) { try { _monitorMessageCalls.ErrorOccured($"An error occured in the MonitoringWindowsService:\n{ex.Message}"); } catch (Exception exc) { // log the exception. } } }
public void Subscribe() { _monitorMessageCalls = OperationContext.Current.GetCallbackChannel <IPubSubMonitoringContract>(); _subscribedMonitorHandler = new MethodRanEventHandler(PublishMethodRanHandler); MonitoringMessageEvent = _subscribedMonitorHandler; try { _monitoredAppMessageCalls.PublishSubscribeMessage(); } catch (Exception ex) { try { _monitorMessageCalls.ErrorOccured($"An error occured in the MonitoringWindowsService:\n{ex.Message}"); } catch (Exception exc) { // log the exception. } } }