Inheritance: IPropertyManagerPage2Handler9
示例#1
0
        /// <summary>
        /// Creates a new SolidWorks property manager page, adds controls, and shows the page.
        /// </summary>
        public virtual void Show()
        {
            var options = _OptionsE.Aggregate(0, (acc, v) => (int)v | acc);
            var errors  = 0;

            _PropertyManagerPage2Handler9Wrapper = new PropertyManagerPage2Handler9Wrapper(this);
            var propertyManagerPage = SwApp.CreatePropertyManagerPage(_Name, options,
                                                                      _PropertyManagerPage2Handler9Wrapper, ref errors);

            if (errors != (int)swPropertyManagerPageStatus_e.swPropertyManagerPage_Okay)
            {
                throw new Exception("Unable to Create PMP");
            }
            Page = (IPropertyManagerPage2)propertyManagerPage;

            var selectionMgr = (ISelectionMgr)ModelDoc.SelectionManager;

            _Deselect = selectionMgr.DeselectAllUndoable();
            AddControls();

            Page.Show();

            // Force validation of the page
            ValidationSubject.OnNext(Unit.Default);

            var d = this.WhenAnyValue(p => p.IsValid)
                    .Subscribe(isValid => Page.EnableButton((int)swPropertyManagerPageButtons_e.swPropertyManagerPageButton_Ok, isValid));

            DisposeOnClose(d);

            AddSelections();

            _ShowSubject.OnNext(Unit.Default);
        }
        /// <summary>
        /// Creates a new SolidWorks property manager page, adds controls, and shows the page.
        /// </summary>
        public virtual void Show()
        {
            using (Disposable.Create(() => _ShowSubject.OnNext(Unit.Default)))
            {
                if (Page != null)
                {
                    Page.Show();
                    return;
                }

                var options = _OptionsE.Aggregate(0, (acc, v) => (int)v | acc);
                var errors  = 0;
                _PropertyManagerPage2Handler9Wrapper = new PropertyManagerPage2Handler9Wrapper(this);
                var propertyManagerPage = SwApp.CreatePropertyManagerPage(_Name, options,
                                                                          _PropertyManagerPage2Handler9Wrapper, ref errors);

                Page = (IPropertyManagerPage2)propertyManagerPage;
                if (errors != (int)swPropertyManagerPageStatus_e.swPropertyManagerPage_Okay)
                {
                    throw new Exception("Unable to Create PMP");
                }
                var selectionMgr = (ISelectionMgr)ModelDoc.SelectionManager;
                _Deselect = selectionMgr.DeselectAllUndoable();
                AddControls();

                Page.Show();

                AddSelections();
            }
        }