Beispiel #1
0
        //========================================================================================
        // Methods
        //========================================================================================

        /// <summary>
        /// Show the window, fading in opacity.
        /// </summary>

        public new void Show()
        {
            // special case for TrackerWindow where track changes while window is displayed, we
            // want to reset the timer so it continues displaying the window for another cycle
            lock (timer)
            {
                if (timer.IsEnabled)
                {
                    timer.Stop();
                    timer.Interval = defaultFadeOutDelay;
                    timer.Start();
                    return;
                }
            }

            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.Invoke(Show);
                return;
            }

            try
            {
                Visibility = Visibility.Visible;

                // stop fadeout if in progress
                fadeOutStoryboard.Stop(element);

                // pull it forward and show the window
                Topmost = true;
                Opacity = VisibleOpacity;

                if ((element.Opacity > 0) && (element.Opacity < VisibleOpacity))
                {
                    // if animating then just complete it immediately
                    ShowCompleted(this, new EventArgs());
                }
                // if (element.Opacity == 0)
                else if (Math.Abs(element.Opacity - 0) < double.Epsilon)
                {
                    fadeInStoryboard.Begin(element, true);
                }
            }
            catch (Exception exc)
            {
                var dialog = new ExceptionDialog(new SmartException(exc), "Fading Window");
                dialog.ShowDialog();
            }
        }
Beispiel #2
0
        public static void HandleException(Exception exc, string scope)
        {
            if (!excepted)
            {
                // set excepted to true before we do anything furthe or we may fall into
                // an infinite loop of thrown exceptions!
                excepted = true;
                SmartException smartExc = new SmartException(exc);
                LogException(smartExc);

                ExceptionDialog dialog = new ExceptionDialog(smartExc, scope);
                dialog.ShowDialog();
                dialog = null;
            }
        }
Beispiel #3
0
        //========================================================================================
        // Methods
        //========================================================================================
        /// <summary>
        /// Show the window, fading in opacity.
        /// </summary>
        public new void Show()
        {
            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.Invoke(new Action(delegate { Show(); }));
                return;
            }

            try
            {
                this.Visibility = Visibility.Visible;

                // stop fadeout if in progress
                fadeOutStoryboard.Stop(element);

                // pull it forward and show the window
                Topmost = true;
                Opacity = VisibleOpacity;

                if ((element.Opacity > 0) && (element.Opacity < VisibleOpacity))
                {
                    // if animating then just complete it immediately
                    ShowCompleted(this, new EventArgs());
                }
                else if (element.Opacity == 0)
                {
                    fadeInStoryboard.Begin(element, true);
                }
            }
            catch (Exception exc)
            {
                ExceptionDialog dialog = new ExceptionDialog(new SmartException(exc), "Fading Window");
                dialog.ShowDialog();
                dialog = null;
            }
        }
Beispiel #4
0
        public static void HandleException(Exception exc, string scope)
        {
            if (!excepted)
            {
                // set excepted to true before we do anything furthe or we may fall into
                // an infinite loop of thrown exceptions!
                excepted = true;
                SmartException smartExc = new SmartException(exc);
                LogException(smartExc);

                ExceptionDialog dialog = new ExceptionDialog(smartExc, scope);
                dialog.ShowDialog();
                dialog = null;
            }
        }