@@ -289,132 +289,132 @@ Public Class MainForm
289
289
End Sub
290
290
291
291
Private Sub jc_OnConnect(sender As Object , stream As connection.StanzaStream) Handles jc.OnConnect
292
- InvokeAction( Sub ()
293
- m_err = False
294
- debug.AppendMaybeScroll( "Connected to: " & stream.ToString() & vbCrLf)
295
- End Sub )
292
+ Me . InvokeAction(Sub ()
293
+ m_err = False
294
+ debug.AppendMaybeScroll( "Connected to: " & stream.ToString() & vbCrLf)
295
+ End Sub )
296
296
End Sub
297
297
298
298
Private Sub jc_OnReadText(sender As Object , txt As String ) Handles jc.OnReadText
299
- InvokeAction( Sub ()
300
- debug.SelectionColor = Color.Red
301
- debug.AppendText( "RECV: " )
302
- debug.SelectionColor = Color.Black
303
- debug.AppendText(txt)
304
- debug.AppendMaybeScroll(vbCrLf)
305
- End Sub )
299
+ Me . InvokeAction(Sub ()
300
+ debug.SelectionColor = Color.Red
301
+ debug.AppendText( "RECV: " )
302
+ debug.SelectionColor = Color.Black
303
+ debug.AppendText(txt)
304
+ debug.AppendMaybeScroll(vbCrLf)
305
+ End Sub )
306
306
End Sub
307
307
308
308
Private Sub jc_OnWriteText(sender As Object , txt As String ) Handles jc.OnWriteText
309
- InvokeAction( Sub ()
310
- ' keepalive
311
- If txt = " " Then
312
- Return
313
- End If
314
-
315
- debug.SelectionColor = Color.Blue
316
- debug.AppendText( "SEND: " )
317
- debug.SelectionColor = Color.Black
318
- debug.AppendText(txt)
319
- debug.AppendMaybeScroll(vbCrLf)
320
- End Sub )
309
+ Me . InvokeAction(Sub ()
310
+ ' keepalive
311
+ If txt = " " Then
312
+ Return
313
+ End If
314
+
315
+ debug.SelectionColor = Color.Blue
316
+ debug.AppendText( "SEND: " )
317
+ debug.SelectionColor = Color.Black
318
+ debug.AppendText(txt)
319
+ debug.AppendMaybeScroll(vbCrLf)
320
+ End Sub )
321
321
End Sub
322
322
323
323
Private Sub jc_OnAuthenticate(sender As Object ) Handles jc.OnAuthenticate
324
- InvokeAction( Sub ()
325
- pnlPresence.Text = "Available"
326
- pnlCon.Text = "Connected"
327
- End Sub )
324
+ Me . InvokeAction(Sub ()
325
+ pnlPresence.Text = "Available"
326
+ pnlCon.Text = "Connected"
327
+ End Sub )
328
328
End Sub
329
329
330
330
Private Sub jc_OnDisconnect(sender As Object ) Handles jc.OnDisconnect
331
- InvokeAction( Sub ()
332
- pnlPresence.Text = "Offline"
333
-
334
- If Not m_err Then
335
- pnlCon.Text = "Disconnected"
336
- End If
337
- End Sub )
331
+ Me . InvokeAction(Sub ()
332
+ pnlPresence.Text = "Offline"
333
+
334
+ If Not m_err Then
335
+ pnlCon.Text = "Disconnected"
336
+ End If
337
+ End Sub )
338
338
End Sub
339
339
340
340
Private Sub jc_OnError(sender As Object , ex As Exception) Handles jc.OnError
341
- InvokeAction( Sub ()
342
- pnlCon.Text = "Error!"
343
- debug.SelectionColor = Color.Green
344
- debug.AppendText( "ERROR: " )
345
- debug.SelectionColor = Color.Black
346
- debug.AppendText(ex.ToString())
347
- debug.AppendMaybeScroll(vbCrLf)
348
- End Sub )
341
+ Me . InvokeAction(Sub ()
342
+ pnlCon.Text = "Error!"
343
+ debug.SelectionColor = Color.Green
344
+ debug.AppendText( "ERROR: " )
345
+ debug.SelectionColor = Color.Black
346
+ debug.AppendText(ex.ToString())
347
+ debug.AppendMaybeScroll(vbCrLf)
348
+ End Sub )
349
349
End Sub
350
350
351
351
Private Sub jc_OnAuthError(sender As Object , iq As XmlElement) Handles jc.OnAuthError
352
- InvokeAction( Sub ()
353
- If (MessageBox.Show( Me , "Create new account?" , _
354
- "Authentication error" , MessageBoxButtons.OKCancel) = Windows.Forms.DialogResult.OK) Then
355
- jc.Register( New JID(jc.User, jc.Server, Nothing ))
356
- Else
357
- jc.Close()
358
- Connect()
359
- End If
360
- End Sub )
352
+ Me . InvokeAction(Sub ()
353
+ If (MessageBox.Show( Me , "Create new account?" , _
354
+ "Authentication error" , MessageBoxButtons.OKCancel) = Windows.Forms.DialogResult.OK) Then
355
+ jc.Register( New JID(jc.User, jc.Server, Nothing ))
356
+ Else
357
+ jc.Close()
358
+ Connect()
359
+ End If
360
+ End Sub )
361
361
End Sub
362
362
363
363
Private Function jc_OnRegisterInfo(sender As Object , register As Register) As Boolean Handles jc.OnRegisterInfo
364
- InvokeFunc( Function ()
365
- Dim data As protocol.x.Data = register.Form
366
- If (data Is Nothing ) Then Return True
367
-
368
- Dim form As muzzle.XDataForm = New muzzle.XDataForm(data)
369
-
370
- If (form.ShowDialog() <> Windows.Forms.DialogResult.OK) Then Return False
371
- form.FillInResponse(data)
372
-
373
- Return True
374
- End Function )
364
+ Me . InvokeFunc(Function ()
365
+ Dim data As protocol.x.Data = register.Form
366
+ If (data Is Nothing ) Then Return True
367
+
368
+ Dim form As muzzle.XDataForm = New muzzle.XDataForm(data)
369
+
370
+ If (form.ShowDialog() <> Windows.Forms.DialogResult.OK) Then Return False
371
+ form.FillInResponse(data)
372
+
373
+ Return True
374
+ End Function )
375
375
End Function
376
376
377
377
378
378
Private Sub jc_OnRegistered(sender As Object , iq As IQ) Handles jc.OnRegistered
379
- InvokeAction( Sub ()
380
- If (iq.Type = IQType.result) Then
381
- jc.Login()
382
- Else
383
- pnlCon.Text = "Registration error"
384
- End If
385
- End Sub )
379
+ Me . InvokeAction(Sub ()
380
+ If (iq.Type = IQType.result) Then
381
+ jc.Login()
382
+ Else
383
+ pnlCon.Text = "Registration error"
384
+ End If
385
+ End Sub )
386
386
End Sub
387
387
388
388
Private Sub jc_OnMessage(sender As Object , msg As Message) Handles jc.OnMessage
389
- InvokeAction( Sub ()
390
- MessageBox.Show( Me , msg.Body, msg.From.ToString(), MessageBoxButtons.OK)
391
- End Sub )
389
+ Me . InvokeAction(Sub ()
390
+ MessageBox.Show( Me , msg.Body, msg.From.ToString(), MessageBoxButtons.OK)
391
+ End Sub )
392
392
End Sub
393
393
394
394
Private Sub jc_OnIQ(sender As Object , iq As IQ) Handles jc.OnIQ
395
- InvokeAction( Sub ()
396
- If iq.Type <> IQType.get Then Return
397
-
398
- Dim query As XmlElement = iq.Query
399
- If (query Is Nothing ) Then
400
- Return
401
- End If
402
-
403
- If TypeOf query Is Version Then
404
- iq = iq.GetResponse(jc.Document)
405
- Dim ver As Version = DirectCast (iq.Query, Version)
406
- ver.OS = Environment.OSVersion.ToString()
407
- ver.EntityName = Application.ProductName
408
- ver.Ver = Application.ProductVersion
409
- jc.Write(iq)
410
- End If
411
- End Sub )
395
+ Me . InvokeAction(Sub ()
396
+ If iq.Type <> IQType.get Then Return
397
+
398
+ Dim query As XmlElement = iq.Query
399
+ If (query Is Nothing ) Then
400
+ Return
401
+ End If
402
+
403
+ If TypeOf query Is Version Then
404
+ iq = iq.GetResponse(jc.Document)
405
+ Dim ver As Version = DirectCast (iq.Query, Version)
406
+ ver.OS = Environment.OSVersion.ToString()
407
+ ver.EntityName = Application.ProductName
408
+ ver.Ver = Application.ProductVersion
409
+ jc.Write(iq)
410
+ End If
411
+ End Sub )
412
412
End Sub
413
413
414
414
Private Sub rm_OnRosterEnd(sender As Object ) Handles rm.OnRosterEnd
415
- InvokeAction( Sub ()
416
- roster.ExpandAll()
417
- End Sub )
415
+ Me . InvokeAction(Sub ()
416
+ roster.ExpandAll()
417
+ End Sub )
418
418
End Sub
419
419
420
420
Private Sub roster_DoubleClick( ByVal sender As System.Object, ByVal e As System.EventArgs)
@@ -424,16 +424,16 @@ Public Class MainForm
424
424
End Sub
425
425
426
426
Private Sub jc_OnStreamError(sender As Object , rp As XmlElement) Handles jc.OnStreamError
427
- InvokeAction( Sub ()
428
- m_err = True
429
- pnlCon.Text = "Stream error: " + rp.InnerText
430
- End Sub )
427
+ Me . InvokeAction(Sub ()
428
+ m_err = True
429
+ pnlCon.Text = "Stream error: " + rp.InnerText
430
+ End Sub )
431
431
End Sub
432
432
433
433
Private Sub jc_OnStreamInit(sender As Object , stream As protocol.ElementStream) Handles jc.OnStreamInit
434
- InvokeAction( Sub ()
435
- stream.AddFactory( New FooFactory)
436
- End Sub )
434
+ Me . InvokeAction(Sub ()
435
+ stream.AddFactory( New FooFactory)
436
+ End Sub )
437
437
End Sub
438
438
439
439
Private Sub mnuPresence_Popup( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuPresence.Popup
0 commit comments