Solid Edge Framework Type Library
ISEAssemblyConfigurationChangeEvents Object
Members 
Description
Fires AssemblyConfigurationChange user interface events.
Remarks
This event is fired when an Assembly configuration is changed.
Example
Imports SolidEdgeAssembly
Imports SolidEdgeFramework
Imports System.Text
Imports System.Runtime.InteropServices
Imports System.IO

Module Module1

    ' Event set object
    Friend WithEvents m_ConfigChange As ISEAssemblyConfigurationChangeEvents_Event

    ' flag to ensure correct event handler operation
    Private objApp As Application
    Private objAsmDoc As AssemblyDocument
    Private objFolder As DirectoryInfo
    Private objFileInfo As FileInfo


    Sub Main()
        Try
            Console.WriteLine("Starting Solid Edge")
            ' To start SolidEdge application
            objApp = Activator.CreateInstance(Type.GetTypeFromProgID("SolidEdge.Application"))
            If IsNothing(objApp) Then
                Throw New Exception("Failed to get application object")
            End If
            objApp.Visible = True
            objFolder = GetTrainingFolder()
            objFileInfo = New FileInfo(System.IO.Path.Combine(objFolder.FullName, "carrier.asm"))

            Console.WriteLine("Opening " & objFileInfo.FullName)
            '  To open Assembly Document
            objAsmDoc = objApp.Documents.Open(objFileInfo.FullName)

            m_ConfigChange = DirectCast(objAsmDoc.AssemblyConfigurationChangeEvents, SolidEdgeFramework.ISEAssemblyConfigurationChangeEvents_Event)
            Console.WriteLine("Change assembly configuration to fire ""AssemblyConfigurationChangeEvents""..")
            If IsNothing(m_ConfigChange) Then
                Throw New Exception("Failed to get Assembly Configuration Change Events object")
            End If

        Catch ex As Exception
            Console.WriteLine(ex.Message)
        Finally
            Console.WriteLine("Press any key to exit..")
            Console.ReadKey()
            objApp.Quit()
            objApp = Nothing
            objAsmDoc = Nothing

        End Try
    End Sub

    Sub AssemblyConfigurationChangeEvents_OnBeforeAssemblyConfigurationChange(theDocument As Object, ByRef vecConfigNames As Object, nConfigCount As Integer) Handles m_ConfigChange.OnBeforeAssemblyConfigurationChange

        Dim sb As New StringBuilder()
        Dim szStr As String = ""
        Dim objAsmDocLocal As AssemblyDocument = theDocument
        For Each entry As String In vecConfigNames
            sb.AppendFormat("{0}( {1} , {2} )", "BeforeAssemblyConfigurationChange", objAsmDocLocal.Name, entry.ToString & " ")
            sb.AppendLine()
        Next

        Console.WriteLine(sb.ToString())
    End Sub
    Sub AssemblyConfigurationChangeEvents_OnAfterAssemblyConfigurationChange(theDocument As Object, ByRef vecConfigNames As Object, nConfigCount As Integer) Handles m_ConfigChange.OnAfterAssemblyConfigurationChange

        Dim sb As New StringBuilder()
        Dim szStr As String = ""
        Dim objAsmDocLocal As AssemblyDocument = theDocument
        For Each entry As String In vecConfigNames
            sb.AppendFormat("{0}( {1} , {2} )", "AfterAssemblyConfigurationChange", objAsmDocLocal.Name, entry.ToString & " ")
            sb.AppendLine()
        Next
        Console.WriteLine(sb.ToString())
    End Sub
    Function GetTrainingFolder() As DirectoryInfo
        Dim objInstallData As SEInstallDataLib.SEInstallData = Nothing
        Dim objInstallFolder As DirectoryInfo = Nothing
        Dim objTrainingFolder As DirectoryInfo = Nothing

        Try
            objInstallData = New SEInstallDataLib.SEInstallData
            objInstallFolder = New DirectoryInfo(objInstallData.GetInstalledPath())
            objTrainingFolder = New DirectoryInfo(System.IO.Path.Combine(objInstallFolder.Parent.FullName, "Training"))
        Catch
        Finally
            If Not (objInstallData Is Nothing) Then
                Marshal.FinalReleaseComObject(objInstallData)
                objInstallData = Nothing
            End If
        End Try

        Return objTrainingFolder
    End Function

End Module
'Module Module1

'    Sub Main()

'    End Sub

'End Module
See Also

ISEAssemblyConfigurationChangeEvents Members