Solid Edge Framework Type Library
ApplicationV8AfterDocumentOpenEvent Property
Solid Edge Framework Type Library > Application Object : ApplicationV8AfterDocumentOpenEvent Property
Description
Returns the ApplicationV8DocumentOpenEvent object for the referenced Application object.
Property type
Read-only property
Syntax
Visual Basic
Public Property ApplicationV8AfterDocumentOpenEvent As ApplicationV8DocumentOpenEvent
Example
Imports System
Imports System.Runtime.InteropServices
Imports System.Windows.Forms

Namespace Examples
    Partial Public Class Form1
        Inherits Form

        Private _application As SolidEdgeFramework.Application
        Private _applicationEvents As SolidEdgeFramework.ISEApplicationV8AfterDocumentOpenEvent_Event

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
            ' Connect to a running instance of Solid Edge.
            _application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)

            ' Connect to application events using delegate event model.
            _applicationEvents = CType(_application.ApplicationV8AfterDocumentOpenEvent, SolidEdgeFramework.ISEApplicationV8AfterDocumentOpenEvent_Event)

            ' Attach to specific events.
            AddHandler _applicationEvents.AfterDocumentOpen, AddressOf _applicationEvents_AfterDocumentOpen
        End Sub

        Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
            If _applicationEvents IsNot Nothing Then
                ' Dettach from specific events.
                RemoveHandler _applicationEvents.AfterDocumentOpen, AddressOf _applicationEvents_AfterDocumentOpen
            End If

            _applicationEvents = Nothing
            _application = Nothing
        End Sub

        Private Sub _applicationEvents_AfterDocumentOpen(ByVal theDocument As Object)
            ' Handle AfterDocumentSave.
        End Sub
    End Class
End Namespace
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace Examples
{
    public partial class Form1 : Form
    {
        private SolidEdgeFramework.Application _application;
        private SolidEdgeFramework.ISEApplicationV8AfterDocumentOpenEvent_Event _applicationEvents;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // Connect to a running instance of Solid Edge.
            _application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

            // Connect to application events using delegate event model.
            _applicationEvents = (SolidEdgeFramework.ISEApplicationV8AfterDocumentOpenEvent_Event)_application.ApplicationV8AfterDocumentOpenEvent;

            // Attach to specific events.
            _applicationEvents.AfterDocumentOpen += _applicationEvents_AfterDocumentOpen;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_applicationEvents != null)
            {
                // Dettach from specific events.
                _applicationEvents.AfterDocumentOpen -= _applicationEvents_AfterDocumentOpen;
            }

            _applicationEvents = null;
            _application = null;
        }

        private void _applicationEvents_AfterDocumentOpen(object theDocument)
        {
            // Handle AfterDocumentSave.
        }
    }
}
See Also

Application Object  | Application Members