private ShipViewerWindow ShowShipViewer(Swimbot bot, Point clickPoint) { // Make the camera follow this bean //TODO: Place a 2D graphic behind the selected ship //TODO: Zoom in on it #region Create Viewer ShipViewerWindow retVal = new ShipViewerWindow(bot, this); retVal.SetColorTheme_Dark_Gradient(); #endregion // Place Viewer Point screenClickPoint = UtilityWPF.TransformToScreen(clickPoint, grdViewPort); ShipViewerWindow.PlaceViewerInCorner(retVal, screenClickPoint); // This places the viewer to the right of where they clicked - which is fine if they can't drag the item // around, but it's in the way if they try to move the object //Point popupPoint = new Point(windowClickPoint.X + 50, windowClickPoint.Y - (viewer.Height / 3d)); //popupPoint = UtilityWPF.EnsureWindowIsOnScreen(popupPoint, new Size(viewer.Width, viewer.Height)); // don't let the popup straddle monitors //viewer.Left = popupPoint.X; //viewer.Top = popupPoint.Y; retVal.Show(); // it needs to be shown first to get the size return(retVal); }
private void SelectionLogic_ItemSelected(object sender, ItemSelectedArgs e) { try { ShipViewerWindow viewer = null; if (chkShowViewerOnSelect.IsChecked.Value && e.Item is Swimbot) { viewer = ShowShipViewer((Swimbot)e.Item, e.ClickPoint); } e.Requested_SelectedItem_Instance = new SelectedItemSwimbots(e.Item, e.Offset, viewer, grdViewPort, _viewport, pnlSelectionVisuals, _camera, e.ShouldMoveItemWithSpring, e.ShouldSpringCauseTorque, e.SpringColor); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }