Example #1
0
        private void Deactivate()
        {
            _parent.MouseEnter  -= new System.Windows.Input.MouseEventHandler(OnMouseEnter);
            _parent.MouseLeave  -= new System.Windows.Input.MouseEventHandler(OnMouseLeave);
            _parent.Activated   -= new EventHandler(OnParentActivated);
            _parent.Deactivated -= new EventHandler(OnParentDeactivated);

            DropHelper.RemoveDragStartedHandler(_parent, new RoutedEventHandler(OnDragStarted));
            DropHelper.RemoveDragStoppedHandler(_parent, new RoutedEventHandler(OnDragStopped));

            TerminateAutoHideTimer();
        }
Example #2
0
        private void Activate()
        {
            _parent.MouseEnter  += new System.Windows.Input.MouseEventHandler(OnMouseEnter);
            _parent.MouseLeave  += new System.Windows.Input.MouseEventHandler(OnMouseLeave);
            _parent.Activated   += new EventHandler(OnParentActivated);
            _parent.Deactivated += new EventHandler(OnParentDeactivated);

            DropHelper.AddDragStartedHandler(_parent, new RoutedEventHandler(OnDragStarted));
            DropHelper.AddDragStoppedHandler(_parent, new RoutedEventHandler(OnDragStopped));

            StartAutoHideTimerIfNeeded();
        }
Example #3
0
        /// <summary>
        /// Initializing constructor
        /// </summary>
        /// <param name="parent">Reference to the parent window</param>
        /// <param name="parameters">Auto-hider configuration settings</param>
        public WindowAutoHider(Window parent, WindowAutoHiderParams parameters)
        {
            _parent       = parent;
            _mode         = AutoHideMode.None;
            _currentState = AutoHideState.Visible;
            _params       = parameters;

            _dropHelper = new DropHelper(parent);

            // This code may appear silly to an untrained eye, but if it's not here, even though 'parent.Left' has
            // a valid value, when we try animate it we might get an exception because DoubleAnimation might read it
            // as NaN. It's fine everywhere else, only the animation is screwed up.
            parent.Left = parent.Left;
            parent.Top  = parent.Top;
        }
Example #4
0
        /// <summary>
        /// Initializing constructor
        /// </summary>
        /// <param name="parent">Reference to a parent window</param>
        public TrashCanPopupManager( Window parent )
        {
            _trashCan = parent.FindName( "TrashCanPopup" ) as Popup;
            _trashIcon = parent.FindName( "TrashIconRect" ) as FrameworkElement;

            if( _trashCan != null )
            {
                DragHelper.DragStarted += OnGlobalDragStarted;
                DragHelper.DragComplete += OnGlobalDragComplete;

                var dropHelper = new DropHelper( _trashCan );

                dropHelper.QueryDragDataValid += OnTrashCanDragQueryDataValid;
                dropHelper.TargetDrop += OnTrashCanDrop;
            }

            if( _trashIcon != null )
            {
                _trashIcon.RenderTransform = new ScaleTransform( 1.0, 1.0 );
                _trashIcon.RenderTransformOrigin = new Point( 0.5, 0.9 );
            }
        }
Example #5
0
        /// <summary>
        /// Initializing constructor
        /// </summary>
        /// <param name="parent">Reference to a parent window</param>
        public TrashCanPopupManager(Window parent)
        {
            _trashCan  = parent.FindName("TrashCanPopup") as Popup;
            _trashIcon = parent.FindName("TrashIconRect") as FrameworkElement;

            if (_trashCan != null)
            {
                DragHelper.DragStarted  += OnGlobalDragStarted;
                DragHelper.DragComplete += OnGlobalDragComplete;

                var dropHelper = new DropHelper(_trashCan);

                dropHelper.QueryDragDataValid += OnTrashCanDragQueryDataValid;
                dropHelper.TargetDrop         += OnTrashCanDrop;
            }

            if (_trashIcon != null)
            {
                _trashIcon.RenderTransform       = new ScaleTransform(1.0, 1.0);
                _trashIcon.RenderTransformOrigin = new Point(0.5, 0.9);
            }
        }
Example #6
0
        /// <summary>
        /// Initializing constructor
        /// </summary>
        /// <param name="parent">Reference to the parent window</param>
        /// <param name="parameters">Auto-hider configuration settings</param>
        public WindowAutoHider( Window parent, WindowAutoHiderParams parameters )
        {
            _parent = parent;
            _mode = AutoHideMode.None;
            _currentState = AutoHideState.Visible;
            _params = parameters;

            _dropHelper = new DropHelper( parent );

            // This code may appear silly to an untrained eye, but if it's not here, even though 'parent.Left' has
            // a valid value, when we try animate it we might get an exception because DoubleAnimation might read it
            // as NaN. It's fine everywhere else, only the animation is screwed up.
            parent.Left = parent.Left;
            parent.Top = parent.Top;
        }