Application Events

 

Dear All,

I'dd like to change a label on a form when the Solid Edge environment changes to "Draft".  What's the right way to implement the Application Event shown below?

 

 

PrivateSub objAppEvents_AfterEnvironmentActivate(ByVal theEnvironment AsObject) Handles objAppEvents.AfterEnvironmentActivate

 

Label1.Text =

"Draft"

Thanks for your help

Louis

 

Posted by: henk bergh
Post date: 1/18/2009 10:28:51 PM

3 REPLIES

RE: Application Events

Louis, there is an interface called SolidEdgeFramework.Environment that you can cast "theEnvironment" to. From there, you can get the name. I would provide an example but you didn't not specify your programming language.

 

Posted by: Jason Newell
Post date: 1/19/2009 3:41:16 AM

RE: Application Events

Jason, I'm programing with VB.NET. An example would help me very much.

 

Thanks for your help

 

Louis

 

 

Posted by: henk bergh
Post date: 1/23/2009 12:56:15 AM

RE: Application Events

 

Something like:Imports System.Runtime.InteropServicesPublic Class Form1 Private objApplication As SolidEdgeFramework.Application Private WithEvents objAppEvents As SolidEdgeFramework.ISEApplicationEvents_Event Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load objApplication = Marshal.GetActiveObject("SolidEdge.Application") objAppEvents = objApplication.ApplicationEvents End Sub Private Sub objAppEvents_AfterEnvironmentActivate(ByVal theEnvironment As Object) Handles objAppEvents.AfterEnvironmentActivate Dim objEnvironment As SolidEdgeFramework.Environment objEnvironment = theEnvironment If objEnvironment.Name.Equals("Detail") Then ' It's the Draft environment End If Marshal.ReleaseComObject(objEnvironment) End SubEnd Class

 

Posted by: Jason Newell
Post date: 1/25/2009 8:00:12 PM