Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Problems with VB.Net  (Read 20514 times)
Sabine
Newbie
*
Posts: 3


View Profile Email
« on: February 14, 2011, 02:54:07 »

Hi,

as programming language I'm using VB.Net. Usually the C#-libraries can be used with out any problems.

I now wanted to try PureMVC and started porting the EmployeeAdmin-WPF-Demo to VB.Net.
In the ApplicationFacde I have the problem that I cannot access the "m_instance" from the Facade.
I can access "m_controller", "m_model", "m_view" and also "m_staticSyncRoot".

The error-message is "The type of the field 'm_instance' is not supported".

The class so far:

:
Imports PureMVC.Core
Imports PureMVC.Patterns
Imports PureMVC.Interfaces

Public Class ApplicationFacade
    Inherits Facade

#Region "Notification name constants"
    Public Const STARTUP As String = "startup"
#End Region


#Region "Accessors"

    '/// <summary>
    '/// Facade Singleton Factory method.
    '/// </summary>
    Public Shared Function GetInstance() As IFacade
        If m_instance Is Nothing Then
            m_instance = New ApplicationFacade
        End If
    End Function

#End Region

End Class

Why is "m_instance" not accessable?

Regards
Sabine
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: February 14, 2011, 08:10:06 »

Hoping Adam may be able to help with this one...

-=Cliff>
Logged
adamczak
Moderator
Jr. Member
*****
Posts: 10


View Profile Email
« Reply #2 on: February 14, 2011, 06:53:15 »

The code for the instance method in c# looks like this, so you need to do something similar in VB.

:

/// <summary>
/// Facade Singleton Factory method.  This method is thread safe.
/// </summary>
public new static IFacade Instance
{
get
{
if (m_instance == null)
{
lock (m_staticSyncRoot)
{
if (m_instance == null) m_instance = new ApplicationFacade();
}
}

return m_instance;
}
}


I will take a look and see what I can figure out later on tonight....
Logged
Sabine
Newbie
*
Posts: 3


View Profile Email
« Reply #3 on: February 18, 2011, 01:38:19 »

Yes, this is exactly the method I tried to implement in VB.Net.
I just skiped the "lock"-statement.
Logged
adamczak
Moderator
Jr. Member
*****
Posts: 10


View Profile Email
« Reply #4 on: February 18, 2011, 09:42:21 »

I can't find any information on why this might be a problem.  The only thing I can think of is that m_instance is a static (shared) variable.  So maybe you have to access it that way even though you are in a static (shared) method.  Did you try doing something like "Facade.m_instance ="?

That's really the only thing that comes to mind....
Logged
Sabine
Newbie
*
Posts: 3


View Profile Email
« Reply #5 on: February 21, 2011, 07:08:11 »

With "Facade. " I can only access "Facade.m_staticSyncRoot".
Logged
Pages: [1]
Print