Esempio n. 1
0
        private void Window_MouseMove(object sender, MouseEventArgs e)
        {
            if (_rectangleMouseDown != null)
            {
                var p     = Mouse.GetPosition(_window);
                var delta = p.X - _previousMousePoint.X;

                if (_rectangleMouseDown == _leftRectangle)
                {
                    var w = Width - delta;
                    if (w <= 0)
                    {
                        return;
                    }
                    EffectiveWidthPixel = Width = w;
                    var tray = EMA.ExtendedWPFVisualTreeHelper.WPFVisualFinders.FindParent <ConveyorTray>(this);
                    if (tray != null)
                    {
                        tray.MoveCargo(this, delta, tray.OriginPosition);
                    }
                    OnLeftBorderChanged?.Invoke(this, delta);
                }
                else if (_rectangleMouseDown == _rightRectangle)
                {
                    var w = Width + delta;
                    if (w <= 0)
                    {
                        return;
                    }
                    EffectiveWidthPixel = Width = w;
                    OnRightBorderChanged?.Invoke(this, delta);
                }
                else if (_rectangleMouseDown == _moveRectangle)
                {
                    Tray.MoveCargo(this, delta, Tray.OriginPosition);
                    //var w = Width + delta;
                    //if (w <= 0) return;
                    //Width = w;
                }
                _previousMousePoint = p;
            }
        }