Esempio n. 1
0
 private void CreateNewProxy()
 {
     try
     {
         if (TelegramNotify != null)
         {
             if (TelegramNotify.State == CommunicationState.Faulted)
             {
                 TelegramNotify.Abort();
             }
             else
             {
                 TelegramNotify.Close();
             }
             TelegramNotify = null;
         }
         var ic = new InstanceContext(this);
         TelegramNotify = new TelegramNotifyClient(ic);
         TelegramNotify.RegisterCommunicator(Name);
         Log?.AddLog(Log.Severity.EVENT, Name, String.Format("ServiceCommunicator.CreateNewProxy ({0})", Name), "");
     }
     catch (Exception ex)
     {
         Log?.AddLog(Log.Severity.EXCEPTION, Name, "ServiceCommunicator.CreateNewProxy Exception", ex.Message);
         throw new ServiceCommunicatorException(String.Format("{0} ServiceCommunicator.NotifyRcv failed. Reason:{1}", Name, ex.Message));
     }
 }
Esempio n. 2
0
 public override void Dispose()
 {
     try
     {
         base.Dispose();
         TelegramNotify?.Close();
     }
     catch {}
 }