Esempio n. 1
0
        private void OnDoubleClick()
        {
            _timerHeldClick.Stop();

            if (ButtonDoubleClick != null)
            {
                ButtonDoubleClick(this, ButtonState.BuildEventArgs());
            }

            ButtonState.Reset();
        }
Esempio n. 2
0
        private void OnHeldClick(object sender, EventArgs e)
        {
            _timerHeldClick.Stop();

            if (ButtonState.IsMouseDown || ButtonState.IsSingleClick)
            {
                if (ButtonHeldClick != null)
                {
                    MouseManagerEventArgs eventArgs = ButtonState.BuildEventArgs();
                    eventArgs.End = eventArgs.Start;

                    ButtonHeldClick(this, eventArgs);
                }
            }

            ButtonState.Reset();
        }
Esempio n. 3
0
        public void OnMouseButtonUp(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;

            ButtonState.End.PositionInformation = e;
            ButtonState.End.EventOrigin         = sender;

            if (ButtonState.IsMouseDown)
            {
                ButtonState.SetSingleClick();
            }
            else if (ButtonState.IsSingleClick)
            {
                ButtonState.SetDoubleClick();
            }
            else if (ButtonState.IsDrag)
            {
                _timerDoubleClick.Stop();
                _timerHeldClick.Stop();

                if (ButtonDragReleased != null)
                {
                    ButtonDragReleased(this, ButtonState.BuildEventArgs());
                }

                ButtonState.Reset();
            }
            else if (ButtonState.IsInactive)
            {
                _timerDoubleClick.Stop();
                _timerHeldClick.Stop();

                if (ButtonDragReleased != null)
                {
                    MouseManagerEventArgs eventArgs = ButtonState.BuildEventArgs();
                    eventArgs.Start = eventArgs.End;

                    ButtonDragReleased(this, eventArgs);
                }

                ButtonState.Reset();
            }
        }
Esempio n. 4
0
        public void OnMouseButtonDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;

            if (ButtonState.IsDrag)
            {
                _timerDoubleClick.Stop();
                _timerHeldClick.Stop();

                ButtonState.Reset();
            }

            if (ButtonState.IsInactive)
            {
                _timerHeldClick.Start();
                _timerDoubleClick.Start();

                ButtonState.SetMouseDown();
            }

            ButtonState.Start.PositionInformation = e;
            ButtonState.Start.EventOrigin         = sender;
        }