public ToastPresenter()
        {
            this.Loaded   += this.OnLoaded;
            this.Unloaded += this.OnUnloaded;

            this.pointerDownAnimation = new ToastPointerDownAnimation(this);

            this.translateAnimation            = new ToastTranslateAnimation(this);
            this.translateAnimation.Completed += this.OnDismissed;

            this.fadeInOutAnimation = new OpacityAnimation(this)
            {
                Duration = new Duration(TimeSpan.FromSeconds(1))
            };
            this.fadeInOutAnimation.Completed += this.OnDismissed;

            this.dismissTimer.Interval = TimeSpan.FromSeconds(5);
            this.dismissTimer.Tick    += this.OnDismissTimerTick;

            this.initialDelayTimer          = new DispatcherTimer();
            this.initialDelayTimer.Interval = TimeSpan.FromSeconds(3);
            this.initialDelayTimer.Tick    += this.OnInitialDelayTimerTick;

            this.Opacity = 0;
        }
 private void OnLoaded(object sender, RoutedEventArgs e)
 {
     this.closeButton          = ElementTreeHelper.FindVisualDescendant <Button>(this);
     this.closeButton.Click   += this.OnCloseButtonClick;
     this.closeButtonAnimation = new OpacityAnimation(this.closeButton)
     {
         Duration = new Duration(TimeSpan.FromMilliseconds(200))
     };
     this.initialDelayTimer.Start();
 }