Skip to content

Commit 57fc09d

Browse files
committed
#46: add Me expressions for extension invocations
Travis thinks they're necessary.
1 parent 758c3a5 commit 57fc09d

File tree

1 file changed

+99
-99
lines changed

1 file changed

+99
-99
lines changed

examples/JabberNet.VbExample/MainForm.vb

+99-99
Original file line numberDiff line numberDiff line change
@@ -289,132 +289,132 @@ Public Class MainForm
289289
End Sub
290290

291291
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)
296296
End Sub
297297

298298
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)
306306
End Sub
307307

308308
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)
321321
End Sub
322322

323323
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)
328328
End Sub
329329

330330
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)
338338
End Sub
339339

340340
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)
349349
End Sub
350350

351351
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)
361361
End Sub
362362

363363
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)
375375
End Function
376376

377377

378378
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)
386386
End Sub
387387

388388
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)
392392
End Sub
393393

394394
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)
412412
End Sub
413413

414414
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)
418418
End Sub
419419

420420
Private Sub roster_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
@@ -424,16 +424,16 @@ Public Class MainForm
424424
End Sub
425425

426426
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)
431431
End Sub
432432

433433
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)
437437
End Sub
438438

439439
Private Sub mnuPresence_Popup(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuPresence.Popup

0 commit comments

Comments
 (0)