Canguro.Commands.View.Selection.ButtonDown C# (CSharp) Метод

ButtonDown() публичный Метод

Responds to MouseDown event. Performs picking or selection (start and end of window selection) according to the current SelectionFilter. It also sends a signal to CommandServices when selection is over so as to unlock waiting commands.
public ButtonDown ( Canguro activeView, System e ) : void
activeView Canguro The active View
e System MouseDown event arguments
Результат void
        public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            fx = e.X;
            fy = e.Y;

            object pickedObj = null;
            Canguro.Model.Model m = Canguro.Model.Model.Instance;
            Canguro.Controller.WaitingFor wf;

            if (services == null)
                wf = Canguro.Controller.WaitingFor.Many;
            else
                wf = services.SelectionFilter;

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                switch (wf)
                {
                    case Canguro.Controller.WaitingFor.None:
                    case Canguro.Controller.WaitingFor.SimpleValue:
                    case Canguro.Controller.WaitingFor.Text:
                        return;
                    case Canguro.Controller.WaitingFor.Point:
                        pickedObj = pickPoint(activeView);
                        break;
                    case Canguro.Controller.WaitingFor.Joint:
                    case Canguro.Controller.WaitingFor.Line:
                    case Canguro.Controller.WaitingFor.Area:
                    case Canguro.Controller.WaitingFor.Any:
                        pickedObj = pick(fx, fy, wf);
                        break;
                    case Canguro.Controller.WaitingFor.Many:
                        if (windowSelectionOn)
                        {
                            endWindowSelection(true, activeView, wf);
                            pickedObj = null;
                        }
                        else
                        {
                            // TODO: Try to get Anything by Picking and assign it to pickedObj
                            pickedObj = pick(fx, fy, wf);

                            // If nothing was picked turn to window selection mode
                            if (pickedObj == null)
                            {
                                startWindowSelection(e.Location);
                            }
                        }
                        break;

                    default:
                        throw new NotImplementedException("Selection.ButtonDown: " + wf.ToString());
                }
                // If something was picked
                if (pickedObj != null)
                {
                    // If an Item was picked, select it
                    if (wf == Canguro.Controller.WaitingFor.Many)
                    {
                        if (pickedObj is Canguro.Model.Item)
                        {
                            ((Canguro.Model.Item)pickedObj).IsSelected = !((Canguro.Model.Item)pickedObj).IsSelected;
                            Canguro.Model.Model.Instance.ChangeSelection((Canguro.Model.Item)pickedObj);
                        }
                    }
                    else
                        //// Send signal (and item) to CommandServices if selection is over
                        //// (SelectionFilter != WaitingFor.Many)
                        //if (wf != Canguro.Controller.WaitingFor.Many)
                        endCycle(pickedObj);
                }
            }
        }