コード例 #1
0
        // Handler for new subscriber
        void RegistrationService_Subscribed(object sender, RegistrationService.SubscriptionEventArgs e)
        {
            // Check previous notifications, and resend last one to connected client
            if (null != lastSent)
            {
                string taskId         = lastSent[0];
                string groupTitle     = lastSent[1];
                string title          = lastSent[2];
                string description    = lastSent[3];
                string assignedTo     = lastSent[4];
                string dueDate        = lastSent[5];
                string location       = lastSent[6];
                string imageUrl       = lastSent[7];
                string lastModifiedBy = lastSent[8];
                string taskFiltered   = lastSent[9];
                string taskCompleted  = lastSent[10];

                List <Uri> subscribers = new List <Uri>();
                subscribers.Add(e.ChannelUri);
                byte[] payload = prepareRAWPayload(
                    taskId,
                    groupTitle,
                    title,
                    description,
                    assignedTo,
                    dueDate,
                    location,
                    imageUrl,
                    lastModifiedBy,
                    taskFiltered,
                    taskCompleted);

                ThreadPool.QueueUserWorkItem((unused) => notifier.SendRawNotification(subscribers, payload, OnMessageSent));
            }

            // Update UI to indicate subscriber has been added
            Dispatcher.BeginInvoke((Action)(() =>
                                            { UpdateStatus(); })
                                   );
        }
コード例 #2
0
 void RegistrationService_Subscribed(object sender, RegistrationService.SubscriptionEventArgs e)
 {
     Dispatcher.BeginInvoke((Action)(() =>
                                     { UpdateStatus(); }));
 }