Пример #1
0
 private void ProxyOnNotifyReceived(object sender, NotifyReceivedEventArgs e)
 {
     if (!HasError(e))
     {
         if (e.from == "Chat")
             OnRefreshUsers(e.message.Split(new[] {','}));
         else
             OnNewMessage(e.from, e.message);
     }
 }
        private void NotifyReceived(object sender, NotifyReceivedEventArgs e)
        {
            try
            {
                if (e.Error == null)
                {
                    string notificationText = e.request.GetBody<NotificationData>().NotificationContent;

                    if (notificationText.IsNullOrBlank() || notificationText == NotificationData.NOTIFICATION_CLOSE_CONTENT)
                    {
                        DebugMessage_External("Blank or close notify message received=" + notificationText + ".");
                        //LogActivityMessage(MessageLevelsEnum.Warn, "Unknown error on machine notification session.");
                        Close();
                    }
                    /*else if (notificationText.StartsWith(m_closeSessionPrefix)) {
                        // This indicates an error has occurred creating the subscription and the session must be closed.
                        string errorMessage = notificationText.Replace(m_closeSessionPrefix, String.Empty);
                        LogActivityMessage(MessageLevelsEnum.Warn, "Error on machine notification session. " + errorMessage + ".");
                        CloseNotificationChannel(true);
                    }*/
                    else
                    {
                        if (NotificationReceived != null)
                        {
                            NotificationReceived(notificationText);
                        }

                        // Only machine events will be received on this channel.
                        //SIPMonitorEvent monitorEvent = SIPMonitorEvent.ParseEventCSV(notificationText);
                        //SIPEventMonitorClient_MonitorEventReceived((SIPMonitorMachineEvent)monitorEvent);
                    }
                }
                else
                {
                    //LogActivityMessage(MessageLevelsEnum.Error, "NotifyReceived Error: " + e.Error.Message);
                    Close();
                }
            }
            catch (Exception excp)
            {
                //LogActivityMessage(MessageLevelsEnum.Error, "Exception NotifyReceived. " + excp.Message);
                Close();
            }
        }
Пример #3
0
 void client_NotifyReceived(object sender, NotifyReceivedEventArgs e)
 {
     if (!this.IsError(e))
     {
         this.AddNotification("SERVER NOTIFICATION: " + e.request.GetBody<NotificationData>().Content);
     }
 }
 private void CloseSessionReceived(object sender, NotifyReceivedEventArgs e)
 {
     DebugMessage_External("CloseSessionReceived.");
     Close();
 }