예제 #1
0
 protected virtual async void DispatchToUIThreadErrorReport(Exception e)
 {
     if (OnErrorReported != null)
     {
         await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal,
                                              new DispatchedHandler(() => { OnErrorReported(e); }));
     }
 }
예제 #2
0
 protected virtual async void DispatchToUIThreadProgressReport(string msg, HttpStatusCode status)
 {
     if (OnProgressReported != null)
     {
         await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal,
                                              new DispatchedHandler(() => { OnProgressReported(msg, status); }));
     }
 }
 async void NotifyResourceStateChange(string state, string resourceName)
 {
     if (OnResourceStateChanged != null)
     {
         await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal,
                                              new DispatchedHandler(() => { this.OnResourceStateChanged(state, resourceName); }));
     }
 }
 async void NotifyReceivedMessage(string status, string timestamp, string plainMsg, string participant)
 {
     if (OnMessageReceived != null)
     {
         await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal,
                                              new DispatchedHandler(() => { this.OnMessageReceived(status, timestamp, plainMsg, participant); }));
     }
 }
 async void ShowMissingEvents(string sender)
 {
     if (this.OnErrorReported != null)
     {
         await UcwaAppUtils.DispatchEventToUI(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                              new DispatchedHandler(() => { this.OnErrorReported(new Exception("Events by " + sender + "ignored.")); }));
     }
 }
 async void ShowProcessProgress(string msg)
 {
     if (this.OnProgressReported != null)
     {
         await UcwaAppUtils.DispatchEventToUI(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                              new DispatchedHandler(() => { this.OnProgressReported(msg); }));
     }
 }
 async void NotifyMessagingInvite(string subject, string importance, string fromUri, string message, string threadId)
 {
     if (OnMessagingInviteReceived != null)
     {
         await UcwaAppUtils.DispatchEventToUI(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                              new DispatchedHandler(() => { this.OnMessagingInviteReceived(subject, importance, fromUri, message, threadId); }));
     }
 }
 async void EventChannel_OnProgressReported(string msg, HttpStatusCode status)
 {
     if (OnProgressReported != null)
     {
         await UcwaAppUtils.DispatchEventToUI(
             CoreDispatcherPriority.Normal,
             new DispatchedHandler(() => { OnProgressReported(msg, status); }));
     }
 }
 async void ShowEventsBySener(string sender, UcwaEvent eventData)
 {
     if (this.OnProgressReported != null)
     {
         string msg = "Events raised by " + sender + ":\r\n";
         msg += "\tName=" + eventData.Name + " Type=" + eventData.Type + "\r\n";
         msg += "\tUri=" + eventData.Uri + "\r\n";
         await UcwaAppUtils.DispatchEventToUI(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                              new DispatchedHandler(() => { this.OnProgressReported(msg); }));
     }
 }
 async void EventChannel_OnEventChannelClosed(Windows.Foundation.AsyncStatus status)
 {
     if (OnEventChannelTerminated != null)
     {
         await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal,
                                              new DispatchedHandler(() => { OnEventChannelTerminated(status); }));
     }
     if (this.restartEventChannel)
     {
         this.EventChannel.Start();
     }
 }
예제 #11
0
        protected virtual async void DispatchToUIThreadReceivedEventNotifications(UcwaEventsData events)
        {
            if (this.OnEventNotificationsReceived != null)
            {
                await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal,
                                                     new DispatchedHandler(() => { this.OnEventNotificationsReceived(events); }));
            }

            //foreach (var sender in eventsData.SenderNames)
            //{
            //    if (OnEventsReceived != null)
            //        await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal,
            //            new DispatchedHandler(() => { OnEventsReceived(sender, eventsData.GetEventsBySender(sender)); }));
            //}
        }
 async void EventChannel_OnErrorReported(Exception e)
 {
     // connection interrupted.
     // report error and restart the event channel
     if (OnErrorReported != null)
     {
         await UcwaAppUtils.DispatchEventToUI(
             CoreDispatcherPriority.Normal,
             new DispatchedHandler(() => { OnErrorReported(e); }));
     }
     // await CleanUp();
     this.restartEventChannel = true;
     //this.EventChannel.Start();
     //this.EventChannel.Restart();
 }
        async void EventChannel_OnEventNotificationsReceived(UcwaEventsData eventsData)
        {
            if (eventsData == null)
            {
                return;
            }
            if (this.OnEventNotificationsReceived != null)
            {
                await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal,
                                                     new DispatchedHandler(() => { this.OnEventNotificationsReceived(eventsData); }));
            }

            foreach (var sender in eventsData.SenderNames)
            {
                if (OnEventsReceived != null)
                {
                    await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal,
                                                         new DispatchedHandler(() => { OnEventsReceived(sender, eventsData.GetEventsBySender(sender)); }));
                }
            }
        }