Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
July 28, 2017, 11:56:45 AM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: Problems with VB.Net  (Read 14028 times)
Sabine
Newbie
*
Posts: 3


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

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:

Code:
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: 2870



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

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 PM »

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

Code:

/// <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 AM »

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 AM »

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 AM »

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