Пример #1
0
        public void Show(string message, double time = 2000)
        {
            MessageLabel.Content = message;
            IsToasting           = true;
            ParallelTask task = new ParallelTask(time);

            task.AddTask(SafelyHide);
            task.Start();
        }
        public void Show(double duration = 0)
        {
            TrasitionMargin(Border.Margin, new Thickness(0), Border.Name);
            _isHidden = false;

            TopLevelContent.IsEnabled = true;
            if (duration > 0)
            {
                if (_hideParallelTask != null)
                {
                    _hideParallelTask.RequestStop();
                }
                _hideParallelTask = new ParallelTask(duration);
                _hideParallelTask.AddTask(InvokeHide);
                _hideParallelTask.Start();
            }
        }
Пример #3
0
        private void ShowToast(double time)
        {
            Storyboard      storyboard      = new Storyboard();
            DoubleAnimation doubleAnimation = new DoubleAnimation {
                From        = 0.0,
                To          = 1.0,
                Duration    = new Duration(TimeSpan.FromSeconds(.4)),
                AutoReverse = false
            };

            Storyboard.SetTargetName(doubleAnimation, Grid.Name);
            Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath(OpacityProperty));
            storyboard.Children.Add(doubleAnimation);
            storyboard.Begin(this);

            ParallelTask task = new ParallelTask(time);

            task.AddTask(SafelyHide);
            task.Start();
        }
Пример #4
0
        public void Peak(double duration = 0, double peakMin = 0)
        {
            Dispatcher.Invoke((() => {
                if (peakMin > 0)
                {
                    PeakMinimum = peakMin;
                }
                TransitionMargin(Border.Margin, GetPeakMargin(), Border.Name);
                IsHidden = true;

                TopLevelContent.IsEnabled = false;
                if (duration > 0)
                {
                    if (_hideParallelTask != null)
                    {
                        _hideParallelTask.RequestStop();
                    }
                    _hideParallelTask = new ParallelTask(duration);
                    _hideParallelTask.AddTask(InvokeHide);
                    _hideParallelTask.Start();
                }
            }));
        }
        public void Peak(double duration = 0, double peakMin = 0)
        {
            if (peakMin > 0)
            {
                PeakMinimum = peakMin;
            }

            TrasitionMargin(Border.Margin, GetHideMargin(), Border.Name);
            Thread.Sleep(400);
            TrasitionMargin(Border.Margin, GetPeakMargin(), Border.Name);
            _isHidden = true;

            TopLevelContent.IsEnabled = false;
            if (duration > 0)
            {
                if (_hideParallelTask != null)
                {
                    _hideParallelTask.RequestStop();
                }
                _hideParallelTask = new ParallelTask(duration);
                _hideParallelTask.AddTask(InvokeHide);
                _hideParallelTask.Start();
            }
        }