_RemainCount = arg.ApiInfo.RemainCount
_ResetTime = arg.ApiInfo.ResetTime
_ResetTimeInSeconds = arg.ApiInfo.ResetTimeInSeconds
- _UsingCount = arg.ApiInfo.UsingCount
+ '_UsingCount = arg.ApiInfo.UsingCount
End Sub
Public Property MaxCount As Integer
Imports System.ComponentModel
+Imports System.Threading
' Tween - Client of Twitter
' Copyright (c) 2007-2010 kiri_feather (@kiri_feather) <kiri_feather@gmail.com>
CalcApiUsing()
End Sub
- Private Sub DisplayApiMaxCount(ByVal info As ApiInfo)
+ Private Sub DisplayApiMaxCount()
If TwitterApiInfo.MaxCount > -1 Then
LabelApiUsing.Text = String.Format(My.Resources.SettingAPIUse1, TwitterApiInfo.UsingCount, TwitterApiInfo.MaxCount)
Else
If tw IsNot Nothing Then
If TwitterApiInfo.MaxCount = -1 Then
If Twitter.AccountState = ACCOUNT_STATE.Valid Then
- Dim info As New ApiInfo
- info.UsingCount = UsingApi
- Dim proc As New Action(Of ApiInfo)(Sub(infoCount)
- tw.GetInfoApi(infoCount) '取得エラー時はinfoCountは初期状態(値:-1)
- If Me.IsHandleCreated Then Me.Invoke(New Action(Of ApiInfo)(AddressOf DisplayApiMaxCount), infoCount)
- End Sub)
- proc.BeginInvoke(info, Nothing, Nothing)
+ TwitterApiInfo.UsingCount = UsingApi
+ Dim proc As New Thread(New Threading.ThreadStart(Sub()
+ tw.GetInfoApi(Nothing) '取得エラー時はinfoCountは初期状態(値:-1)
+ If Me.IsHandleCreated Then Invoke(New MethodInvoker(AddressOf DisplayApiMaxCount))
+ End Sub))
+ proc.Start()
Else
LabelApiUsing.Text = String.Format(My.Resources.SettingAPIUse1, UsingApi, "???")
End If
End Sub
Private Sub Setting_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
+ Do
+ Thread.Sleep(10)
+ If Me.Disposing OrElse Me.IsDisposed Then Exit Sub
+ Loop Until Me.IsHandleCreated
CalcApiUsing()
End Sub
sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.Name, post.Data, post.Id, Environment.NewLine)
End If
Next
+ If IsProtected Then
+ MessageBox.Show(My.Resources.CopyStotText1)
+ End If
If sb.Length > 0 Then
clstr = sb.ToString()
Try
- Dim proc As New Action(Of String)(Sub(text)
- Me.Invoke(New Action(Of String)(AddressOf Clipboard.SetText), text)
- End Sub)
- proc.BeginInvoke(clstr, Nothing, Nothing)
+ Clipboard.SetDataObject(clstr, False, 5, 100)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
- End If
- If IsProtected Then
- MessageBox.Show(My.Resources.CopyStotText1)
+ 'Try
+ ' Dim proc As New Action(Of String)(Sub(text)
+ ' Me.Invoke(New Action(Of String)(AddressOf Clipboard.SetText), text)
+ ' End Sub)
+ ' proc.BeginInvoke(clstr, Nothing, Nothing)
+ 'Catch ex As Exception
+ ' MessageBox.Show(ex.Message)
+ 'End Try
End If
End Sub
End Sub
Private Sub _hookGlobalHotkey_HotkeyPressed(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles _hookGlobalHotkey.HotkeyPressed
- If (Me.WindowState = FormWindowState.Normal OrElse Me.WindowState = FormWindowState.Maximized) AndAlso Me.Visible Then
+ If (Me.WindowState = FormWindowState.Normal OrElse Me.WindowState = FormWindowState.Maximized) AndAlso Me.Visible AndAlso Form.ActiveForm Is Me Then
'アイコン化
Me.Visible = False
- Else
+ ElseIf Form.ActiveForm Is Nothing Then
Me.Visible = True
If Me.WindowState = FormWindowState.Minimized Then Me.WindowState = FormWindowState.Normal
Me.Activate()
arg.ApiInfo.RemainCount = Integer.Parse(xdoc.SelectSingleNode("/hash/remaining-hits").InnerText)
arg.ApiInfo.ResetTime = DateTime.Parse(xdoc.SelectSingleNode("/hash/reset-time").InnerText)
arg.ApiInfo.ResetTimeInSeconds = Integer.Parse(xdoc.SelectSingleNode("/hash/reset-time-in-seconds").InnerText)
- arg.ApiInfo.UsingCount = info.UsingCount
+ If info IsNot Nothing Then
+ arg.ApiInfo.UsingCount = info.UsingCount
- info.MaxCount = arg.ApiInfo.MaxCount
- info.RemainCount = arg.ApiInfo.RemainCount
- info.ResetTime = arg.ApiInfo.ResetTime
- info.ResetTimeInSeconds = arg.ApiInfo.ResetTimeInSeconds
+ info.MaxCount = arg.ApiInfo.MaxCount
+ info.RemainCount = arg.ApiInfo.RemainCount
+ info.ResetTime = arg.ApiInfo.ResetTime
+ info.ResetTimeInSeconds = arg.ApiInfo.ResetTimeInSeconds
+ End If
RaiseEvent ApiInformationChanged(Me, arg)
TwitterApiInfo.WriteBackEventArgs(arg)