protected virtual async void DispatchToUIThreadProgressReport(string msg, HttpStatusCode status) { if (OnProgressReported != null) { await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal, new DispatchedHandler(() => { OnProgressReported(msg, status); })); } }
protected virtual async void DispatchToUIThreadErrorReport(Exception e) { if (OnErrorReported != null) { await UcwaAppUtils.DispatchEventToUI(CoreDispatcherPriority.Normal, new DispatchedHandler(() => { OnErrorReported(e); })); } }
async void EventChannel_OnProgressReported(string msg, HttpStatusCode status) { if (OnProgressReported != null) { await UcwaAppUtils.DispatchEventToUI( CoreDispatcherPriority.Normal, new DispatchedHandler(() => { OnProgressReported(msg, status); })); } }
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(); } }
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(); }
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_OnEventNotificationsReceived(UcwaEventsData events) { UcwaEventsData eventsData = events as UcwaEventsData; 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)); })); } } }