void pushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string message;

            using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
            {
                message = reader.ReadToEnd();
            }

            XElement m;
            try
            {
                m = XElement.Parse(message);
                var result = (from x in m.DescendantsAndSelf("message")
                                select new
                                {
                                    machineName = x.Element("machineName").Value,
                                    dateTime = x.Element("dateTime").Value,
                                    text = x.Element("text").Value
                                }).SingleOrDefault();
                if (result != null)
                {
                    Dispatcher.BeginInvoke(() =>
                       listBox1.Items.Insert(0, string.Format("{0} - {1}", result.machineName, result.text))

                   );
                }
            }
            catch(Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Handle the notifications from the server.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void channel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            // Create an XmlReader from the stream supplied by the server
            XmlReader reader = XmlReader.Create(e.Notification.Body);

            // Read the stream into an object
            Message msg = new Message();

            msg.ReadXml(reader);

            // Handle the message according to its type
            switch (msg.ContentType)
            {
            case MessageContentType.GameState:
            {
                UpdateGameState(msg.Body as GameState);
                break;
            }

            case MessageContentType.TicTacToeMove:
            {
                NewMove(msg.Body as TicTacToeMove);
                break;
            }
            }
        }
            void Instance_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
            {
                string message = "";

                try
                {
                    using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
                    {
                        message = reader.ReadToEnd();
                    }
                }
                catch (Exception)
                {
                }

                var dict = new Dictionary <string, object>();

                dict.Add("message", message);

                var headers = new Dictionary <string, string>();

                foreach (var key in e.Notification.Headers.AllKeys)
                {
                    headers.Add(key, e.Notification.Headers[key]);
                }

                dict.Add("headers", headers);

                var js = JsonConvert.SerializeObject(dict);

                FireDocumentEvent("'R1Push.foregroundHttpNotification', " + js);
            }
        /// <summary>
        /// Handle push notification sent from the server.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void channel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            // Reads the stream into an object
            Message message = ReadServerMessage(e.Notification.Body);

            if (message.SequenceNumber > lastMessageSequenceNumber)
            {
                lastMessageSequenceNumber = message.SequenceNumber;
            }
            else if (message.SequenceNumber != -1)
            {
                return;
            }

            // Parse the message body according to its type
            switch (message.ContentType)
            {
            case MessageContentType.GameState:
                NewGameState((message.Body as GameState));
                break;

            case MessageContentType.SimpleType:
                NewSimpleType((message.Body as SimpleType));
                break;

            case MessageContentType.EndGameInformation:
                NewEndGameState((message.Body as EndGameInformation));
                break;

            default:
                break;
            }
        }
Beispiel #5
0
 // Receiving a raw notification.
 // Raw notifications are only delivered to the application when it is running in the foreground.
 // If the application is not running in the foreground, the raw notification message is dropped.
 void myChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     if (e.Notification.Body != null && e.Notification.Headers != null)
     {
         System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body);
     }
 }
        void NotificationChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            var title = string.Empty;
            var message = string.Empty;
            using (var reader = new StreamReader(e.Notification.Body, Encoding.UTF8))
            {
                var temp = reader.ReadToEnd();
                var data = temp.Split(';');
                title = data[1];
                message = data[0];
            }

            Dispatcher.BeginInvoke(async () =>
            {
                var toast = new ToastPrompt()
                {
                    Background = new SolidColorBrush(Colors.White),
                    Foreground = new SolidColorBrush(Colors.Black),
                    Title = title,
                    FontSize = 30,
                    Message = message,
                    TextOrientation = System.Windows.Controls.Orientation.Vertical,
                    ImageSource = new BitmapImage(new Uri("/Assets/ApplicationIcon.png", UriKind.RelativeOrAbsolute))
                };

                toast.Show();

                _timer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 5) };
                _timer.Tick += timer_Tick;
                _timer.Start();
            });
        }
Beispiel #7
0
 private void OnRawNotification(HttpNotificationEventArgs e)
 {
     if (RawNotification != null)
     {
         RawNotification(this, e);
     }
 }
Beispiel #8
0
 void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     //接收到RAW通知
     if (this.RawMsgCallback != null)
     {
         this.RawMsgCallback(sender, e);
     }
 }
        private void HttpNotificationReceived(HttpNotificationEventArgs e)
        {
            var reader  = new StreamReader(e.Notification.Body);
            var message = reader.ReadToEnd();

            this.notifications.Items.Add("Raw:" + message);
            reader.Close();
        }
 void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     using (var reader = new StreamReader(e.Notification.Body))
     {
         string msg = reader.ReadToEnd();
         Dispatcher.BeginInvoke(() =>
    msgTextBlock.Text = msg);
     }
 }
        protected void OnHttpNotificationReceived(HttpNotificationEventArgs e)
        {
            var copy = _httpNotificationReceived;

            if (copy != null)
            {
                copy(this, e);
            }
        }
Beispiel #12
0
        void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            App.Trace("===============================================");
            App.Trace("RAW notification arrived");

            Dispatcher.BeginInvoke(() => ParseRAWPayload(e.Notification.Body));

            App.Trace("===============================================");
        }
        private void _ChannelNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string message;

            using (StreamReader reader = new StreamReader(e.Notification.Body))
            {
                message = reader.ReadToEnd();
            }
        }
Beispiel #14
0
        public void HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string message;

            using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
            {
                message = reader.ReadToEnd();
            }
            BmobDebug.Log(String.Format("Received Notification {0}:\n{1}", DateTime.Now.ToShortTimeString(), message));
        }
Beispiel #15
0
        void NewNotification(object s, HttpNotificationEventArgs e)
        {
            var message = string.Empty;

            using (var reader = new StreamReader(e.Notification.Body))
                message = reader.ReadToEnd();

            var mSplit = message.Split(',');

            GPSPush.App.Self.ChangedClass.BroadcastIt(mSplit[0], mSplit[1]);
        }
Beispiel #16
0
 // Receiving a raw notification.
 // Raw notifications are only delivered to the application when it is running in the foreground.
 // If the application is not running in the foreground, the raw notification message is dropped.
 void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     if (e.Notification.Body != null && e.Notification.Headers != null)
     {
         System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body);
         Dispatcher.BeginInvoke(() =>
         {
             txtURI.Text = "Raw Notification Message Received: " + reader.ReadToEnd();
         });
     }
 }
Beispiel #17
0
        private void PushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            using (var reader = new System.IO.StreamReader(e.Notification.Body)) {
                var data = reader.ReadToEnd();

                if (RawNotificationReceived != null)
                {
                    RawNotificationReceived(data);
                }
            }
        }
Beispiel #18
0
 void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     using (var reader = new StreamReader(e.Notification.Body))
     {
         string Rawmsg = reader.ReadToEnd();
         Dispatcher.BeginInvoke(() =>
         {
             msg.Text = Rawmsg;
         });
     }
 }
Beispiel #19
0
 private void OnRawNotificationReceived(object sender, HttpNotificationEventArgs args)
 {
     this.Dispatch(() =>
     {
         var rawNotification = this.RawNotification;
         if (rawNotification != null)
         {
             rawNotification(this, args);
         }
     });
 }
 private void notificationChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     Dispatcher.BeginInvoke(() =>
     {
         tbxInfo.Text  = string.Format("Http notification received: \nBody: {0}\nChannel: {1}", e.Notification.Body, e.Notification.Channel);
         tbxInfo.Text += "\nHeaders: ";
         foreach (var header in e.Notification.Headers)
         {
             tbxInfo.Text += "\n" + header.ToString();
         }
     });
 }
Beispiel #21
0
        /// <summary>
        /// Event handler for the HtppNotificationReceived event.
        /// This is called when a raw notification is received.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void channel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            byte[] bytes;
            using (var stream = e.Notification.Body)
            {
                bytes = new byte[stream.Length];
                stream.Read(bytes, 0, (int)stream.Length);
            }
            var message = Encoding.UTF8.GetString(bytes, 0, bytes.Length);

            OnRawNotificationReceived(message);
        }
Beispiel #22
0
        void PushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string message;

            using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
            {
                message = reader.ReadToEnd();
            }

            UpdateConsole(String.Format("Received Notification {0}:\n{1}",
                                        DateTime.Now.ToShortTimeString(), message));
        }
Beispiel #23
0
        private void HttpListener_Notification(object sender, EventArgs e)
        {
            lbxEvents.Items.Add("Notification(s) received");
            HttpNotificationEventArgs n = (HttpNotificationEventArgs)e;

            foreach (string notification in n.Notifications)
            {
                lbxEvents.Items.Add(string.Format("  {0}", notification));
                Console.WriteLine(string.Format("  {0}", notification));
            }

            lbxEvents.SelectedIndex = lbxEvents.Items.Count - 1;
        }
        static void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            Stream messageStream = e.Notification.Body;
            string message       = string.Empty;

            // Replacing NULL characters in stream.
            using (var reader = new StreamReader(messageStream))
            {
                message = reader.ReadToEnd().Replace('\0', ' ');
            }

            // Simply displaying the raw notification.
            ShowMessage(message, "Raw Notification");
        }
Beispiel #25
0
        /// <summary>
        /// The callback for receiving a raw notification.
        /// </summary>
        private void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            console.AddLine("Got raw notification:");

            // The client and server must agree on the format of this notification: it's just bytes
            // as far as the phone is concerned.  If the game is not running, this notification will
            // be dropped.  In this case, the payload is a string that was serialized with BinaryWriter.

            BinaryReader reader = new BinaryReader(e.Notification.Body, System.Text.Encoding.UTF8);

            string notificationText = reader.ReadString();

            console.AddLine(notificationText);
        }
Beispiel #26
0
        private void channel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string content = new StreamReader(e.Notification.Body).ReadToEnd();
            int eventId = int.Parse(content);

            // TODO - handle push notification
           
            if (App.ViewModel.CurrentEvent == null || App.ViewModel.CurrentEvent.Id != eventId) return;
            _sync.Post(async ignored =>
            {
                await App.ViewModel.LoadEvent(eventId);
            }, null);
             
        }
Beispiel #27
0
        void pushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string rawData;

            using (System.IO.StreamReader streamReader = new System.IO.StreamReader(e.Notification.Body))
            {
                rawData = streamReader.ReadToEnd();
            }

            Dispatcher.BeginInvoke(() =>
                                   MessageBox.Show(String.Format("New XML Data {0}:\n{1}",
                                                                 DateTime.Now.ToShortTimeString(), rawData))
                                   );
        }
Beispiel #28
0
        void PushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            var raw = new PushNotification
            {
                Type = "raw"
            };

            using (var reader = new StreamReader(e.Notification.Body))
            {
                raw.JsonContent.Add("Body", reader.ReadToEnd());
            }

            this.ExecuteCallback(this.pushOptions.NotificationCallback, JsonConvert.SerializeObject(raw));
        }
Beispiel #29
0
        void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            //Trace("===============================================");
            //Trace("RAW notification arrived:");

            //string weather, location, temperature;
            //ParseRAWPayload(e.Notification.Body, out weather, out location, out temperature);

            //Dispatcher.BeginInvoke(() => this.textBlockListTitle.Text = location);
            //Dispatcher.BeginInvoke(() => this.txtTemperature.Text = temperature);
            //Dispatcher.BeginInvoke(() => this.imgWeatherConditions.Source = new BitmapImage(new Uri(@"Images/" + weather + ".png", UriKind.Relative)));
            //Trace(string.Format("Got weather: {0} with {1}F at location {2}", weather, temperature, location));

            //Trace("===============================================");
        }
Beispiel #30
0
        //void channel_ShellEntryPointNotificationReceived(object sender, NotificationEventArgs e)
        //{
        //    if (e.Collection != null)
        //    {
        //        Dictionary<string, string> collection = (Dictionary<string, string>)e.Collection;
        //        System.Text.StringBuilder messageBuilder = new System.Text.StringBuilder();
        //        foreach (string elementName in collection.Keys)
        //        {
        //            MessageBox.Show(string.Format("elementName:{0}, value:{1}", elementName, collection[elementName]));
        //        }
        //    }
        //}

        void channel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            if (HttpNotificationReceived != null)
            {
                HttpNotificationReceived(sender, e);
            }

            //if (e.Notification.Body != null)
            //{
            //    using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
            //    {
            //        Debug.WriteLine(reader.ReadToEnd());
            //    }
            //}
        }
        private void OnRawNotification(object sender, HttpNotificationEventArgs e)
        {
            try
            {
                e.Notification.Body.Position = 0;

                var stream     = new StreamReader(e.Notification.Body);
                var rawMessage = stream.ReadToEnd();
                this.Notifications.Insert(0, rawMessage);

                this.Message = string.Format(CultureInfo.InvariantCulture, "Push notification received at {0}.", DateTime.Now.ToLongTimeString());
            }
            catch (Exception exception)
            {
                this.Message = string.Format(CultureInfo.InvariantCulture, "There was an error receiving last push notification: {0}", exception.Message);
            }
        }
Beispiel #32
0
        void PushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            object content = null;

            using (StreamReader reader = new StreamReader(e.Notification.Body))
            {
                content = JsonConvert.DeserializeObject <object>(reader.ReadToEnd());
            }

            PushNotification raw = new PushNotification
            {
                Type    = "raw",
                Content = content
            };

            SendEvent(JsonConvert.SerializeObject(raw));
        }
Beispiel #33
0
        // Process raw HTTP notification
        void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            Group targetGroup = null;

            Trace("===============================================");
            Trace("RAW notification arrived:");

            string taskId, groupTitle, taskTitle, description, assignedTo, dueDate, location, imageUrl, modifiedBy, modifiedTime, taskFiltered, taskCompleted;

            ParseRAWPayload(e.Notification.Body, out taskId, out groupTitle, out taskTitle, out description, out assignedTo, out dueDate, out location, out imageUrl, out modifiedBy, out modifiedTime, out taskFiltered, out taskCompleted);

            App.vm.GetGroupWithTitle(groupTitle, out targetGroup);
            targetGroup.AddTask(new Task(taskTitle, assignedTo, description, dueDate, location));

            App.vm.AddNotifcation(new Notification("New task " + taskTitle + " added to " + groupTitle));

            Trace("===============================================");
        }
            private void OnHttpNotificationReceived(object sender, HttpNotificationEventArgs e)
            {
                var raw = new PushNotification
                {
                    Type = "raw"
                };

                using (var reader = new StreamReader(e.Notification.Body))
                {
                    string body = reader.ReadToEnd();

                    Debug.WriteLine("Received " + body);

                    raw.JsonContent.Add("Body", body);
                }

                Notification.FireEvent(PushReceived, raw);
            }
Beispiel #35
0
 private void _channel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Event signaled when a Raw notification arrives
        /// </summary>
        /// <param name="sender">The sending object</param>
        /// <param name="e">The event arguments</param>
        private void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            Trace("===============================================");
            Trace("RAW notification arrived:");

            if ((NotificationFlag & NotificationFlagType.Raw) != NotificationFlagType.Raw)
            {
                Trace("RAW notifications not active");
                Trace("===============================================");
                return;
            }

            //
            // Parse and display the main parts of a raw notification
            //

            Uri TileUri;
            string Title;
            int Count;
            string Text1;
            string Text2;

            if (ParseRAWPayload(e.Notification.Body, out TileUri, out Title, out Count, out Text1, out Text2))
            {
                Trace("Raw:");
                Trace(TileUri == null ? "" : TileUri.ToString());
                Trace(Title);
                Trace(Count.ToString());
                Trace(Text1);
                Trace(Text2);

                NotifyData.BackgroundUri = TileUri;
                NotifyData.Title = Title;
                NotifyData.Count = Count;
                NotifyData.Text1 = Text1;
                NotifyData.Text2 = Text2;
            }
            else
            {
                Trace("RAW notification did not parse");
            }

            Trace("===============================================");
        }
            void Instance_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
            {
                string message = "";

                try
                {
                    using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
                    {
                        message = reader.ReadToEnd();
                    }
                }
                catch (Exception)
                {
                }

                var dict = new Dictionary<string, object>();

                dict.Add("message", message);

                var headers = new Dictionary<string, string>();
                foreach (var key in e.Notification.Headers.AllKeys)
                {
                    headers.Add(key, e.Notification.Headers[key]);
                }

                dict.Add("headers", headers);

                var js = JsonConvert.SerializeObject(dict);

                FireDocumentEvent("'R1Push.foregroundHttpNotification', " + js);
            }
Beispiel #38
0
 static void _channel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
 }
 static void pushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     ZumoWP8PushTests.rawPushesReceived.Enqueue(e);
 }
        void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            Trace("===============================================");
            Trace("RAW notification arrived:");

            //TODO - add parsing and UI updating logic here
            Trace("===============================================");
        }
Beispiel #41
0
 private void OnHttpNotification(object sender, HttpNotificationEventArgs e)
 {
     Debug.WriteLine("Got raw notification:");
     // The client and server must agree on the format of this notification: it's just bytes
     // as far as the phone is concerned. If the application is not running, this notification will
     // be dropped. In this case, we suppose the payload is a string that was serialized with
     // BinaryWriter.
     BinaryReader reader = new BinaryReader(e.Notification.Body, System.Text.Encoding.UTF8);
     string notificationText = reader.ReadString();
     Debug.WriteLine(notificationText);
 }
        private void CurrentChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            var notification = new NotificationResult { Title = string.Empty, Message = string.Empty };
            using (var reader = new StreamReader(e.Notification.Body))
            {
                notification.AdditionalData.Add("body", reader.ReadToEnd());
            }

            NotifyNotification(notification);
        }
        private async void RawNotificationReceived(
            object sender, HttpNotificationEventArgs args)
        {
            if(Configuration == null) return;

            if(Configuration.RawNotification != null)
                await Configuration.RawNotification(args);
            else {
                Mvx.TaggedTrace(MvxTraceLevel.Warning, "WindowsPhone Notifications",
                    "No RawNotification method was provided, using default");
                await Configuration.DefaultRawNotification(args);
            }
        }
Beispiel #44
0
        private void myPushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string message;

            try
            {
                var reader = new StreamReader(e.Notification.Body);
                message = reader.ReadToEnd();
            }
            catch (Exception ex)
            {
                message = ex.InnerException.ToString();
            }

            _dispatcher.BeginInvoke(() => ConsoleText += Environment.NewLine + message);
        }
        void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            Trace("===============================================");
            Trace("RAW notification arrived:");

            string weather, location, temperature;
            ParseRAWPayload(e.Notification.Body, out weather, out location, out temperature);

            Dispatcher.BeginInvoke(() => this.textBlockListTitle.Text = location);
            Dispatcher.BeginInvoke(() => this.txtTemperature.Text = temperature);
            Dispatcher.BeginInvoke(() => this.imgWeatherConditions.Source = new BitmapImage(new Uri(@"Images/" + weather + ".png", UriKind.Relative)));
            Trace(string.Format("Got weather: {0} with {1}F at location {2}", weather, temperature, location));

            Trace("===============================================");
        }
Beispiel #46
0
        private void PushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            using (var reader = new System.IO.StreamReader(e.Notification.Body)) {
                var data = reader.ReadToEnd();

                if (RawNotificationReceived != null) {
                    RawNotificationReceived(data);
                }
            }
        }
Beispiel #47
0
 private void HttpChannelHttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     // TODO: e.ToString();
 }
        private void OnRawNotification(object sender, HttpNotificationEventArgs e)
        {
            try
            {
                e.Notification.Body.Position = 0;

                var stream = new StreamReader(e.Notification.Body);
                var rawMessage = stream.ReadToEnd();
                this.Notifications.Insert(0, rawMessage);

                this.Message = string.Format(CultureInfo.InvariantCulture, "Push notification received at {0}.", DateTime.Now.ToLongTimeString());
            }
            catch (Exception exception)
            {
                this.Message = string.Format(CultureInfo.InvariantCulture, "There was an error receiving last push notification: {0}", exception.Message);
            }
        }
 protected void OnHttpNotificationReceived(HttpNotificationEventArgs e)
 {
     var copy = _httpNotificationReceived;
     if (copy != null)
         copy(this, e);
 }
        /// <summary>
        /// Event handler for when a raw notification arrives.  For this sample, the raw 
        /// data is simply displayed in a MessageBox.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string message;

            using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
            {
                message = reader.ReadToEnd();
            }

            if (OnNotificationRecieved != null)
                OnNotificationRecieved(message);
        }
 public void HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     string message;
     using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
     {
         message = reader.ReadToEnd();
     }
     BmobDebug.Log(String.Format("Received Notification {0}:\n{1}", DateTime.Now.ToShortTimeString(), message));
 }
        private void context_RawNotification(object sender, HttpNotificationEventArgs e)
        {
            try
            {
                using (var stream = new StreamReader(e.Notification.Body))
                {
                    var rawMessage = stream.ReadToEnd();
                    _rawMessages.Insert(0, rawMessage);
                    if ("AskToPin".CompareTo(rawMessage) == 0)
                    {
                        AskToPin();
                    }

                    UpdateServerInfo();
                }
            }
            catch (Exception ex)
            {
                ex.Show();
            }
        }
Beispiel #53
0
 private void PushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     // TODO: Process raw push notifications here, if required.
 }
Beispiel #54
0
 private void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
 {
     Deployment.Current.Dispatcher.BeginInvoke((ThreadStart)( () => {OnNotificationReceived(e);}) );
 }
        void pushChannel_HttpNotificationReceived
            (object sender,
            HttpNotificationEventArgs e)
        {
            string message;

            using (StreamReader reader = new StreamReader
                (e.Notification.Body))
            {
                message = reader.ReadToEnd();
            }
            
            Dispatcher.BeginInvoke(() =>
                MessageBox.Show(
                    String.Format
                    ("Empfangene Nachricht: {0}\n{1}",
                    DateTime.Now.ToShortTimeString(),
                    message))
                    );
        }
 private void OnRawNotificationReceived(object sender, HttpNotificationEventArgs args)
 {
     this.Dispatch(() =>
     {
         var rawNotification = this.RawNotification;
         if (rawNotification != null)
             rawNotification(this, args);
     });
 }
        void httpChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            App.Trace("===============================================");
            App.Trace("RAW notification arrived");

            Dispatcher.BeginInvoke(() => ParseRAWPayload(e.Notification.Body));

            App.Trace("===============================================");
        }
Beispiel #58
0
        private void PushChannelOnHttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string message;

            using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
            {
                message = reader.ReadToEnd();
            }

            Log("Received Notification {0}:\n{1}", DateTime.Now.ToShortTimeString(), message);
        }
        // Handles the Windows Phone RAW notification from the Arduino
        void PushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            string message;

            using (System.IO.StreamReader reader = new System.IO.StreamReader(e.Notification.Body))
            {
                message = reader.ReadToEnd();
            }

            HeatPumpIdentifyResponse response = (HeatPumpIdentifyResponse)JsonFunctions.DeserializeFromStringToJson(message, typeof(HeatPumpIdentifyResponse));

            System.Diagnostics.Debug.WriteLine("response to command: " + response.command + ":\n" + message);

            if (App.ViewModel.notificationHandlers.ContainsKey(response.command))
            {
                System.Diagnostics.Debug.WriteLine("Found handler for command " + response.command);
                App.ViewModel.notificationHandlers[response.command](message);
            }
        }
Beispiel #60
0
        private void PushChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
        {
            var raw = new PushNotification
            {
                Type = "raw"
            };

            raw.JsonContent = new ExpandoObject();

            using (var reader = new StreamReader(e.Notification.Body))
            {
                raw.JsonContent.Add("Body", reader.ReadToEnd());
            }

            this.ExecuteCallback(JValue.FromObject(raw).ToString());
        }