Beispiel #1
0
        void myCanvas_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            _myCanvas.ReleaseMouseCapture();
            Mouse.OverrideCursor = Cursors.Arrow;

            //clear select flag
            if (_selectedUIElement == null)
            {
                return;
            }

            if (_selectedUIElement is LabwareUIElement)
            {
                ((LabwareUIElement)_selectedUIElement).Moving = false;
            }

            //pipetting commands need to highlight the labware
            if (otherFormNeedPickup)
            {
                return;
            }


            //here is very tricky, for Carrier, we hope to install them by topleft,
            //but for labware, we hope to install them by mouse position.
            Vector vecAdjust = new Vector();

            if (_selectedUIElement is CarrierUIElement)
            {
                var uiCarrierElement = _selectedUIElement as CarrierUIElement;
                workingLayout.AddCarrier(uiCarrierElement.Carrier);
                vecAdjust = GetAdjustVector();
            }

            WareInstaller.MountThis(_selectedUIElement, e.GetPosition(_myCanvas) - vecAdjust, _myCanvas, workingLayout);

            DeHighlightAllSite();
            _selectedUIElement.Selected = false;
            _selectedUIElement          = null;
        }