Наследование: System.Windows.Forms.Form
Пример #1
0
 private void LinkComponent(CyPhyML.Component component, MgaFCO selectedCADModel)
 {
     try
     {
         bool createNewComponent = false;
         CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode creoMode = CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_EMPTY;
         var createOrEdit = new CreateOrEditComponent();
         createOrEdit.btnCreateNewComponent.Click += (o, e) =>
         {
             createNewComponent        = true;
             creoMode                  = CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_COMPONENT;
             createOrEdit.DialogResult = DialogResult.OK;
             createOrEdit.Close();
         };
         createOrEdit.btnEditExistingComponent.Click += (o, e) =>
         {
             createNewComponent        = false;
             creoMode                  = CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_COMPONENT;
             createOrEdit.DialogResult = DialogResult.OK;
             createOrEdit.Close();
         };
         createOrEdit.btnEmptyCreoOpen.Click += (o, e) =>
         {
             createNewComponent        = false;
             creoMode                  = CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_EMPTY;
             createOrEdit.DialogResult = DialogResult.OK;
             createOrEdit.Close();
         };
         DialogResult result = createOrEdit.ShowDialog(new NativeWindowWrapper(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle));
         if (result != DialogResult.Cancel)
         {
             if (creoMode == CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_COMPONENT)
             {
                 metalinkAddon.StartEditingComponent(component, selectedCADModel, createNewComponent);
             }
             else
             {
                 metalinkAddon.StartCreoEmpyMode();
             }
         }
     }
     catch (IOException e) // e.g. manifest.project.json not found
     {
         GMEConsole.Error.WriteLine(e.ToString());
     }
     return;
 }
 private void LinkComponent(CyPhyML.Component component, MgaFCO selectedCADModel)
 {
     try
     {
         bool createNewComponent = false;
         CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode creoMode = CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_EMPTY;
         var createOrEdit = new CreateOrEditComponent();
         createOrEdit.btnCreateNewComponent.Click += (o, e) =>
             {
                 createNewComponent = true;
                 creoMode = CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_COMPONENT;
                 createOrEdit.DialogResult = DialogResult.OK;
                 createOrEdit.Close();
             };
         createOrEdit.btnEditExistingComponent.Click += (o, e) =>
             {
                 createNewComponent = false;
                 creoMode = CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_COMPONENT;
                 createOrEdit.DialogResult = DialogResult.OK;
                 createOrEdit.Close();
             };
         createOrEdit.btnEmptyCreoOpen.Click += (o, e) =>
         {
             createNewComponent = false;
             creoMode = CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_EMPTY;
             createOrEdit.DialogResult = DialogResult.OK;
             createOrEdit.Close();
         };
         DialogResult result = createOrEdit.ShowDialog();
         if (result != DialogResult.Cancel)
         {
             if (creoMode == CyPhyMetaLink.CyPhyMetaLinkAddon.CreoOpenMode.OPEN_COMPONENT)
             {
                 propagateAddon.StartEditingComponent(component, selectedCADModel, createNewComponent);
             }
             else
             {
                 propagateAddon.StartCreoEmpyMode();
             }
         }
     }
     catch (IOException e) // e.g. manifest.project.json not found
     {
         GMEConsole.Error.WriteLine(e.ToString());
     }
     return;
 }