Beispiel #1
0
        /// <summary>
        /// This informs the caller that an item was selected, and gives them a chance to instantiate an overriden
        /// SelectedItems instance that holds custom selection visuals
        /// </summary>
        protected virtual MapObject_ChasePoint_Direct OnItemSelected(IMapObject item, Vector3D offset, Point clickPoint)
        {
            if (this.ItemSelected == null)
            {
                // No listeners
                return(new MapObject_ChasePoint_Direct(item, offset, this.ShouldMoveItemWithSpring, this.ShouldSpringCauseTorque, this.ShouldDampenWhenSpring, _viewport, this.SpringColor));
            }

            ItemSelectedArgs args = new ItemSelectedArgs(item, offset, clickPoint, this.ShouldMoveItemWithSpring, this.ShouldSpringCauseTorque, this.SpringColor);

            // Raise the event
            this.ItemSelected(this, args);

            // See if they created a custom instance
            if (args.Requested_SelectedItem_Instance != null)
            {
                return(args.Requested_SelectedItem_Instance);
            }
            else
            {
                return(new MapObject_ChasePoint_Direct(item, offset, this.ShouldMoveItemWithSpring, this.ShouldSpringCauseTorque, this.ShouldDampenWhenSpring, _viewport, this.SpringColor));
            }
        }
        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);
            }
        }
        /// <summary>
        /// This informs the caller that an item was selected, and gives them a chance to instantiate an overriden
        /// SelectedItems instance that holds custom selection visuals
        /// </summary>
        protected virtual MapObject_ChasePoint_Direct OnItemSelected(IMapObject item, Vector3D offset, Point clickPoint)
        {
            if (this.ItemSelected == null)
            {
                // No listeners
                return new MapObject_ChasePoint_Direct(item, offset, this.ShouldMoveItemWithSpring, this.ShouldSpringCauseTorque, this.ShouldDampenWhenSpring, _viewport, this.SpringColor);
            }

            ItemSelectedArgs args = new ItemSelectedArgs(item, offset, clickPoint, this.ShouldMoveItemWithSpring, this.ShouldSpringCauseTorque, this.SpringColor);

            // Raise the event
            this.ItemSelected(this, args);

            // See if they created a custom instance
            if (args.Requested_SelectedItem_Instance != null)
            {
                return args.Requested_SelectedItem_Instance;
            }
            else
            {
                return new MapObject_ChasePoint_Direct(item, offset, this.ShouldMoveItemWithSpring, this.ShouldSpringCauseTorque, this.ShouldDampenWhenSpring, _viewport, this.SpringColor);
            }
        }