VB Patch for Dynamic Token Service Binding (Virtual Earth)

Feb 26, 2009 at 6:15 PM
Hi

Is it possible to create a VB version of the below patch, i have tried to convert the files but i have not been successful ( can't read C# to save my life )

Regards,

Richard C

ps. Great Job with the Deep Earth Control works a dream !


Source Code Patch for Dynamic Token Service Binding (Virtual Earth)
Developer
Feb 27, 2009 at 12:04 AM
I just manually conveted it, so I have not tested it in a project (because I don't have a VB version of DeepEarth to test it in)

Dynamic Token Service Binding Class (Class added to the "DeepEarth.Provider.VirtualEarth" project converted to VB)

Imports System
Imports System.ServiceModel
Imports System.Windows
 
Namespace DeepEarth.Provider.VirtualEarth
 
    Public Class DynamicTokenServiceBinding
        Dim serviceUrl = New Uri(Application.Current.Host.Source, "../Services/VETokenService.svc")
 
        Dim _Binding = New BasicHttpBinding()
        _Binding.Security.Mode = BasicHttpSecurityMode.None
        _Binding.MaxReceivedMessageSize = 2147483647
        _Binding.MaxBufferSize = 2147483647
 
        Dim _EndPoint = New EndpointAddress(serviceUrl)
 
        Token.SetBinding(_Binding, _EndPoint)
    End Class
 
End Namespace

DeepEarth.Provider.VirtualEarth.Token Class (added bits of code converted to VB)

    ' Patch code for "Dynamic Token Service Binding"
    Private _binding As BasicHttpBinding
    Public Property _Binding() As BasicHttpBinding
        Get
            Return _binding
        End Get
        Set(ByVal value As BasicHttpBinding)
            _binding = value
        End Set
    End Property
 
    ' Patch code for "Dynamic Token Service Binding"
    Private _endPoint As EndpointAddress
    Public Property _EndPoint() As EndpointAddress
        Get
            Return _EndPoint
        End Get
        Set(ByVal value As EndpointAddress)
            _endPoint = value
        End Set
    End Property
 
    ' Patch code for "Dynamic Token Service Binding"
    Sub New()
        New DynamicTokenServiceBinding();
    End Sub
 
 
    ' Patch code for "Dynamic Token Service Binding"
    Public Shared Sub SetBinding(ByVal binding As BasicHttpBinding, ByVal endPoint As EndpointAddress)
        _binding = binding
        _endPoint = endPoint
    End Sub
Developer
Feb 27, 2009 at 12:36 PM
Edited Feb 27, 2009 at 12:41 PM
DeepEarth.Provider.VirtualEarth.Token Class (added bits of code converted to VB)

I forgot to also include this line in the DeepEarth.Provider.VirtualEarth.Token Class, sorry :(

   70                 //get token
   71                 Dim tokenservice = new TokenServiceClient(_Binding, _EndPoint)

Which is an update for this line to set/create the service client with the binding from this 

   30                 //get token
   31                 Dim tokenservice = new TokenServiceClient()


Coordinator
Feb 27, 2009 at 5:32 PM
Nice work Noob.  Expecially like the line numbers.  Very C64 of you.
Developer
Feb 27, 2009 at 10:44 PM
I made a new patch, just C#.Net

http://deepearth.codeplex.com/SourceControl/PatchList.aspx