コード例 #1
0
ファイル: LengthProperty.cs プロジェクト: SOFAgh/CADability
        bool ICommandHandler.OnCommand(string MenuId)
        {
            switch (MenuId)
            {
            case "MenuId.Length.ModifyWithMouse":
                ModifyWithMouse?.Invoke(this, false);
                return(true);

            case "MenuId.Length.DistanceOfCurve":
                Frame.SetAction(new CADability.Actions.ConstructDistanceOfCurve(this));
                return(true);

            case "MenuId.Length.DistanceTwoPoints":
                Frame.SetAction(new CADability.Actions.ConstructDistanceTwoPoints(this));
                return(true);

            case "MenuId.Length.DistancePointCurve":
                Frame.SetAction(new CADability.Actions.ConstructDistancePointCurve(this));
                return(true);

            case "MenuId.Length.DistanceTwoCurves":
                Frame.SetAction(new CADability.Actions.ConstructDistanceTwoCurves(this));
                return(true);

            case "MenuId.Length.DoubleValue":
                this.SetLength(this.GetLength() * 2.0);
                return(true);

            case "MenuId.Length.HalfValue":
                this.SetLength(this.GetLength() * 0.5);
                return(true);

            case "MenuId.Length.NameVariable":
                Frame.Project.SetNamedValue(null, GetLength());
                return(true);

            case "MenuId.Length.FormatSettings":
            {
                Frame.ShowPropertyDisplay("Global");
                IPropertyPage  pd = Frame.GetPropertyDisplay("Global");
                IPropertyEntry sp = pd.FindFromHelpLink("Setting.Formatting");
                if (sp != null)
                {
                    pd.OpenSubEntries(sp, true);
                    sp = pd.FindFromHelpLink("Setting.Formatting.GeneralDouble");
                    if (sp != null)
                    {
                        pd.OpenSubEntries(sp, true);
                        pd.SelectEntry(sp);
                    }
                }
            }
                return(true);
                // return false;
            }
            return(false);
        }
コード例 #2
0
        bool ICommandHandler.OnCommand(string MenuId)
        {
            switch (MenuId)
            {
            case "MenuId.Vector.ModifyWithMouse":
                if (ModifyWithMouse != null)
                {
                    ModifyWithMouse(this, false);
                }
                return(true);

            case "MenuId.Vector.DirectionOfCurve":
                Frame.SetAction(new CADability.Actions.ConstructDirectionOfCurve(this));
                return(true);

            case "MenuId.Vector.DirectionOfSurface":
                Frame.SetAction(new CADability.Actions.ConstructDirectionOfSurface(this));
                return(true);

            case "MenuId.Vector.DirectionTwoPoints":
                Frame.SetAction(new CADability.Actions.ConstructDirectionTwoPoints(this));
                return(true);

            case "MenuId.Vector.NameVariable":
                Frame.Project.SetNamedValue(null, GetGeoVector());
                return(true);

            // return false;
            case "MenuId.Vector.FormatSettings":
            {
                Frame.ShowPropertyDisplay("Global");
                IPropertyPage  pd = Frame.GetPropertyDisplay("Global");
                IPropertyEntry sp = pd.FindFromHelpLink("Setting.Formatting");
                if (sp != null)
                {
                    pd.OpenSubEntries(sp, true);
                    sp = pd.FindFromHelpLink("Setting.Formatting.Vector");
                    if (sp != null)
                    {
                        pd.OpenSubEntries(sp, true);
                        pd.SelectEntry(sp);
                    }
                }
            }
                return(true);
            }
            return(false);
        }
コード例 #3
0
        bool ICommandHandler.OnCommand(string MenuId)
        {
            if (FilterCommandEvent != null)
            {
                bool handled = false;
                FilterCommandEvent(this, MenuId, null, ref handled);
                if (handled)
                {
                    return(true);
                }
            }
            // maybe this property is a subproperty (e.g. Multipoint) then use the parent commandhandler first
            ICommandHandler ch = propertyPage.GetParent(this) as ICommandHandler;

            if (ch != null)
            {
                if (ch.OnCommand(MenuId))
                {
                    return(true);
                }
            }
            switch (MenuId)
            {
            case "MenuId.Point.ModifyWithMouse":
                if (ModifyWithMouse != null)
                {
                    ModifyWithMouse(this, false);
                }
                else if (autoModifyWithMouse)
                {
                    generalGeoPointAction = new GeneralGeoPointAction(this);
                    Frame.SetAction(generalGeoPointAction);
                }
                return(true);

            case "MenuId.Point.IntermediatePoint":
                Frame.SetAction(new ConstructMidPoint(this));
                return(true);

            case "MenuId.Point.ObjectPoint":
                Frame.SetAction(new ConstructObjectPoint(this));
                return(true);

            case "MenuId.Point.IntersectionTwoCurves":
                Frame.SetAction(new ConstructIntersectPoint(this));
                return(true);

            case "MenuId.Point.OffsetByVector":
                Frame.SetAction(new ConstructVectorPoint(this));
                return(true);

            case "MenuId.Point.Polar":
                Frame.SetAction(new ConstructPolarPoint(this));
                return(true);

            case "MenuId.Point.NameVariable":
                Frame.Project.SetNamedValue(null, GetGeoPoint());
                return(true);

            case "MenuId.Point.FormatSettings":
            {
                Frame.ShowPropertyDisplay("Global");
                IPropertyPage  pd = Frame.GetPropertyDisplay("Global");
                IPropertyEntry sp = pd.FindFromHelpLink("Setting.Formatting");
                if (sp != null)
                {
                    pd.OpenSubEntries(sp, true);
                    sp = pd.FindFromHelpLink("Setting.Formatting.Coordinate");
                    if (sp != null)
                    {
                        pd.OpenSubEntries(sp, true);
                        pd.SelectEntry(sp);
                    }
                }
            }
                return(true);

            default:
                return(false);
            }
        }