Пример #1
0
        private void CompleteCurtainAnimation()
        {
            if (_popup == null)
            {
                return;
            }
            //Animate transition
            var verticalHideAnimation = new DoubleAnimation
            {
                EnableDependentAnimation = true,
                From     = _popup.VerticalOffset,
                To       = -(Height + PaddingPopup),
                Duration = new Duration(TimeSpan.FromMilliseconds(100))
            };

            var sbHide = new Storyboard();

            sbHide.Children.Add(verticalHideAnimation);
            Storyboard.SetTarget(verticalHideAnimation, _popup);
            Storyboard.SetTargetProperty(verticalHideAnimation, "VerticalOffset");
            sbHide.Completed += (s, h) =>
            {
                try
                {
                    _popup.IsOpen = false;
                    _popup        = null;
                    _current      = null;
                }
                catch
                {
                }
            };
            sbHide.Begin();
        }
Пример #2
0
        public static CurtainToast ShowError(string msg)
        {
            if (_current != null)
            {
                _current.Dismiss();
            }

            var curtain = new CurtainToast(msg, true);

            _current = curtain;
            return(curtain);
        }
Пример #3
0
 public void Dismiss()
 {
     try
     {
         _popup.IsOpen = false;
         _popup        = null;
         _timer.Stop();
         _timer   = null;
         _current = null;
     }
     catch
     {
     }
 }