protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            SampleCsGetMultiplePointsConduit conduit = new SampleCsGetMultiplePointsConduit();

            conduit.Enabled = true;

            Rhino.Commands.Result rc = Result.Nothing;

            Rhino.Input.Custom.GetPoint gp = new Rhino.Input.Custom.GetPoint();
            while (true)
            {
                if (0 == conduit.PointCount)
                {
                    gp.SetCommandPrompt("Location of point object.");
                    gp.AcceptNothing(false);
                    gp.ClearCommandOptions();
                }
                else
                {
                    gp.SetCommandPrompt("Location of point object. Press Enter when done");
                    gp.AcceptNothing(true);
                    gp.AddOption("Undo");
                }

                Rhino.Input.GetResult res = gp.Get();

                if (res == Rhino.Input.GetResult.Point)
                {
                    conduit.AddPoint(gp.Point());
                    doc.Views.Redraw();
                }
                else if (res == Rhino.Input.GetResult.Option)
                {
                    conduit.RemoveLastPoint();
                    doc.Views.Redraw();
                }
                else if (res == Rhino.Input.GetResult.Nothing)
                {
                    rc = Rhino.Commands.Result.Success;
                    break;
                }
                else
                {
                    rc = Rhino.Commands.Result.Cancel;
                    break;
                }
            }

            if (rc == Result.Success && conduit.PointCount > 0)
            {
                doc.Objects.AddPoints(conduit.Points);
            }

            conduit.Enabled = false;
            doc.Views.Redraw();

            return(rc);
        }