Imports Twitterizer.Framework
Imports System
Imports System.Threading
Public Class Form2
Dim myOwn As New Twitter("iAmBivas", "bcltt351")
'Dim frndTL As TwitterStatusCollection = myOwn.Status.FriendsTimeline
'dim publicTL As TwitterStatusCollection = myOwn.Status.PublicTimeline
Public Sub refreshTL()
Dim frndTL As TwitterStatusCollection = myOwn.Status.FriendsTimeline
Dim tempStat As New TwitterStatus()
lsvTweets.Clear()
For Each tempStat In frndTL
lsvTweets.Items.Add(tempStat.TwitterUser.ScreenName & " : " & tempStat.Text)
Next
End Sub
Private Sub updateInfinity()
Do While True
If lsvTweets.InvokeRequired Then
Me.lsvTweets.BeginInvoke(New MethodInvoker(AddressOf updateInfinity))
Else
Me.refreshTL()
Thread.Sleep(20000)
End If
Loop
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
myOwn.Status.Update(txtUpdate.Text)
refreshTL()
txtUpdate.Clear()
txtUpdate.Focus()
End Sub
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
refreshTL()
End Sub
Private Sub Form2_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
End
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
refreshTL()
txtUpdate.Focus()
'Dim upd As New Threading.Thread(AddressOf Me.updateInfinity)
'upd.Start()
Me.BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub lsvTweets_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lsvTweets.Click
txtDetails.Text = ""
txtDetails.Text = lsvTweets.FocusedItem.Text
End Sub
Private Sub txtDetails_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDetails.TextChanged
End Sub
Private Sub txtUpdate_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUpdate.TextChanged
If txtUpdate.TextLength > 140 Then
Label1.ForeColor = Color.Red
End If
Label1.Text = txtUpdate.TextLength & " Chars"
End Sub
Private Sub btnBitLy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBitLy.Click
btnShorten.Enabled = True
txtBitly.Enabled = True
btnBitLy.Enabled = False
End Sub
Private Sub btnShorten_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShorten.Click
txtUpdate.Text &= " " & txtBitly.Text
txtBitly.Text = ""
btnShorten.Enabled = False
txtBitly.Enabled = False
btnBitLy.Enabled = True
End Sub
Private Sub lsvTweets_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lsvTweets.SelectedIndexChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
txtUpdate.Text = ""
txtUpdate.Text &= "RT " & txtDetails.Text
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim tmp As String
Dim tmpChar As Char
Dim n As Integer = 0
tmp = txtDetails.Text
For Each tmpChar In tmp
If tmpChar <> " " Then
n = n + 1
Else
Exit For
End If
Next
tmp = txtDetails.Text.Substring(0, n)
txtUpdate.Text = "@" & tmp & " "
txtUpdate.Focus()
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Me.updateInfinity()
End Sub
End Class