bool ISelectionCustomFilter.Filter(IPropertyManagerPageControlEx selBox, object selection,
                                    swSelectType_e selType, ref string itemText)
 {
     if (selection is TSelection)
     {
         return(Filter(selBox, (TSelection)selection, selType, ref itemText));
     }
     else
     {
         throw new InvalidCastException($"Selection type of {selBox.Id} doesn't match the '{typeof(TSelection)}' type");
     }
 }
示例#2
0
        protected override bool Filter(IPropertyManagerPageControlEx selBox, IEntity selection, swSelectType_e selType,
                                       ref string itemText)
        {
            if (selType == swSelectType_e.swSelFACES)
            {
                var face = selection as IFace2;

                if (!face.IGetSurface().IsPlane())
                {
                    return(false);
                }
            }

            return(true);
        }
示例#3
0
            protected override void UpdateControlState(IPropertyManagerPageControlEx control, IPropertyManagerPageControlEx[] parents)
            {
                if (parents != null && parents.Length == 1 &&
                    RoundStepControls_e.UseCustomStep.Equals(parents.First().Tag))
                {
                    var useCustom = (bool)parents.First().GetValue();

                    switch ((RoundStepControls_e)control.Tag)
                    {
                    case RoundStepControls_e.CustomStep:
                        control.Enabled = useCustom;
                        break;

                    case RoundStepControls_e.StockStep:
                        control.Enabled = !useCustom;
                        break;
                    }
                }
                else
                {
                    Debug.Assert(false, "Invalid dependency. This handler should only be applied to rounding step controls");
                }
            }
示例#4
0
    protected override void UpdateControlState(IPropertyManagerPageControlEx control, IPropertyManagerPageControlEx[] parents)
    {
        var curGrp = (Groups_e)parents.First().GetValue();

        control.Visible = (Groups_e)control.Tag == curGrp;
    }
 protected override void UpdateControlState(IPropertyManagerPageControlEx control, IPropertyManagerPageControlEx[] parents)
 {
     control.Enabled = (bool)parents.First().GetValue();
 }
 protected override bool Filter(IPropertyManagerPageControlEx selBox, IFace2 selection, swSelectType_e selType, ref string itemText)
 {
     itemText = "Planar Face";
     return(selection.IGetSurface().IsPlane()); //validating the selection and only allowing planar face
 }
 ///<inheritdoc cref="Filter(TSelection)"/> />
 /// <param name="selBox">Pointer to the selection box control</param>
 /// <param name="selType">Type of the selecting object as defined in <see href="http://help.solidworks.com/2014/english/api/swconst/solidworks.interop.swconst~solidworks.interop.swconst.swselecttype_e.html">swSelectType_e Enumeration</see></param>
 /// <param name="itemText">Text to be displayed in the selection box</param>
 protected virtual bool Filter(IPropertyManagerPageControlEx selBox, TSelection selection,
                               swSelectType_e selType, ref string itemText)
 {
     return(Filter(selection));
 }
示例#8
0
 protected override void UpdateControlState(IPropertyManagerPageControlEx control,
                                            IPropertyManagerPageControlEx[] parents)
 {
     control.Enabled = !parents.Any(p => !((bool)p.GetValue()));
 }
 protected override bool Filter(IPropertyManagerPageControlEx selBox, IFace2 selection, swSelectType_e selType, ref string itemText)
 {
     return(selection.IsSheetBody());
 }
示例#10
0
 protected virtual void UpdateControlState(IPropertyManagerPageControlEx control,
                                           IPropertyManagerPageControlEx[] parents)
 {
 }