Esempio n. 1
0
 private void OnCommandClick(Commands_e cmd)
 {
     switch (cmd)
     {
     case Commands_e.InsertNote:
         m_App.IActiveDoc2.ClearSelection2(true);
         m_Page = new PropertyManagerPageEx <InsertNotePMPageHandler, NoteData>(
             m_Data ?? (m_Data = new NoteData()), m_App);
         m_Page.Handler.Closing += (r, a) =>
         {
             if (r == swPropertyManagerPageCloseReasons_e.swPropertyManagerPageClose_Okay)
             {
                 if (string.IsNullOrEmpty(m_Data.Text))
                 {
                     a.Cancel       = true;
                     a.ErrorTitle   = "Insert Note Error";
                     a.ErrorMessage = "Please specify the note text";
                 }
             }
         };
         m_Page.Handler.Closed += r =>
         {
             if (r == swPropertyManagerPageCloseReasons_e.swPropertyManagerPageClose_Okay)
             {
                 NoteHelper.InsertNote(m_App.IActiveDoc2 as IDrawingDoc,
                                       m_Data.Text, m_Data.Size, m_Data.Position.X, m_Data.Position.Y,
                                       m_Data.Position.AttachedEntity);
             }
         };
         m_Page.Show();
         break;
     }
 }
Esempio n. 2
0
        public override bool OnConnect()
        {
            AddCommandGroup <Commands_e>(OnButtonClick);

            m_CurBoxData = new BoxData()
            {
                Height = 0.1,
                Length = 0.2,
                Width  = 0.3
            };

            m_CurCylData = new CylinderData()
            {
                Diameter = 0.1,
                Height   = 0.2
            };

            m_BoxPmPage = new PropertyManagerPageEx <PropertyPageHandler, BoxData>(App);
            m_BoxPmPage.Handler.Closing += OnBoxPageClosing;
            m_BoxPmPage.Handler.Closed  += OnBoxPageClosed;

            m_CylPmPage = new PropertyManagerPageEx <PropertyPageHandler, CylinderData>(App);
            m_CylPmPage.Handler.Closing += OnCylPageClosing;
            m_CylPmPage.Handler.Closed  += OnCylPageClosed;

            return(true);
        }
Esempio n. 3
0
 public override bool OnConnect()
 {
     AddCommandGroup <commands_enum>(OnButtonClick);
     mCylPAge = new PropertyManagerPageEx <PropertyPageHandler, CylinderData>(App);
     mCylPAge.Handler.Closing += OnCylPageCloseing;
     mCylPAge.Handler.Closed  += OnCylPageClosed;
     mCylinderData             = new CylinderData()
     {
         Dia    = 0.01,
         Height = 0.01
     };
     return(true);
 }
Esempio n. 4
0
        public bool ConnectToSW(object ThisSW, int cookie)
        {
            m_App     = (ISldWorks)ThisSW;
            m_AddinID = cookie;

            m_App.SetAddinCallbackInfo(0, this, m_AddinID);

            m_Bmp = new BitmapHandler();

            m_CmdMgr = m_App.GetCommandManager(cookie);
            AddCommandMgr();

            m_ActivePage    = new PropertyManagerPageEx <PropertyPageEventsHandler, DataModel>(m_App);
            m_ActiveTabPage = new PropertyManagerPageEx <PropertyPageEventsHandler, TabDataModel>(m_App);

            m_ActivePage.Handler.DataChanged += OnDataChanged;
            m_ActivePage.Handler.Closing     += OnPageClosing;
            m_ActivePage.Handler.Closed      += OnClosed;

            return(true);
        }