My problem is a part of a large application.I can't show all but this is my actual trouble.
Basicly I have 2 part:
-The server(proyect call Planes) with 2 base clases a connector and the real server.
The connector is made for multiuser...it mean that when you instance a GestorPlanesConnector, only one intance of GestorPlanes is create for all users.
-The clients:It have a reference of Planes and "I'am trying" to caught the events throw by the server(GestorPlanes across the connector)
Can SomeBody watch my problem solution???
here is the code: (if you need something else please mail me to [email protected]) thank you
' Class GestorPlanesConnector
Option Explicit
Public Event UpdatedPlan(vPlan As Object)
Public WithEvents MIGP As GestorPlanes
Public Property Get m_GestorPlanes() As GestorPlanes
Set m_GestorPlanes = GP
End Property
Private Sub Class_Initialize()
If GP Is Nothing Then
Set GP = New GestorPlanes
Set MIGP = GP
End If
l_UseCount = l_UseCount + 1
End Sub
Private Sub Class_Terminate()
l_UseCount = l_UseCount - 1
If l_UseCount = 0 Then
Set GP = Nothing
End If
End Sub
Private Sub MIGP_UpdatedPlan(vPlan As Object)
RaiseEvent UpdatedPlan(vPlan)
End Sub
-----------------------------
' Class GestorPlanes

Option Explicit
Event UpdatedPlan(vPlan As Object)
Public ListaPlanes As SortedList
Public Sub Class_Initialize()
Set ListaPlanes = New SortedList
ListaPlanes.SortMode = srtText
End Sub
Public Sub CargaPlanes(strConfig As String)
Dim fs As Object
Dim ts As Object
Dim vEQ As Object
Dim tokens() As String
Dim ConfigOK As Boolean
Dim ind As Integer

ind = 0
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(strConfig) = False Then Exit Sub
Set ts = fs.OpenTextFile(strConfig, 1)
While Not ts.AtEndOfStream
strConfig = ts.ReadLine
If Left(strConfig, 2) = "//" Then
'LogEvent strConfig
Else
ind = ind + 1
Set vEQ = Nothing
tokens = Split(strConfig, ";")
If UBound(tokens) >= 3 Then
Set vEQ = New SRVPlan
If Not vEQ Is Nothing Then
If vEQ.Configure(strConfig, ind) Then
AddPlan vEQ
End If
End If
End If
End If
Wend
Set vEQ = Nothing
ts.Close
Set ts = Nothing
Set fs = Nothing

End Sub
Public Function AddPlan(QPlan As Object) As Boolean
Dim Clave As String
Clave = QPlan.str_NombrePlan
ListaPlanes.Add Clave, QPlan
AddPlan = True
End Function
Public Function FindPlan(vNombre As String) As Object
Dim vPlan As Object
If ListaPlanes.Exists(vNombre) Then
Set vPlan = ListaPlanes.Item(vNombre)
Else
Set vPlan = Nothing
End If
Set FindPlan = vPlan
End Function
Public Function GetValorEstado(vNombre As String, vUser As String) As Variant
GetValorEstado = Empty
If ListaPlanes.Exists(vNombre) Then
GetValorEstado = ListaPlanes(vNombre).GetEstadoActual
End If
End Function
Public Sub SetValorEstado(vNombre As String, vValor As Variant)
If ListaPlanes.Exists(vNombre) Then
ListaPlanes(vNombre).SetEstadoActual vValor
End If
End Sub
Public Sub NotifyPlanChange(QNombre As String, QEstado As String, Q_Descripcion As String)
RaiseEvent UpdatedPlan(FindPlan(QNombre))
End Sub
--------------------------
CLIENT
' Class Plan

Public str_NombrePlan As String
Public str_NombreUsuario As String
Public str_Estado As String
Public str_Descripcion As String
Public d_QFila As Integer
Public WithEvents TrataPlanes As GestorPlanesConnector
Public Sub Class_Initialize()
Set TrataPlanes = New GestorPlanesConnector
Set GestorPlanes = TrataPlanes.m_GestorPlanes
End Sub
Public Function Configure(strConfig As String, fila As Integer) As Boolean
Dim tokens() As String
tokens = Split(strConfig, ";")
If UBound(tokens) <> 3 Then
Configure = False
Exit Function
End If
str_NombrePlan = tokens(0)
str_NombreUsuario = tokens(1)
str_Estado = tokens(2)
str_Descripcion = tokens(3)
d_QFila = fila
Configure = True
End Function

Public Sub SetFila(vValor As Variant)
d_QFila = vValor
End Sub
Public Function GetFila() As String
GetFila = d_QFila
End Function
Public Sub SetEstadoActual(vValor As Variant)
str_Estado = vValor
End Sub
Public Function GetEstadoActual() As Boolean
GetEstadoActual = str_Estado
End Function
Public Sub SetDescripcion(vValor As Variant)
str_Descripcion = vValor
End Sub
Public Function GetDescripcion() As Boolean
GetDescripcion = str_Estado
End Function

Public Sub StatusChanged()
FormClientePlanes.Estados.Row = d_QFila
FormClientePlanes.Estados.Col = 1
FormClientePlanes.Estados.Text = str_NombrePlan
FormClientePlanes.Estados.Col = 2
FormClientePlanes.Estados.Text = str_NombreUsuario
FormClientePlanes.Estados.Col = 3
FormClientePlanes.Estados.Text = str_Estado
FormClientePlanes.Estados.Col = 4
FormClientePlanes.Estados.Text = str_Descripcion
FormClientePlanes.Refresh
End Sub

Private Sub TrataPlanes_UpdatedPlan(vPlan As Object)
If vPlan.str_NombrePlan = str_NombrePlan Then
str_Descripcion = vPlan.str_Descripcion
str_Estado = vPlan.str_Estado
SetEstadoActual (vPlan.str_Estado)
StatusChanged
End If
End Sub