Reply

Help me in how to implement AfterDocumentOpen Event in C#

[ Edited ]

Hi,

 Can anyone help me how to implement the event "AfterDocumentOpen" in C# . please provide me full code please.

My actual requirement is to convert solidedge files to *.PDF , the problem is before the SE file completely opens, my saveas command is executing. So before completely opening the file pdf is created. So i need to give some time to SolidEdge so that it will completely opens the SE files which i am not able to do so. So i thought implement the "AfterDocumentOpen" event resolve my issue.

 

 

Thanks in advance

Regards

Venkata Ramesh V

 

Posted by: Venkata Ramesh Virodhula
Post date: 7/1/2011 2:42:18 AM

3 REPLIES

RE: Help me in how to implement AfterDocumentOpen Event in C#

[ Edited ]

You might want to note the afterdocumentopen event and then wait until the beforecommandrun event is fired with the command ID being the select tool. When the select tool starts up (or is ready to), the document should be completely ready for prime time. Events in C# are pretty much the same as for VB.

 

Posted by: R.D. Holland
Post date: 7/27/2011 5:00:55 AM

RE: Help me in how to implement AfterDocumentOpen Event in C#

[ Edited ]

Example:

 

public partial class Form1 : Form

{

private SolidEdgeFramework.Application application;

private SolidEdgeFramework.DISEApplicationEvents_Event appEvents;

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

try

{

// Connect to a running instance of Solid Edge

application = (SolidEdgeFramework.Application)

Marshal.GetActiveObject("SolidEdge.Application");

// Get a reference to the application events

appEvents = application.ApplicationEvents;

// Example for AfterDocumentOpen

appEvents.AfterDocumentOpen += new

SolidEdgeFramework.DISEApplicationEvents_AfterDocumentOpenEventHandler(appEvents_AfterDocumentOpen);

}

catch (System.Exception ex)

{

Console.WriteLine(ex.Message);

Console.WriteLine(ex.StackTrace);

}

}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)

{

if (appEvents != null)

{

Marshal.FinalReleaseComObject(appEvents);

appEvents = null;

}

if (application != null)

{

Marshal.FinalReleaseComObject(application);

application = null;

}

}

void appEvents_AfterDocumentOpen(object theDocument)

{

// ......

//......

}

}

 

}

 

Best Regards

JR

 

Posted by: JR
Post date: 7/28/2011 2:36:40 AM

RE: Help me in how to implement AfterDocumentOpen Event in C#

[ Edited ]

Thanks Holland for the info., and thanks JR for the complete code

 

Regards

Venkata Ramesh V

 

Posted by: Venkata Ramesh Virodhula
Post date: 7/28/2011 7:09:25 PM