J
John
Hi
Could someone give me pointers on how to change this code (belwo) into a
simple class?
Thanks
Regards
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
<Assembly: AssemblyKeyFile("C:\EventHelper.snk")>
Namespace IV.EventHelper
Public Interface IEventHelper
Event WordDocSaved(ByRef Doc As Object)
Event WordDocPrinted(ByRef Doc As Object)
Function Instance() As IEventHelper
Sub RaiseWordDocSaved(ByRef Doc As Object)
Sub RaiseWordDocPrinted(ByRef Doc As Object)
End Interface
<ClassInterface(ClassInterfaceType.None)> _
Public Class EventHelper
Implements IEventHelper
Public Event WordDocSaved(ByRef Doc As Object) Implements
IEventHelper.WordDocSaved
Public Event WordDocPrinted(ByRef Doc As Object) Implements
IEventHelper.WordDocPrinted
Private Shared _Instance As EventHelper
Public Function Instance() As IEventHelper Implements IEventHelper.Instance
If (_Instance Is Nothing) Then
SyncLock GetType(EventHelper)
If (_Instance Is Nothing) Then
_Instance = New EventHelper
End If
End SyncLock
End If
Return _Instance
End Function
Public Sub RaiseWordDocSaved(ByRef Doc As Object) Implements
IEventHelper.RaiseWordDocSaved
RaiseEvent WordDocSaved(Doc)
End Sub
Public Sub RaiseWordDocPrinted(ByRef Doc As Object) Implements
IEventHelper.RaiseWordDocPrinted
RaiseEvent WordDocPrinted(Doc)
End Sub
End Class
End Namespace
Could someone give me pointers on how to change this code (belwo) into a
simple class?
Thanks
Regards
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
<Assembly: AssemblyKeyFile("C:\EventHelper.snk")>
Namespace IV.EventHelper
Public Interface IEventHelper
Event WordDocSaved(ByRef Doc As Object)
Event WordDocPrinted(ByRef Doc As Object)
Function Instance() As IEventHelper
Sub RaiseWordDocSaved(ByRef Doc As Object)
Sub RaiseWordDocPrinted(ByRef Doc As Object)
End Interface
<ClassInterface(ClassInterfaceType.None)> _
Public Class EventHelper
Implements IEventHelper
Public Event WordDocSaved(ByRef Doc As Object) Implements
IEventHelper.WordDocSaved
Public Event WordDocPrinted(ByRef Doc As Object) Implements
IEventHelper.WordDocPrinted
Private Shared _Instance As EventHelper
Public Function Instance() As IEventHelper Implements IEventHelper.Instance
If (_Instance Is Nothing) Then
SyncLock GetType(EventHelper)
If (_Instance Is Nothing) Then
_Instance = New EventHelper
End If
End SyncLock
End If
Return _Instance
End Function
Public Sub RaiseWordDocSaved(ByRef Doc As Object) Implements
IEventHelper.RaiseWordDocSaved
RaiseEvent WordDocSaved(Doc)
End Sub
Public Sub RaiseWordDocPrinted(ByRef Doc As Object) Implements
IEventHelper.RaiseWordDocPrinted
RaiseEvent WordDocPrinted(Doc)
End Sub
End Class
End Namespace