Re: Class Library Design Problem
- From: "JerryWEC" <JerryWEC@xxxxxxxxxxxxxxxxx>
- Date: Wed, 29 Nov 2006 09:17:47 -0500
I do have this working somewhat now. I have a singleton for my Logging
Class and I am creating one instance of my LoggingForm in the default
constructor of my Logging Class (Again Singleton designed). I might be able
to move the constructor code to my property...
Public Class Logging
Public Event LogMessageBarClicked()
Public Event LogExitDisplayLoggingWindow()
Public Event LogErrorOccurred(ByVal outEx As Exception) #End Region
Private m_instance As Logging
Private WithEvents m_formInstance As frmLogDisplay
Private m_LogToFile As Boolean
'Default constructor declared to facilitate singleton class model
Public Sub New()
Try
If m_formInstance Is Nothing Then
m_formInstance = New frmLogDisplay()
End If
Catch ex As Exception
'Exception logic here...
End Try
End Sub
Public ReadOnly Property Instance() As Logging
Get
Try
If m_instance Is Nothing Then
SyncLock GetType(Logging)
If m_instance Is Nothing Then
m_instance = New Logging
End If
End SyncLock
End If
Return m_instance
Catch ex As Exception
'EH code here.
End Try
End Get
End Property
..
..
..
'Rest of Class omitted...
End Class
From my LoggingForm I send an event back to my Logging Class with re-raiseit to the calling application. One thing I was trying to eliminate was the
events from the Form to the Logging Class. I have to look at how I was
creating the class objects before. I think I was using one variable for all
three instances so that may have been part of my problem. I'll post if I
have time when I figure out the problem with multiple forms. I don't have
that test code any longer and will have to back track.
Thanks of all your help! JerryM
.
- References:
- Re: Class Library Design Problem
- From: JerryWEC
- Re: Class Library Design Problem
- From: Luke Zhang [MSFT]
- Re: Class Library Design Problem
- Prev by Date: Re: Class Library Design Problem
- Next by Date: UAB - Custom Downloader - UNC
- Previous by thread: Re: Class Library Design Problem
- Next by thread: Re: Class Library Design Problem
- Index(es):
Relevant Pages
|