protected virtual TControlSw CreateSwControlInPage(IPropertyManagerPage2 page, ControlOptionsAttribute opts, IAttributeSet atts) { if (m_App.IsVersionNewerOrEqual(SwVersion_e.Sw2014, 1)) { return(page.AddControl2(atts.Id, (short)m_Type, atts.Name, (short)opts.Align, (short)opts.Options, atts.Description) as TControlSw); } else { return(page.AddControl(atts.Id, (short)m_Type, atts.Name, (short)opts.Align, (short)opts.Options, atts.Description) as TControlSw); } }
protected virtual TControlSw CreateSwControl(object host, ControlOptionsAttribute opts, IAttributeSet atts) { var legacy = !m_App.IsVersionNewerOrEqual(SwVersion_e.Sw2014, 1); switch (host) { case IPropertyManagerPage2 page: if (!legacy) { return(page.AddControl2(atts.Id, (short)m_Type, atts.Name, (short)opts.Align, (short)opts.Options, atts.Description) as TControlSw); } else { return(page.AddControl(atts.Id, (short)m_Type, atts.Name, (short)opts.Align, (short)opts.Options, atts.Description) as TControlSw); } case IPropertyManagerPageTab tab: if (!legacy) { return(tab.AddControl2(atts.Id, (short)m_Type, atts.Name, (short)opts.Align, (short)opts.Options, atts.Description) as TControlSw); } else { return(tab.AddControl(atts.Id, (short)m_Type, atts.Name, (short)opts.Align, (short)opts.Options, atts.Description) as TControlSw); } case IPropertyManagerPageGroup group: if (!legacy) { return(group.AddControl2(atts.Id, (short)m_Type, atts.Name, (short)opts.Align, (short)opts.Options, atts.Description) as TControlSw); } else { return(group.AddControl(atts.Id, (short)m_Type, atts.Name, (short)opts.Align, (short)opts.Options, atts.Description) as TControlSw); } default: throw new NotSupportedException("Host is not supported"); } }
internal static bool SupportsHighResIcons(this ISldWorks app, HighResIconsScope_e scope) { switch (scope) { case HighResIconsScope_e.CommandManager: return(app.IsVersionNewerOrEqual(SwVersion_e.Sw2016)); case HighResIconsScope_e.TaskPane: return(app.IsVersionNewerOrEqual(SwVersion_e.Sw2017)); case HighResIconsScope_e.MacroFeature: return(app.IsVersionNewerOrEqual(SwVersion_e.Sw2017)); default: //Debug.Assert(false, "Not supported scope"); return(false); } }
internal static bool SupportsHighResIcons(this ISldWorks app, HighResIconsScope_e scope) { //TODO: rewrite this using the IsVersionNewerOrEqual var majorRev = int.Parse(app.RevisionNumber().Split('.')[0]); switch (scope) { case HighResIconsScope_e.CommandManager: return(app.IsVersionNewerOrEqual(SwVersion_e.Sw2016)); case HighResIconsScope_e.TaskPane: return(app.IsVersionNewerOrEqual(SwVersion_e.Sw2017)); case HighResIconsScope_e.MacroFeature: return(app.IsVersionNewerOrEqual(SwVersion_e.Sw2017)); default: //Debug.Assert(false, "Not supported scope"); return(false); } }
private void SetProvider(ISldWorks app, IFeature feature) { if (!string.IsNullOrEmpty(m_Provider)) { if (app.IsVersionNewerOrEqual(SwVersion_e.Sw2016)) { var featData = feature.GetDefinition() as IMacroFeatureData; if (featData.Provider != m_Provider) { featData.Provider = m_Provider; } } } }
internal PropertiesList(ICustomPropertyManager prpsMgr, ISldWorks app) : base(StringComparer.CurrentCultureIgnoreCase) { var prpNames = prpsMgr.GetNames() as string[]; if (prpNames != null) { foreach (var prpName in prpNames) { string val; string resVal; if (app.IsVersionNewerOrEqual(SwVersion_e.Sw2014)) { bool wasRes; prpsMgr.Get5(prpName, true, out val, out resVal, out wasRes); } else { prpsMgr.Get4(prpName, true, out val, out resVal); } Add(prpName, val); } } }