コード例 #1
0
        private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var replaceExisting = false;
                var minWidth = 0.0;

                if (currentNotification != null)
                {
                    minWidth = currentNotification.ActualWidth;
                    replaceExisting = true;
                    RemoveOldNotification();
                }

                var item = e.NewItems[0] as Notification;

                currentNotification = new NotificationView() { DataContext = item, MinWidth = minWidth};
                currentNotification.MouseLeftButtonUp +=
                    delegate { if (currentNotification != null) RemoveOldNotification(); };

                LayoutRoot.Children.Add(currentNotification);
                currentNotification.Display(replaceExisting);

                if (item != null && item.Level == NotificationLevel.Error)
                {
                    timer.Interval = TimeSpan.FromSeconds(6);
                }
                else
                {
                    timer.Interval = TimeSpan.FromSeconds(3);
                }

                timer.Start();
            }
        }
コード例 #2
0
        private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var replaceExisting = false;
                var minWidth        = 0.0;

                if (_currentNotification != null)
                {
                    minWidth        = _currentNotification.ActualWidth;
                    replaceExisting = true;
                    RemoveOldNotification();
                }

                _currentNotification = new NotificationView()
                {
                    DataContext = e.NewItems[0], MinWidth = minWidth
                };
                _currentNotification.MouseLeftButtonUp +=
                    delegate { if (_currentNotification != null)
                               {
                                   RemoveOldNotification();
                               }
                };

                LayoutRoot.Children.Add(_currentNotification);
                _currentNotification.Display(replaceExisting);
                _timer.Start();
            }
        }
コード例 #3
0
        private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var replaceExisting = false;
                var minWidth        = 0.0;

                if (currentNotification != null)
                {
                    minWidth        = currentNotification.ActualWidth;
                    replaceExisting = true;
                    RemoveOldNotification();
                }

                var item = e.NewItems[0] as Notification;

                currentNotification = new NotificationView()
                {
                    DataContext = item, MinWidth = minWidth
                };
                currentNotification.MouseLeftButtonUp +=
                    delegate { if (currentNotification != null)
                               {
                                   RemoveOldNotification();
                               }
                };

                LayoutRoot.Children.Add(currentNotification);
                currentNotification.Display(replaceExisting);

                if (item != null && item.Level == NotificationLevel.Error)
                {
                    if (item.Message == "NotFound ")
                    {
                        ApplicationModel.Current.Server.Value.IsConnected.Value = false;
                    }
                    timer.Interval = TimeSpan.FromSeconds(6);
                }
                else
                {
                    timer.Interval = TimeSpan.FromSeconds(3);
                }

                timer.Start();
            }
        }
コード例 #4
0
        private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var replaceExisting = false;
                var minWidth = 0.0;

                if (_currentNotification != null)
                {
                    minWidth = _currentNotification.ActualWidth;
                    replaceExisting = true;
                    RemoveOldNotification();
                }

                _currentNotification = new NotificationView() { DataContext = e.NewItems[0], MinWidth = minWidth};
                _currentNotification.MouseLeftButtonUp +=
                    delegate { if (_currentNotification != null) RemoveOldNotification(); };

                LayoutRoot.Children.Add(_currentNotification);
                _currentNotification.Display(replaceExisting);
                _timer.Start();
            }
        }