Ejemplo n.º 1
0
        private void DeleteAlert(NotiItem grid)
        {
            try {
                Storyboard      sb = new Storyboard();
                DoubleAnimation da = new DoubleAnimation(0, TimeSpan.FromMilliseconds(250))
                {
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseOut, Exponent = 5
                    }
                };
                Storyboard.SetTarget(da, grid);
                Storyboard.SetTargetProperty(da, new PropertyPath(Grid.OpacityProperty));

                sb.Children.Add(da);
                sb.Completed += (o, e) => {
                    try {
                        stackNotiPanel.Children.Remove(grid);
                    }
                    catch { }
                };
                sb.Begin(this);
            }
            catch { }
        }
Ejemplo n.º 2
0
        public void Alert(string title, string script, string type, Brush brush, int Timeout = 70)
        {
            this.Topmost = false; this.Topmost = true;

            NotiItem item = new NotiItem(title, script, type, brush);

            item.Response += item_Response;
            stackNotiPanel.Children.Add(item);

            DispatcherTimer dtm = new DispatcherTimer()
            {
                Interval  = TimeSpan.FromSeconds(Timeout),
                IsEnabled = true, Tag = item,
            };

            dtm.Tick += (o, e) => {
                (o as DispatcherTimer).Stop();
                DeleteAlert((o as DispatcherTimer).Tag as NotiItem);
                // Timeout
            };
        }