Пример #1
0
 private void CreateNotificationFromMainDispatcher(Message message)
 {
     Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate()
     {
         _CreateNotification(message);
     });
 }
Пример #2
0
 private void CreateNotificationFromDispatcher(Message message)
 {
     listNotifications.Dispatcher.BeginInvoke(new Action(delegate()
     {
         _CreateNotification(message);
     }));
 }
Пример #3
0
        private void HubConnectionStateChanged(StateChange state)
        {
            Debug.WriteLine("HubConnectionStateChanged Old={0}  New={1}", state.OldState, state.NewState);

            if (state.NewState == ConnectionState.Connected)
            {
                var message = new Message { Text = "Connected to service", Url = _serviceUrl, IsLocal = true };
                CreateNotificationFromMainDispatcher(message);
            }
        }
Пример #4
0
        private void CreateNotification(Message message)
        {
            listSource.Insert(0, message.ToString());

            BalloonBox balloon = new BalloonBox();
            balloon.BalloonText = "GitHub Notification";
            balloon.BalloonMessage = message.ToString();
            balloon.AdditionalClickEvent = new Task(() => Process.Start(message.Url));

            DNotificationIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, 6000);
        }
Пример #5
0
 private void MessageReceived(Message message)
 {
     try
     {
         CreateNotificationFromDispatcher(message);
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Received= " + message.ToString());
         Debug.WriteLine(ex.ToString());
     }
 }
Пример #6
0
        private void MessageReceived(Message message)
        {
            try
            {
                listNotifications.Dispatcher.BeginInvoke(new Action(delegate()
                {
                    CreateNotification(message);
                }));

            }
            catch (Exception ex)
            {
                Debug.WriteLine("Received= " + message.ToString());
                Debug.WriteLine(ex.ToString());
            }
        }
Пример #7
0
 private void NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         ConnectToHub();
     }
     else
     {
         var message = new Message { Text = "Connection lost with service", Url = _serviceUrl, IsLocal = true };
         CreateNotificationFromMainDispatcher(message);
     }
 }
Пример #8
0
        private void _CreateNotification(Message message)
        {
            _listSource.Insert(0, message.ToString());

            BalloonBox balloon = new BalloonBox();
            balloon.BalloonText = "GitHub Notifier";
            balloon.BalloonMessage = message.ToString();
            if (!string.IsNullOrEmpty(message.Url) && !message.IsLocal)
            {
                balloon.AdditionalClickEvent = new Task(() => Process.Start(message.Url));
            }
            DNotificationIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, 6000);
        }