Example #1
0
        private void OnExampleUnloaded(object sender, RoutedEventArgs e)
        {
            if (_startDelegate != null)
            {
                _startDelegate.Dispose();
                _startDelegate = null;
            }

            PauseButton_Click(this, null);
        }
        private void OnExampleUnloaded(object sender, RoutedEventArgs e)
        {
            // Manages the state of the example on exit
            if (_startDelegate != null)
            {
                _startDelegate.Dispose();
                _startDelegate = null;
            }

            Pause();
        }
        // Manages the state of the example on exit
        public void OnExampleExit()
        {
            if (_startDelegate != null)
            {
                _startDelegate.Dispose();
                _startDelegate = null;
            }

            lock (_syncRoot)
            {
                Stop();
            }
        }
Example #4
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _popup   = GetTemplateChild("PART_Popup") as Canvas;
            _border  = GetTemplateChild("PART_Border") as Border;
            _root    = GetTemplateChild("RootElement") as Grid;
            _callout = GetTemplateChild("Callout") as Callout;

            if (_root == null)
            {
                return;
            }
            _fadeStoryboard = ((Storyboard)_root.TryFindResource("FadeBorderAnimation"));

            if (_border == null || _callout == null || _popup == null)
            {
                return;
            }

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                _popup.Visibility = Visibility.Visible;
            }

            MouseLeave += (s, e) =>
            {
                _popupCloseToken = TimedMethod.Invoke(() =>
                {
                    _popup.Visibility = Visibility.Collapsed;
                }).After(200).Go();
            };
            MouseEnter += (s, e) =>
            {
                if (_popupCloseToken != null)
                {
                    _popupCloseToken.Dispose();
                    _popupCloseToken = null;
                }
                if (_popup.Visibility == Visibility.Collapsed)
                {
                    _popup.Visibility = Visibility.Visible;
                }
            };

            _callout.MouseEnter += (s, e) =>
            {
                if (_popupCloseToken != null)
                {
                    _popupCloseToken.Dispose();
                    _popupCloseToken = null;
                }
            };

            _callout.MouseLeave += (s, e) =>
            {
                _popupCloseToken = TimedMethod.Invoke(() =>
                {
                    _popup.Visibility = Visibility.Collapsed;
                }).After(200).Go();
            };

            //#if !SILVERLIGHT
            //            _popup.VerticalOffset = -32;
            //            _popup.AllowsTransparency = true;
            //            _popup.PopupAnimation = PopupAnimation.Fade;
            //#endif
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _popup   = GetTemplateChild("PART_Popup") as Canvas;
            _border  = GetTemplateChild("PART_Border") as Border;
            _root    = GetTemplateChild("RootElement") as Grid;
            _callout = GetTemplateChild("Callout") as Callout;

            if (_root == null)
            {
                return;
            }
            _fadeStoryboard = ((Storyboard)_root.TryFindResource("FadeBorderAnimation"));

            if (_border == null || _callout == null || _popup == null)
            {
                return;
            }

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                _popup.Visibility = Visibility.Visible;
            }

            _border.MouseEnter += (s, e) =>
            {
                if (_popupCloseToken != null)
                {
                    _popupCloseToken.Dispose();
                    _popupCloseToken = null;
                }
                if (_popup.Visibility == Visibility.Collapsed)
                {
                    _popup.Visibility = Visibility.Visible;
                    _fadeStoryboard.Begin();
                }
            };

            _border.MouseLeave += (s, e) =>
            {
                _popupCloseToken = TimedMethod.Invoke(() =>
                {
                    _popup.Visibility = Visibility.Collapsed;
                    _fadeStoryboard.Stop();
                }).After(200).Go();
            };

            _callout.MouseEnter += (s, e) =>
            {
                if (_popupCloseToken != null)
                {
                    _popupCloseToken.Dispose();
                    _popupCloseToken = null;
                }
            };

            _callout.MouseLeave += (s, e) =>
            {
                _popupCloseToken = TimedMethod.Invoke(() =>
                {
                    _popup.Visibility = Visibility.Collapsed;
                    _fadeStoryboard.Stop();
                }).After(200).Go();
            };
        }