/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/visualbasic/VS_Snippets_CFX/eventasync/vb/generatedclient.vb
399 строк
21 KB
Andy De George
Move snippets from samples repo to this repo (#17296)
03 мар 2020, 19:23
Не верифицирован
03 мар 2020, 19:23
dbbeda1
Код
Авторство
О чём код?
' Copyright (c) Microsoft Corporation. All rights reserved. '------------------------------------------------------------------------------ ' <auto-generated> ' This code was generated by a tool. ' Runtime Version:2.0.50727.1408 ' ' 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 Namespace Microsoft.ServiceModel.Samples <System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0"), _ System.ServiceModel.ServiceContractAttribute([Namespace]:="http://Microsoft.ServiceModel.Samples", ConfigurationName:="Microsoft.ServiceModel.Samples.ICalculator")> _ Public Interface ICalculator <System.ServiceModel.OperationContractAttribute(Action:="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction:="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")> _ Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double <System.ServiceModel.OperationContractAttribute(AsyncPattern:=true, Action:="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction:="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")> _ Function BeginAdd(ByVal n1 As Double, ByVal n2 As Double, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Function EndAdd(ByVal result As System.IAsyncResult) As Double <System.ServiceModel.OperationContractAttribute(Action:="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction:="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")> _ Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double <System.ServiceModel.OperationContractAttribute(AsyncPattern:=true, Action:="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction:="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")> _ Function BeginSubtract(ByVal n1 As Double, ByVal n2 As Double, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Function EndSubtract(ByVal result As System.IAsyncResult) As Double <System.ServiceModel.OperationContractAttribute(Action:="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction:="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")> _ Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double <System.ServiceModel.OperationContractAttribute(AsyncPattern:=true, Action:="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction:="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")> _ Function BeginMultiply(ByVal n1 As Double, ByVal n2 As Double, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Function EndMultiply(ByVal result As System.IAsyncResult) As Double <System.ServiceModel.OperationContractAttribute(Action:="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction:="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")> _ Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double <System.ServiceModel.OperationContractAttribute(AsyncPattern:=true, Action:="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction:="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")> _ Function BeginDivide(ByVal n1 As Double, ByVal n2 As Double, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Function EndDivide(ByVal result As System.IAsyncResult) As Double End Interface <System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")> _ Public Interface ICalculatorChannel Inherits Microsoft.ServiceModel.Samples.ICalculator, System.ServiceModel.IClientChannel End Interface ' <snippet3> <System.Diagnostics.DebuggerStepThroughAttribute(), _ System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")> _ Partial Public Class AddCompletedEventArgs Inherits System.ComponentModel.AsyncCompletedEventArgs Private results() As Object Public 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 Public ReadOnly Property Result() As Double Get MyBase.RaiseExceptionIfNecessary Return CType(Me.results(0),Double) End Get End Property End Class ' </snippet3> <System.Diagnostics.DebuggerStepThroughAttribute(), _ System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")> _ Partial Public Class SubtractCompletedEventArgs Inherits System.ComponentModel.AsyncCompletedEventArgs Private results() As Object Public 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 Public ReadOnly Property Result() As Double Get MyBase.RaiseExceptionIfNecessary Return CType(Me.results(0),Double) End Get End Property End Class <System.Diagnostics.DebuggerStepThroughAttribute(), _ System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")> _ Partial Public Class MultiplyCompletedEventArgs Inherits System.ComponentModel.AsyncCompletedEventArgs Private results() As Object Public 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 Public ReadOnly Property Result() As Double Get MyBase.RaiseExceptionIfNecessary Return CType(Me.results(0),Double) End Get End Property End Class <System.Diagnostics.DebuggerStepThroughAttribute(), _ System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")> _ Partial Public Class DivideCompletedEventArgs Inherits System.ComponentModel.AsyncCompletedEventArgs Private results() As Object Public 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 Public ReadOnly Property Result() As Double Get MyBase.RaiseExceptionIfNecessary Return CType(Me.results(0),Double) End Get End Property End Class <System.Diagnostics.DebuggerStepThroughAttribute(), _ System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")> _ Partial Public Class CalculatorClient Inherits System.ServiceModel.ClientBase(Of Microsoft.ServiceModel.Samples.ICalculator) Implements Microsoft.ServiceModel.Samples.ICalculator Private onBeginAddDelegate As BeginOperationDelegate Private onEndAddDelegate As EndOperationDelegate Private onAddCompletedDelegate As System.Threading.SendOrPostCallback Private onBeginSubtractDelegate As BeginOperationDelegate Private onEndSubtractDelegate As EndOperationDelegate Private onSubtractCompletedDelegate As System.Threading.SendOrPostCallback Private onBeginMultiplyDelegate As BeginOperationDelegate Private onEndMultiplyDelegate As EndOperationDelegate Private onMultiplyCompletedDelegate As System.Threading.SendOrPostCallback Private onBeginDivideDelegate As BeginOperationDelegate Private onEndDivideDelegate As EndOperationDelegate Private onDivideCompletedDelegate As System.Threading.SendOrPostCallback Public Sub New() MyBase.New End Sub Public Sub New(ByVal endpointConfigurationName As String) MyBase.New(endpointConfigurationName) End Sub Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As String) MyBase.New(endpointConfigurationName, remoteAddress) End Sub Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As System.ServiceModel.EndpointAddress) MyBase.New(endpointConfigurationName, remoteAddress) End Sub Public Sub New(ByVal binding As System.ServiceModel.Channels.Binding, ByVal remoteAddress As System.ServiceModel.EndpointAddress) MyBase.New(binding, remoteAddress) End Sub '<snippet2> Public Event AddCompleted As System.EventHandler(Of AddCompletedEventArgs) '</snippet2> Public Event SubtractCompleted As System.EventHandler(Of SubtractCompletedEventArgs) Public Event MultiplyCompleted As System.EventHandler(Of MultiplyCompletedEventArgs) Public Event DivideCompleted As System.EventHandler(Of DivideCompletedEventArgs) Public Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double Implements Microsoft.ServiceModel.Samples.ICalculator.Add Return MyBase.Channel.Add(n1, n2) End Function <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ Public Function BeginAdd(ByVal n1 As Double, ByVal n2 As Double, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Implements Microsoft.ServiceModel.Samples.ICalculator.BeginAdd Return MyBase.Channel.BeginAdd(n1, n2, callback, asyncState) End Function <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ Public Function EndAdd(ByVal result As System.IAsyncResult) As Double Implements Microsoft.ServiceModel.Samples.ICalculator.EndAdd Return MyBase.Channel.EndAdd(result) End Function Private Function OnBeginAdd(ByVal inValues() As Object, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Dim n1 As Double = CType(inValues(0),Double) Dim n2 As Double = CType(inValues(1),Double) Return Me.BeginAdd(n1, n2, callback, asyncState) End Function Private Function OnEndAdd(ByVal result As System.IAsyncResult) As Object() Dim retVal As Double = Me.EndAdd(result) Return New Object() {retVal} End Function Private Sub OnAddCompleted(ByVal state As Object) Dim handler As System.EventHandler(Of AddCompletedEventArgs) = Me.AddCompletedEvent If (Not (handler) Is Nothing) Then Dim e As InvokeAsyncCompletedEventArgs = CType(state,InvokeAsyncCompletedEventArgs) handler(Me, New AddCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)) End If End Sub ' <snippet1> Public Overloads Sub AddAsync(ByVal n1 As Double, ByVal n2 As Double) Me.AddAsync(n1, n2, Nothing) End Sub Public Overloads Sub AddAsync(ByVal n1 As Double, ByVal n2 As Double, ByVal userState As Object) If (Me.onBeginAddDelegate Is Nothing) Then Me.onBeginAddDelegate = AddressOf Me.OnBeginAdd End If If (Me.onEndAddDelegate Is Nothing) Then Me.onEndAddDelegate = AddressOf Me.OnEndAdd End If If (Me.onAddCompletedDelegate Is Nothing) Then Me.onAddCompletedDelegate = AddressOf Me.OnAddCompleted End If MyBase.InvokeAsync(Me.onBeginAddDelegate, New Object() {n1, n2}, Me.onEndAddDelegate, Me.onAddCompletedDelegate, userState) End Sub ' </snippet1> Public Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double Implements Microsoft.ServiceModel.Samples.ICalculator.Subtract Return MyBase.Channel.Subtract(n1, n2) End Function <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ Public Function BeginSubtract(ByVal n1 As Double, ByVal n2 As Double, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Implements Microsoft.ServiceModel.Samples.ICalculator.BeginSubtract Return MyBase.Channel.BeginSubtract(n1, n2, callback, asyncState) End Function <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ Public Function EndSubtract(ByVal result As System.IAsyncResult) As Double Implements Microsoft.ServiceModel.Samples.ICalculator.EndSubtract Return MyBase.Channel.EndSubtract(result) End Function Private Function OnBeginSubtract(ByVal inValues() As Object, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Dim n1 As Double = CType(inValues(0),Double) Dim n2 As Double = CType(inValues(1),Double) Return Me.BeginSubtract(n1, n2, callback, asyncState) End Function Private Function OnEndSubtract(ByVal result As System.IAsyncResult) As Object() Dim retVal As Double = Me.EndSubtract(result) Return New Object() {retVal} End Function Private Sub OnSubtractCompleted(ByVal state As Object) Dim handler As System.EventHandler(Of SubtractCompletedEventArgs) = Me.SubtractCompletedEvent If (Not (handler) Is Nothing) Then Dim e As InvokeAsyncCompletedEventArgs = CType(state,InvokeAsyncCompletedEventArgs) handler(Me, New SubtractCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)) End If End Sub Public Overloads Sub SubtractAsync(ByVal n1 As Double, ByVal n2 As Double) Me.SubtractAsync(n1, n2, Nothing) End Sub Public Overloads Sub SubtractAsync(ByVal n1 As Double, ByVal n2 As Double, ByVal userState As Object) If (Me.onBeginSubtractDelegate Is Nothing) Then Me.onBeginSubtractDelegate = AddressOf Me.OnBeginSubtract End If If (Me.onEndSubtractDelegate Is Nothing) Then Me.onEndSubtractDelegate = AddressOf Me.OnEndSubtract End If If (Me.onSubtractCompletedDelegate Is Nothing) Then Me.onSubtractCompletedDelegate = AddressOf Me.OnSubtractCompleted End If MyBase.InvokeAsync(Me.onBeginSubtractDelegate, New Object() {n1, n2}, Me.onEndSubtractDelegate, Me.onSubtractCompletedDelegate, userState) End Sub Public Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double Implements Microsoft.ServiceModel.Samples.ICalculator.Multiply Return MyBase.Channel.Multiply(n1, n2) End Function <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ Public Function BeginMultiply(ByVal n1 As Double, ByVal n2 As Double, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Implements Microsoft.ServiceModel.Samples.ICalculator.BeginMultiply Return MyBase.Channel.BeginMultiply(n1, n2, callback, asyncState) End Function <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ Public Function EndMultiply(ByVal result As System.IAsyncResult) As Double Implements Microsoft.ServiceModel.Samples.ICalculator.EndMultiply Return MyBase.Channel.EndMultiply(result) End Function Private Function OnBeginMultiply(ByVal inValues() As Object, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Dim n1 As Double = CType(inValues(0),Double) Dim n2 As Double = CType(inValues(1),Double) Return Me.BeginMultiply(n1, n2, callback, asyncState) End Function Private Function OnEndMultiply(ByVal result As System.IAsyncResult) As Object() Dim retVal As Double = Me.EndMultiply(result) Return New Object() {retVal} End Function Private Sub OnMultiplyCompleted(ByVal state As Object) Dim handler As System.EventHandler(Of MultiplyCompletedEventArgs) = Me.MultiplyCompletedEvent If (Not (handler) Is Nothing) Then Dim e As InvokeAsyncCompletedEventArgs = CType(state,InvokeAsyncCompletedEventArgs) handler(Me, New MultiplyCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)) End If End Sub Public Overloads Sub MultiplyAsync(ByVal n1 As Double, ByVal n2 As Double) Me.MultiplyAsync(n1, n2, Nothing) End Sub Public Overloads Sub MultiplyAsync(ByVal n1 As Double, ByVal n2 As Double, ByVal userState As Object) If (Me.onBeginMultiplyDelegate Is Nothing) Then Me.onBeginMultiplyDelegate = AddressOf Me.OnBeginMultiply End If If (Me.onEndMultiplyDelegate Is Nothing) Then Me.onEndMultiplyDelegate = AddressOf Me.OnEndMultiply End If If (Me.onMultiplyCompletedDelegate Is Nothing) Then Me.onMultiplyCompletedDelegate = AddressOf Me.OnMultiplyCompleted End If MyBase.InvokeAsync(Me.onBeginMultiplyDelegate, New Object() {n1, n2}, Me.onEndMultiplyDelegate, Me.onMultiplyCompletedDelegate, userState) End Sub Public Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double Implements Microsoft.ServiceModel.Samples.ICalculator.Divide Return MyBase.Channel.Divide(n1, n2) End Function <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ Public Function BeginDivide(ByVal n1 As Double, ByVal n2 As Double, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Implements Microsoft.ServiceModel.Samples.ICalculator.BeginDivide Return MyBase.Channel.BeginDivide(n1, n2, callback, asyncState) End Function <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _ Public Function EndDivide(ByVal result As System.IAsyncResult) As Double Implements Microsoft.ServiceModel.Samples.ICalculator.EndDivide Return MyBase.Channel.EndDivide(result) End Function Private Function OnBeginDivide(ByVal inValues() As Object, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Dim n1 As Double = CType(inValues(0),Double) Dim n2 As Double = CType(inValues(1),Double) Return Me.BeginDivide(n1, n2, callback, asyncState) End Function Private Function OnEndDivide(ByVal result As System.IAsyncResult) As Object() Dim retVal As Double = Me.EndDivide(result) Return New Object() {retVal} End Function Private Sub OnDivideCompleted(ByVal state As Object) Dim handler As System.EventHandler(Of DivideCompletedEventArgs) = Me.DivideCompletedEvent If (Not (handler) Is Nothing) Then Dim e As InvokeAsyncCompletedEventArgs = CType(state,InvokeAsyncCompletedEventArgs) handler(Me, New DivideCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)) End If End Sub Public Overloads Sub DivideAsync(ByVal n1 As Double, ByVal n2 As Double) Me.DivideAsync(n1, n2, Nothing) End Sub Public Overloads Sub DivideAsync(ByVal n1 As Double, ByVal n2 As Double, ByVal userState As Object) If (Me.onBeginDivideDelegate Is Nothing) Then Me.onBeginDivideDelegate = AddressOf Me.OnBeginDivide End If If (Me.onEndDivideDelegate Is Nothing) Then Me.onEndDivideDelegate = AddressOf Me.OnEndDivide End If If (Me.onDivideCompletedDelegate Is Nothing) Then Me.onDivideCompletedDelegate = AddressOf Me.OnDivideCompleted End If MyBase.InvokeAsync(Me.onBeginDivideDelegate, New Object() {n1, n2}, Me.onEndDivideDelegate, Me.onDivideCompletedDelegate, userState) End Sub End Class End Namespace