Esempio n. 1
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (_isMouseDown)
     {
         if (!IsMouseCaptured)
         {
             CaptureMouse();
         }
         Point ptMouseMove = e.GetPosition(this);
         if (Math.Abs(ptMouseMove.X - _mouseDownPoint.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(ptMouseMove.Y - _mouseDownPoint.Y) > SystemParameters.MinimumVerticalDragDistance)
         {
             _isMouseDown = false;
             if (IsMouseCaptured)
             {
                 ReleaseMouseCapture();
             }
             if (Mouse.Captured != null)
             {
                 Mouse.Captured.ReleaseMouseCapture();
             }
             if (DragCommand != null)
             {
                 DragCommand.Execute(CommandParameter);
             }
             UpdateCursor();
         }
     }
 }
Esempio n. 2
0
 public NodeViewModel(object key, int size) : base(new NodeViewModelValidator())
 {
     SelectCommand         = new SelectCommand(this);
     DragCommand           = new DragCommand(this);
     ReSizeCommand         = new ReSizeCommand(this);
     Size                  = size;
     Key                   = key;
     this.PropertyChanged += NodeViewModel_PropertyChanged;
 }
Esempio n. 3
0
 protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
 {
     base.OnMouseLeftButtonDown(e);
     if (e.ClickCount == 1 && ((DragCommand != null && DragCommand.CanExecute(CommandParameter)) || (ClickCommand != null && ClickCommand.CanExecute(CommandParameter))))
     {
         _mouseDownPoint = e.GetPosition(this);
         _isMouseDown    = true;
         CaptureMouse();
     }
 }
 private void InitCommands()
 {
     DragCommand             = new DragCommand(this);
     MinimizeCommand         = new MinimizeCommand(this);
     MaximizeCommand         = new MaximizeCommand(this);
     QuitCommand             = new QuitCommand(this);
     NewCommand              = new NewCommand(this);
     ExportCommand           = new ExportCommand(this);
     ChangeHeightCommand     = new ChangeHeightCommand(this);
     DetailResolutionCommand = new DetailResolutionCommand(this);
     HelpCommand             = new HelpCommand(this);
 }
Esempio n. 5
0
        public FluentSessionRecorder To(IElement elementB)
        {
            IActionCommand command = null;

            switch (_refToPointA)
            {
            case RefToPointA.Selector:
                command = new DragCommand(_selectorA, elementB);
                break;

            case RefToPointA.Element:
                throw new NotImplementedException();

            case RefToPointA.Offset:
                command = new DragCommand(_xOffsetToA, _yOffsetToA, elementB);
                break;
            }

            _performer.Perform(command);
            return(_recorder);
        }
Esempio n. 6
0
        /*-------------------------------------------------------------------*/

        public FluentSessionRecorder To(string selectorB)
        {
            IActionCommand command = null;

            switch (_refToPointA)
            {
            case RefToPointA.Selector:
                command = new DragCommand(_selectorA, selectorB);
                break;

            case RefToPointA.Element:
                command = new DragCommand(_elementA, selectorB);
                break;

            case RefToPointA.Offset:
                command = new DragCommand(_xOffsetToA, _yOffsetToA, selectorB);
                break;
            }

            _performer.Perform(command);
            return(_recorder);
        }
Esempio n. 7
0
 private void UpdateCursor()
 {
     Cursor = (DragCommand != null && DragCommand.CanExecute(CommandParameter)) || (ClickCommand != null && ClickCommand.CanExecute(CommandParameter)) ? Cursors.Hand : Cursors.Arrow;
 }
Esempio n. 8
0
 public void SetUp()
 {
     _defaultCommand = new DragCommand(DefaultSelector, DefaultSelector);
 }