'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:2.0.50727.26
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

'
'This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.26.
'
Namespace localhost
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.26"),  _
     System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.ComponentModel.DesignerCategoryAttribute("code"),  _
     System.Web.Services.WebServiceBindingAttribute(Name:="PostalWebServiceSoap", [Namespace]:="http://mycompany.com/post")>  _
    Partial Public Class PostalWebService
        Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
        
        Private GetPackageInfoOperationCompleted As System.Threading.SendOrPostCallback
        
        Private useDefaultCredentialsSetExplicitly As Boolean
        
        '''<remarks/>
        Public Sub New()
            MyBase.New
            Me.Url = Global.PostalClient.My.MySettings.Default.PostalClient_localhost_PostalWebService
            If (Me.IsLocalFileSystemWebService(Me.Url) = true) Then
                Me.UseDefaultCredentials = true
                Me.useDefaultCredentialsSetExplicitly = false
            Else
                Me.useDefaultCredentialsSetExplicitly = true
            End If
        End Sub
        
        Public Shadows Property Url() As String
            Get
                Return MyBase.Url
            End Get
            Set
                If (((Me.IsLocalFileSystemWebService(MyBase.Url) = true)  _
                            AndAlso (Me.useDefaultCredentialsSetExplicitly = false))  _
                            AndAlso (Me.IsLocalFileSystemWebService(value) = false)) Then
                    MyBase.UseDefaultCredentials = false
                End If
                MyBase.Url = value
            End Set
        End Property
        
        Public Shadows Property UseDefaultCredentials() As Boolean
            Get
                Return MyBase.UseDefaultCredentials
            End Get
            Set
                MyBase.UseDefaultCredentials = value
                Me.useDefaultCredentialsSetExplicitly = true
            End Set
        End Property
        
        '''<remarks/>
        Public Event GetPackageInfoCompleted As GetPackageInfoCompletedEventHandler
        
        '''<remarks/>
        <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://mycompany.com/post/GetPackageInfo", RequestNamespace:="http://mycompany.com/post", ResponseNamespace:="http://mycompany.com/post", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>  _
        Public Function GetPackageInfo(ByVal TrackID As String) As ClientPackageInfo
            Dim results() As Object = Me.Invoke("GetPackageInfo", New Object() {TrackID})
            Return CType(results(0),ClientPackageInfo)
        End Function
        
        '''<remarks/>
        Public Overloads Sub GetPackageInfoAsync(ByVal TrackID As String)
            Me.GetPackageInfoAsync(TrackID, Nothing)
        End Sub
        
        '''<remarks/>
        Public Overloads Sub GetPackageInfoAsync(ByVal TrackID As String, ByVal userState As Object)
            If (Me.GetPackageInfoOperationCompleted Is Nothing) Then
                Me.GetPackageInfoOperationCompleted = AddressOf Me.OnGetPackageInfoOperationCompleted
            End If
            Me.InvokeAsync("GetPackageInfo", New Object() {TrackID}, Me.GetPackageInfoOperationCompleted, userState)
        End Sub
        
        Private Sub OnGetPackageInfoOperationCompleted(ByVal arg As Object)
            If (Not (Me.GetPackageInfoCompletedEvent) Is Nothing) Then
                Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg,System.Web.Services.Protocols.InvokeCompletedEventArgs)
                RaiseEvent GetPackageInfoCompleted(Me, New GetPackageInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState))
            End If
        End Sub
        
        '''<remarks/>
        Public Shadows Sub CancelAsync(ByVal userState As Object)
            MyBase.CancelAsync(userState)
        End Sub
        
        Private Function IsLocalFileSystemWebService(ByVal url As String) As Boolean
            If ((url Is Nothing)  _
                        OrElse (url Is String.Empty)) Then
                Return false
            End If
            Dim wsUri As System.Uri = New System.Uri(url)
            If ((wsUri.Port >= 1024)  _
                        AndAlso (String.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) = 0)) Then
                Return true
            End If
            Return false
        End Function
    End Class
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.26"),  _
     System.SerializableAttribute(),  _
     System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.ComponentModel.DesignerCategoryAttribute("code"),  _
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://mycompany.com/post")>  _
    Partial Public Class ClientPackageInfo
        
        Private packageIDField As String
        
        Private deliveryDateField As Date
        
        '''<remarks/>
        Public Property PackageID() As String
            Get
                Return Me.packageIDField
            End Get
            Set
                Me.packageIDField = value
            End Set
        End Property
        
        '''<remarks/>
        Public Property DeliveryDate() As Date
            Get
                Return Me.deliveryDateField
            End Get
            Set
                Me.deliveryDateField = value
            End Set
        End Property
    End Class
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.26")>  _
    Public Delegate Sub GetPackageInfoCompletedEventHandler(ByVal sender As Object, ByVal e As GetPackageInfoCompletedEventArgs)
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.26"),  _
     System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.ComponentModel.DesignerCategoryAttribute("code")>  _
    Partial Public Class GetPackageInfoCompletedEventArgs
        Inherits System.ComponentModel.AsyncCompletedEventArgs
        
        Private results() As Object
        
        Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object)
            MyBase.New(exception, cancelled, userState)
            Me.results = results
        End Sub
        
        '''<remarks/>
        Public ReadOnly Property Result() As ClientPackageInfo
            Get
                Me.RaiseExceptionIfNecessary
                Return CType(Me.results(0),ClientPackageInfo)
            End Get
        End Property
    End Class
End Namespace
