1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
Partial
Public Class Page
Inherits UserControl
Public Sub New()
InitializeComponent()
End Sub
Private Sub appelService(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Dim val As Decimal
' Dim pat As New PageAsyncTask(AddressOf BeginProductRetrieveAsync, AddressOf EndProductRetrieveAsync, Nothing, Nothing)
val = 100
MessageBox.Show(
"Clicked. Tentative d'appel du service")
Dim client As ServiceTest.ServiceDevClient
client =
New ServiceTest.ServiceDevClient()
MessageBox.Show(
"Avant appel asynchrone")
AddHandler client.EuroToUsDollarsCompleted, AddressOf EuroToUsDollarsCallback
client.EuroToUsDollarsAsync(val)
MessageBox.Show(
"Apres appel asynchrone")
End Sub
Private Shared Sub EuroToUsDollarsCallback(ByVal sender As Object, ByVal e As ServiceTest.EuroToUsDollarsCompletedEventArgs)
Try
MessageBox.Show(
"reponse : " & e.Result)
Console.WriteLine(
"Add Result: {0}", e.Result)
Catch ex As Exception
MessageBox.Show(
"Exception dans eurotousdollarscallback " & ex.Message)
End Try
End Sub
Public Event EuroToUsDollarsCompleted As System.EventHandler(Of ServiceTest.EuroToUsDollarsCompletedEventArgs)
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.CodeDom.Compiler.GeneratedCodeAttribute(
"System.ServiceModel", "3.0.0.0")> _
Partial Public Class EuroToUsDollarsCompletedEventArgs
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
End
Class |
Partager