1 ' Copyright (c) Microsoft Corporation. All rights reserved.
5 Namespace Microsoft
.ServiceModel
.Samples
7 ' The service contract is defined in generatedClient.vb, generated from the service by the svcutil tool.
11 Public Shared
Sub Main()
13 Console
.WriteLine("Press <ENTER> to terminate client once the output is displayed.")
17 Dim client
As New CalculatorClient()
20 Dim value1
As Double = 100
21 Dim value2
As Double = 15.99
22 AddHandler client
.AddCompleted
, AddressOf AddCallback
23 client
.AddAsync(value1
, value2
)
24 Console
.WriteLine("Add({0},{1})", value1
, value2
)
29 AddHandler client
.SubtractCompleted
, AddressOf SubtractCallback
30 client
.SubtractAsync(value1
, value2
)
31 Console
.WriteLine("Subtract({0},{1})", value1
, value2
)
36 Dim result
As Double = client
.Multiply(value1
, value2
)
37 Console
.WriteLine("Multiply({0},{1}) = {2}", value1
, value2
, result
)
42 result
= client
.Divide(value1
, value2
)
43 Console
.WriteLine("Divide({0},{1}) = {2}", value1
, value2
, result
)
46 'Closing the client gracefully closes the connection and cleans up resources
51 ' Asynchronous callbacks for displaying results.
52 Private Shared
Sub AddCallback(ByVal sender
As Object, ByVal e
As AddCompletedEventArgs
)
54 Console
.WriteLine("Add Result: {0}", e
.Result
)
58 Private Shared
Sub SubtractCallback(ByVal sender
As Object, ByVal e
As SubtractCompletedEventArgs
)
60 Console
.WriteLine("Subtract Result: {0}", e
.Result
)