Пример #1
0
        protected override PropertyManagerPageGroupBaseEx <THandler> Create(PropertyManagerPagePageEx <THandler> page, IAttributeSet atts)
        {
            const int OPTIONS_NOT_USED = 0;

            var icon = atts.BoundMemberInfo?.TryGetAttribute <IconAttribute>()?.Icon;

            if (icon == null)
            {
                icon = atts.BoundType?.TryGetAttribute <IconAttribute>()?.Icon;
            }

            string iconPath = "";

            if (icon != null)
            {
                iconPath = m_IconsConv.ConvertIcon(new TabIcon(icon), true).First();

                //NOTE: tab icon must be in 256 color bitmap, otherwise it is not displayed
                TryConvertIconTo8bit(iconPath);
            }

            var tab = page.Page.AddTab(atts.Id, atts.Name,
                                       iconPath, OPTIONS_NOT_USED) as SolidWorks.Interop.sldworks.IPropertyManagerPageTab;

            return(new PropertyManagerPageTabEx <THandler>(atts.Id, atts.Tag,
                                                           page.Handler, tab, page.App, page));
        }
        protected override PropertyManagerPageGroupBaseEx <THandler> Create(PropertyManagerPagePageEx <THandler> page, IAttributeSet atts)
        {
            var grp = page.Page.AddGroupBox(atts.Id, atts.Name,
                                            (int)(swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded
                                                  | swAddGroupBoxOptions_e.swGroupBoxOptions_Visible)) as SolidWorks.Interop.sldworks.IPropertyManagerPageGroup;

            return(new PropertyManagerPageGroupEx <THandler>(atts.Id, atts.Tag,
                                                             page.Handler, grp, page.App, page));
        }
        protected override TControl Create(PropertyManagerPagePageEx <THandler> page, IAttributeSet atts)
        {
            var opts = GetControlOptions(atts);

            var swCtrl = CreateSwControlInPage(page.Page, opts, atts) as TControlSw;

            AssignControlAttributes(swCtrl, opts, atts);

            return(CreateControl(swCtrl, atts, page.Handler, opts.Height));
        }
Пример #4
0
        private void DisposeActivePage()
        {
            if (m_ActivePage != null)
            {
                foreach (var ctrl in m_ActivePage.Binding.Bindings.Select(b => b.Control).OfType <IDisposable>())
                {
                    ctrl.Dispose();
                }

                m_ActivePage = null;
            }
        }
Пример #5
0
        /// <inheritdoc/>
        public void Show(TModel model)
        {
            Logger.Log("Opening page");

            const int OPTS_DEFAULT = 0;

            DisposeActivePage();

            m_App.IActiveDoc2.ClearSelection2(true);

            m_ActivePage = m_PmpBuilder.CreatePage(model);
            m_Controls   = m_ActivePage.Binding.Bindings.Select(b => b.Control)
                           .OfType <IPropertyManagerPageControlEx>().ToArray();

            m_ActivePage.Page.Show2(OPTS_DEFAULT);

            //updating control states
            m_ActivePage.Binding.Dependency.UpdateAll();
        }
 protected override void UpdatePageDependenciesState(PropertyManagerPagePageEx <THandler> page)
 {
     //NOTE: skipping the updated before page is shown otherwise control state won't be updated correctly
     //instead updating it with UpdateAll after page is shown
 }
Пример #7
0
 protected override PropertyManagerPageOptionBoxEx Create(PropertyManagerPagePageEx <THandler> page, IAttributeSet atts, ref int idRange)
 {
     idRange = Helper.GetEnumFields(atts.BoundType).Count;
     return(base.Create(page, atts));
 }