1 ' Tween - Client of Twitter
2 ' Copyright (c) 2007-2010 kiri_feather (@kiri_feather) <kiri_feather@gmail.com>
3 ' (c) 2008-2010 Moz (@syo68k) <http://iddy.jp/profile/moz/>
4 ' (c) 2008-2010 takeshik (@takeshik) <http://www.takeshik.org/>
7 ' This file is part of Tween.
9 ' This program is free software; you can redistribute it and/or modify it
10 ' under the terms of the GNU General Public License as published by the Free
11 ' Software Foundation; either version 3 of the License, or (at your option)
14 ' This program is distributed in the hope that it will be useful, but
15 ' WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ' or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 ' You should have received a copy of the GNU General Public License along
20 ' with this program. If not, see <http://www.gnu.org/licenses/>, or write to
21 ' the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
22 ' Boston, MA 02110-1301, USA.
25 '"c:\Program Files\Microsoft.NET\SDK\v2.0\Bin\sgen.exe" /f /a:"$(TargetPath)"
26 '"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sgen.exe" /f /a:"$(TargetPath)"
31 Imports System.Text.RegularExpressions
32 Imports Tween.TweenCustomControl
35 Imports System.Reflection
36 Imports System.ComponentModel
37 Imports System.Diagnostics
38 Imports Microsoft.Win32
40 Public Class TweenMain
43 Private _mySize As Size '画面サイズ
44 Private _myLoc As Point '画面位置
45 Private _mySpDis As Integer '区切り位置
46 Private _mySpDis2 As Integer '発言欄区切り位置
47 Private _iconSz As Integer 'アイコンサイズ(現在は16、24、48の3種類。将来直接数字指定可能とする 注:24x24の場合に26と指定しているのはMSゴシック系フォントのための仕様)
48 Private _iconCol As Boolean '1列表示の時True(48サイズのとき)
51 Private _initial As Boolean 'True:起動時処理中
52 Private _initialLayout As Boolean = True
53 Private _ignoreConfigSave As Boolean 'True:起動時処理中
54 'Private listViewItemSorter As ListViewItemComparer 'リストソート用カスタムクラス
55 Private _tabDrag As Boolean 'タブドラッグ中フラグ(DoDragDropを実行するかの判定用)
56 Private _rclickTabName As String '右クリックしたタブの名前(Tabコントロール機能不足対応)
57 Private ReadOnly _syncObject As New Object() 'ロック用
58 Private Const detailHtmlFormatMono1 As String = "<html><head><style type=""text/css""><!-- pre {font-family: """
59 Private Const detailHtmlFormat2 As String = """, sans-serif; font-size: "
60 Private Const detailHtmlFormat3 As String = "pt; word-wrap: break-word; color:rgb("
61 Private Const detailHtmlFormat4 As String = ");} a:link, a:visited, a:active, a:hover {color:rgb("
62 Private Const detailHtmlFormat5 As String = "); } --></style></head><body style=""margin:0px; background-color:rgb("
63 Private Const detailHtmlFormatMono6 As String = ");""><pre>"
64 Private Const detailHtmlFormatMono7 As String = "</pre></body></html>"
65 Private Const detailHtmlFormat1 As String = "<html><head><style type=""text/css""><!-- p {font-family: """
66 Private Const detailHtmlFormat6 As String = ");""><p>"
67 Private Const detailHtmlFormat7 As String = "</p></body></html>"
68 Private detailHtmlFormatHeader As String
69 Private detailHtmlFormatFooter As String
70 Private _myStatusError As Boolean = False
71 Private _myStatusOnline As Boolean = False
72 Private soundfileListup As Boolean = False
73 Private _spaceKeyCanceler As SpaceKeyCanceler
76 'Private _cfg As SettingToConfig '旧
77 Private _cfgLocal As SettingLocal
78 Private _cfgCommon As SettingCommon
79 Private modifySettingLocal As Boolean = False
80 Private modifySettingCommon As Boolean = False
81 Private modifySettingAtId As Boolean = False
84 Private tw As New Twitter
87 Private SettingDialog As New Setting() '設定画面インスタンス
88 Private TabDialog As New TabsDialog() 'タブ選択ダイアログインスタンス
89 Private SearchDialog As New SearchWord() '検索画面インスタンス
90 'Private _tabs As New List(Of TabStructure)() '要素TabStructureクラスのジェネリックリストインスタンス(タブ情報用)
91 Private fDialog As New FilterDialog() 'フィルター編集画面
92 Private UrlDialog As New OpenURL()
93 Private dialogAsShieldicon As DialogAsShieldIcon ' シールドアイコン付きダイアログ
94 Private AtIdSupl As AtIdSupplement '@id補助
95 Private HashSupl As AtIdSupplement 'Hashtag補助
96 Private HashMgr As HashtagManage
99 Private _fntUnread As Font '未読用フォント
100 Private _clUnread As Color '未読用文字色
101 Private _fntReaded As Font '既読用フォント
102 Private _clReaded As Color '既読用文字色
103 Private _clFav As Color 'Fav用文字色
104 Private _clOWL As Color '片思い用文字色
105 Private _clRetweet As Color 'Retweet用文字色
106 Private _fntDetail As Font '発言詳細部用フォント
107 Private _clDetail As Color '発言詳細部用色
108 Private _clDetailLink As Color '発言詳細部用リンク文字色
109 Private _clDetailBackcolor As Color '発言詳細部用背景色
110 Private _clSelf As Color '自分の発言用背景色
111 Private _clAtSelf As Color '自分宛返信用背景色
112 Private _clTarget As Color '選択発言者の他の発言用背景色
113 Private _clAtTarget As Color '選択発言中の返信先用背景色
114 Private _clAtFromTarget As Color '選択発言者への返信発言用背景色
115 Private _clAtTo As Color '選択発言の唯一@先
116 Private _clListBackcolor As Color 'リスト部通常発言背景色
117 Private _clInputBackcolor As Color '入力欄背景色
118 Private _clInputFont As Color '入力欄文字色
119 Private _fntInputFont As Font '入力欄フォント
120 'Private TIconList As ImageList '発言詳細部用アイコン画像リスト
121 Private TIconDic As Dictionary(Of String, Image) '発言詳細部用アイコン画像リスト
122 Private TIconSmallList As ImageList 'リスト表示用アイコン画像リスト
123 Private NIconAt As Icon 'At.ico タスクトレイアイコン:通常時
124 Private NIconAtRed As Icon 'AtRed.ico タスクトレイアイコン:通信エラー時
125 Private NIconAtSmoke As Icon 'AtSmoke.ico タスクトレイアイコン:オフライン時
126 Private NIconRefresh(3) As Icon 'Refresh.ico タスクトレイアイコン:更新中(アニメーション用に4種類を保持するリスト)
127 Private TabIcon As Icon 'Tab.ico 未読のあるタブ用アイコン
128 Private MainIcon As Icon 'Main.ico 画面左上のアイコン
129 Private ReplyIcon As Icon '5g
130 Private ReplyIconBlink As Icon '6g
132 Private _anchorPost As PostClass
133 Private _anchorFlag As Boolean 'True:関連発言移動中(関連移動以外のオペレーションをするとFalseへ。Trueだとリスト背景色をアンカー発言選択中として描画)
135 Private _history As New List(Of String)() '発言履歴
136 Private _hisIdx As Integer '発言履歴カレントインデックス
138 '発言投稿時のAPI引数(発言編集時に設定。手書きreplyでは設定されない)
139 Private _reply_to_id As Long ' リプライ先のステータスID 0の場合はリプライではない 注:複数あてのものはリプライではない
140 Private _reply_to_name As String ' リプライ先ステータスの書き込み者の名前
143 Private _postTimestamps As New List(Of Date)()
144 Private _favTimestamps As New List(Of Date)()
145 Private _tlTimestamps As New Dictionary(Of Date, Integer)()
146 Private _tlCount As Integer
149 Private _brsHighLight As New SolidBrush(Color.FromKnownColor(KnownColor.Highlight))
150 Private _brsHighLightText As New SolidBrush(Color.FromKnownColor(KnownColor.HighlightText))
151 Private _brsForeColorUnread As SolidBrush
152 Private _brsForeColorReaded As SolidBrush
153 Private _brsForeColorFav As SolidBrush
154 Private _brsForeColorOWL As SolidBrush
155 Private _brsForeColorRetweet As SolidBrush
156 Private _brsBackColorMine As SolidBrush
157 Private _brsBackColorAt As SolidBrush
158 Private _brsBackColorYou As SolidBrush
159 Private _brsBackColorAtYou As SolidBrush
160 Private _brsBackColorAtFromTarget As SolidBrush
161 Private _brsBackColorAtTo As SolidBrush
162 Private _brsBackColorNone As SolidBrush
163 Private _brsDeactiveSelection As New SolidBrush(Color.FromKnownColor(KnownColor.ButtonFace)) 'Listにフォーカスないときの選択行の背景色
164 Private sf As New StringFormat()
165 Private sfTab As New StringFormat()
166 'Private _columnIdx As Integer 'ListviewのDisplayIndex退避用(DrawItemで使用)
167 'Private _columnChangeFlag As Boolean
169 '''''''''''''''''''''''''''''''''''''''''''''''''''''
170 Private _statuses As TabInformations
171 Private _itemCache() As ListViewItem
172 Private _itemCacheIndex As Integer
173 Private _postCache() As PostClass
174 Private _curTab As TabPage
175 Private _curItemIndex As Integer
176 Private _curList As DetailsListView
177 Private _curPost As PostClass
178 Private _isColumnChanged As Boolean = False
179 'Private _waitFollower As Boolean = False
180 Private _waitTimeline As Boolean = False
181 Private _waitReply As Boolean = False
182 Private _waitDm As Boolean = False
183 Private _waitFav As Boolean = False
184 Private _waitPubSearch As Boolean = False
185 Private _bw(9) As BackgroundWorker
186 Private _bwFollower As BackgroundWorker
187 Private cMode As Integer
188 Private shield As New ShieldIcon
189 Private SecurityManager As InternetSecurityManager
191 Private _homeCounter As Integer = 0
192 Private _homeCounterAdjuster As Integer = 0
193 Private _mentionCounter As Integer = 0
194 Private _dmCounter As Integer = 0
195 'Private _favCounter As Integer = 0
196 Private _pubSearchCounter As Integer = 0
197 '''''''''''''''''''''''''''''''''''''''''''''''''''''
199 Private _drawcount As Long = 0
200 Private _drawtime As Long = 0
204 Private Structure urlUndo
205 Public Before As String
206 Public After As String
209 Private urlUndoBuffer As Generic.List(Of urlUndo) = Nothing
211 'Backgroundworkerの処理結果通知用引数構造体
212 Private Structure GetWorkerResult
213 Public retMsg As String '処理結果詳細メッセージ。エラー時に値がセットされる
214 'Public notifyPosts As List(Of PostClass) '取得した発言。Twitter.MyListItem構造体を要素としたジェネリックリスト
215 Public page As Integer '取得対象ページ番号
216 Public endPage As Integer '取得終了ページ番号(継続可能ならインクリメントされて返る。pageと比較して継続判定)
217 Public type As WORKERTYPE '処理種別
218 Public imgs As Dictionary(Of String, Image) '新規取得したアイコンイメージ
219 Public tName As String 'Fav追加・削除時のタブ名
220 Public ids As List(Of Long) 'Fav追加・削除時のID
221 Public sIds As List(Of Long) 'Fav追加・削除成功分のID
222 Public newDM As Boolean
223 'Public soundFile As String
224 Public addCount As Integer
227 'Backgroundworkerへ処理内容を通知するための引数用構造体
228 Private Structure GetWorkerArg
229 Public page As Integer '処理対象ページ番号
230 Public endPage As Integer '処理終了ページ番号(起動時の読み込みページ数。通常時はpageと同じ値をセット)
231 Public type As WORKERTYPE '処理種別
232 Public status As String '発言POST時の発言内容
233 Public ids As List(Of Long) 'Fav追加・削除時のItemIndex
234 Public sIds As List(Of Long) 'Fav追加・削除成功分のItemIndex
235 Public tName As String 'Fav追加・削除時のタブ名
239 Private Enum SEARCHTYPE
245 Private Class SpaceKeyCanceler
246 Inherits NativeWindow
247 Implements IDisposable
249 Dim WM_KEYDOWN As Integer = &H100
250 Dim VK_SPACE As Integer = &H20
252 Public Sub New(ByVal control As Control)
253 Me.AssignHandle(control.Handle)
256 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
257 If (m.Msg = WM_KEYDOWN) AndAlso (CInt(m.WParam) = VK_SPACE) Then
258 RaiseEvent SpaceCancel(Me, EventArgs.Empty)
265 Public Event SpaceCancel As EventHandler
267 Public Sub Dispose() Implements IDisposable.Dispose
272 Private Sub TweenMain_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
273 '画面が他画面の裏に隠れると、アイコン画像が再描画されない問題の対応
274 If UserPicture.Image IsNot Nothing Then
275 UserPicture.Invalidate(False)
277 '画面がアクティブになったら、発言欄の背景色戻す
278 If StatusText.Focused Then
279 Me.StatusText_Enter(Me.StatusText, System.EventArgs.Empty)
283 Private Sub TweenMain_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
285 SettingDialog.Dispose()
287 SearchDialog.Dispose()
290 _spaceKeyCanceler.Dispose()
291 If TIconDic IsNot Nothing AndAlso TIconDic.Keys.Count > 0 Then
292 For Each key As String In TIconDic.Keys
293 TIconDic(key).Dispose()
297 If TIconSmallList IsNot Nothing Then TIconSmallList.Dispose()
298 If NIconAt IsNot Nothing Then NIconAt.Dispose()
299 If NIconAtRed IsNot Nothing Then NIconAtRed.Dispose()
300 If NIconAtSmoke IsNot Nothing Then NIconAtSmoke.Dispose()
301 If NIconRefresh(0) IsNot Nothing Then NIconRefresh(0).Dispose()
302 If NIconRefresh(1) IsNot Nothing Then NIconRefresh(1).Dispose()
303 If NIconRefresh(2) IsNot Nothing Then NIconRefresh(2).Dispose()
304 If NIconRefresh(3) IsNot Nothing Then NIconRefresh(3).Dispose()
305 If TabIcon IsNot Nothing Then TabIcon.Dispose()
306 If MainIcon IsNot Nothing Then MainIcon.Dispose()
307 If ReplyIcon IsNot Nothing Then ReplyIcon.Dispose()
308 If ReplyIconBlink IsNot Nothing Then ReplyIconBlink.Dispose()
309 _brsHighLight.Dispose()
310 _brsHighLightText.Dispose()
311 If _brsForeColorUnread IsNot Nothing Then _brsForeColorUnread.Dispose()
312 If _brsForeColorReaded IsNot Nothing Then _brsForeColorReaded.Dispose()
313 If _brsForeColorFav IsNot Nothing Then _brsForeColorFav.Dispose()
314 If _brsForeColorOWL IsNot Nothing Then _brsForeColorOWL.Dispose()
315 If _brsForeColorRetweet IsNot Nothing Then _brsForeColorRetweet.Dispose()
316 If _brsBackColorMine IsNot Nothing Then _brsBackColorMine.Dispose()
317 If _brsBackColorAt IsNot Nothing Then _brsBackColorAt.Dispose()
318 If _brsBackColorYou IsNot Nothing Then _brsBackColorYou.Dispose()
319 If _brsBackColorAtYou IsNot Nothing Then _brsBackColorAtYou.Dispose()
320 If _brsBackColorAtFromTarget IsNot Nothing Then _brsBackColorAtFromTarget.Dispose()
321 If _brsBackColorAtTo IsNot Nothing Then _brsBackColorAtTo.Dispose()
322 If _brsBackColorNone IsNot Nothing Then _brsBackColorNone.Dispose()
323 If _brsDeactiveSelection IsNot Nothing Then _brsDeactiveSelection.Dispose()
327 For Each bw As BackgroundWorker In _bw
328 If bw IsNot Nothing Then
332 If _bwFollower IsNot Nothing Then
333 _bwFollower.Dispose()
337 Private Sub LoadIcons()
340 Dim dir As String = Application.StartupPath
342 NIconAt = My.Resources.At
343 NIconAtRed = My.Resources.AtRed
344 NIconAtSmoke = My.Resources.AtSmoke
345 NIconRefresh(0) = My.Resources.Refresh
346 NIconRefresh(1) = My.Resources.Refresh2
347 NIconRefresh(2) = My.Resources.Refresh3
348 NIconRefresh(3) = My.Resources.Refresh4
349 TabIcon = My.Resources.TabIcon
350 MainIcon = My.Resources.MIcon
351 ReplyIcon = My.Resources.Reply
352 ReplyIconBlink = My.Resources.ReplyBlink
354 If Not Directory.Exists(Path.Combine(dir, "Icons")) Then
358 If File.Exists(Path.Combine(dir, "Icons\At.ico")) Then
360 NIconAt = New Icon(Path.Combine(dir, "Icons\At.ico"))
361 Catch ex As Exception
365 If File.Exists(Path.Combine(dir, "Icons\AtRed.ico")) Then
367 NIconAtRed = New Icon(Path.Combine(dir, "Icons\AtRed.ico"))
368 Catch ex As Exception
372 If File.Exists(Path.Combine(dir, "Icons\AtSmoke.ico")) Then
374 NIconAtSmoke = New Icon(Path.Combine(dir, "Icons\AtSmoke.ico"))
375 Catch ex As Exception
380 If File.Exists(Path.Combine(dir, "Icons\Refresh.ico")) Then
382 NIconRefresh(0) = New Icon(Path.Combine(dir, "Icons\Refresh.ico"))
383 Catch ex As Exception
386 If File.Exists(Path.Combine(dir, "Icons\Refresh2.ico")) Then
388 NIconRefresh(1) = New Icon(Path.Combine(dir, "Icons\Refresh2.ico"))
389 Catch ex As Exception
392 If File.Exists(Path.Combine(dir, "Icons\Refresh3.ico")) Then
394 NIconRefresh(2) = New Icon(Path.Combine(dir, "Icons\Refresh3.ico"))
395 Catch ex As Exception
398 If File.Exists(Path.Combine(dir, "Icons\Refresh4.ico")) Then
400 NIconRefresh(3) = New Icon(Path.Combine(dir, "Icons\Refresh4.ico"))
401 Catch ex As Exception
405 If File.Exists(Path.Combine(dir, "Icons\Tab.ico")) Then
407 TabIcon = New Icon(Path.Combine(dir, "Icons\Tab.ico"))
408 Catch ex As Exception
412 If File.Exists(Path.Combine(dir, "Icons\MIcon.ico")) Then
414 MainIcon = New Icon(Path.Combine(dir, "Icons\MIcon.ico"))
415 Catch ex As Exception
419 If File.Exists(Path.Combine(dir, "Icons\Reply.ico")) Then
421 ReplyIcon = New Icon(Path.Combine(dir, "Icons\Reply.ico"))
422 Catch ex As Exception
426 If File.Exists(Path.Combine(dir, "Icons\ReplyBlink.ico")) Then
428 ReplyIconBlink = New Icon(Path.Combine(dir, "Icons\ReplyBlink.ico"))
429 Catch ex As Exception
434 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
435 _ignoreConfigSave = True
437 SecurityManager = New InternetSecurityManager(PostBrowser)
439 VerUpMenuItem.Image = shield.Icon
440 If Not My.Application.CommandLineArgs.Count = 0 AndAlso My.Application.CommandLineArgs.Contains("/d") Then TraceFlag = True
442 Me._spaceKeyCanceler = New SpaceKeyCanceler(Me.PostButton)
443 AddHandler Me._spaceKeyCanceler.SpaceCancel, AddressOf spaceKeyCanceler_SpaceCancel
446 System.Diagnostics.FileVersionInfo.GetVersionInfo( _
447 System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion
449 LoadIcons() ' アイコン読み込み
452 _statuses = TabInformations.GetInstance()
455 Me.Icon = MainIcon 'メインフォーム(TweenMain)
456 NotifyIcon1.Icon = NIconAt 'タスクトレイ
457 TabImage.Images.Add(TabIcon) 'タブ見出し
459 SettingDialog.Owner = Me
460 SearchDialog.Owner = Me
470 '<<<<<<<<<設定関連>>>>>>>>>
476 '_username = _cfgCommon.UserName
477 '_password = _cfgCommon.Password
479 NewPostPopMenuItem.Checked = _cfgCommon.NewAllPop
480 Me.NotifyFileMenuItem.Checked = NewPostPopMenuItem.Checked
483 _fntUnread = _cfgLocal.FontUnread
484 _clUnread = _cfgLocal.ColorUnread
485 _fntReaded = _cfgLocal.FontRead
486 _clReaded = _cfgLocal.ColorRead
487 _clFav = _cfgLocal.ColorFav
488 _clOWL = _cfgLocal.ColorOWL
489 _clRetweet = _cfgLocal.ColorRetweet
490 _fntDetail = _cfgLocal.FontDetail
491 _clDetail = _cfgLocal.ColorDetail
492 _clDetailLink = _cfgLocal.ColorDetailLink
493 _clDetailBackcolor = _cfgLocal.ColorDetailBackcolor
494 _clSelf = _cfgLocal.ColorSelf
495 _clAtSelf = _cfgLocal.ColorAtSelf
496 _clTarget = _cfgLocal.ColorTarget
497 _clAtTarget = _cfgLocal.ColorAtTarget
498 _clAtFromTarget = _cfgLocal.ColorAtFromTarget
499 _clAtTo = _cfgLocal.ColorAtTo
500 _clListBackcolor = _cfgLocal.ColorListBackcolor
501 _clInputBackcolor = _cfgLocal.ColorInputBackcolor
502 _clInputFont = _cfgLocal.ColorInputFont
503 _fntInputFont = _cfgLocal.FontInputFont
505 _brsForeColorUnread = New SolidBrush(_clUnread)
506 _brsForeColorReaded = New SolidBrush(_clReaded)
507 _brsForeColorFav = New SolidBrush(_clFav)
508 _brsForeColorOWL = New SolidBrush(_clOWL)
509 _brsForeColorRetweet = New SolidBrush(_clRetweet)
510 _brsBackColorMine = New SolidBrush(_clSelf)
511 _brsBackColorAt = New SolidBrush(_clAtSelf)
512 _brsBackColorYou = New SolidBrush(_clTarget)
513 _brsBackColorAtYou = New SolidBrush(_clAtTarget)
514 _brsBackColorAtFromTarget = New SolidBrush(_clAtFromTarget)
515 _brsBackColorAtTo = New SolidBrush(_clAtTo)
516 '_brsBackColorNone = New SolidBrush(Color.FromKnownColor(KnownColor.Window))
517 _brsBackColorNone = New SolidBrush(_clListBackcolor)
519 ' StringFormatオブジェクトへの事前設定
520 sf.Alignment = StringAlignment.Near
521 sf.LineAlignment = StringAlignment.Near
522 sfTab.Alignment = StringAlignment.Center
523 sfTab.LineAlignment = StringAlignment.Center
526 'SettingDialog.UserID = _cfgCommon.UserName 'ユーザ名
527 'SettingDialog.PasswordStr = _cfgCommon.Password 'パスワード
528 SettingDialog.IsOAuth = _cfgCommon.IsOAuth
529 HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl
530 HttpTwitter.TwitterSearchUrl = _cfgCommon.TwitterSearchUrl
531 SettingDialog.TwitterApiUrl = _cfgCommon.TwitterUrl
532 SettingDialog.TwitterSearchApiUrl = _cfgCommon.TwitterSearchUrl
534 If _cfgCommon.IsOAuth Then
535 If _cfgCommon.Token = "" Then _cfgCommon.UserName = ""
536 tw.Initialize(_cfgCommon.Token, _cfgCommon.TokenSecret, _cfgCommon.UserName)
538 tw.Initialize(_cfgCommon.UserName, _cfgCommon.Password)
542 SettingDialog.TimelinePeriodInt = _cfgCommon.TimelinePeriod
543 SettingDialog.ReplyPeriodInt = _cfgCommon.ReplyPeriod
544 SettingDialog.DMPeriodInt = _cfgCommon.DMPeriod
545 SettingDialog.PubSearchPeriodInt = _cfgCommon.PubSearchPeriod
546 'SettingDialog.NextPageThreshold = _cfgCommon.NextPageThreshold
547 'SettingDialog.NextPagesInt = _cfgCommon.NextPages
548 SettingDialog.MaxPostNum = _cfgCommon.MaxPostNum
550 If Not My.Application.CommandLineArgs.Contains("nolimit") Then
551 If SettingDialog.TimelinePeriodInt < 30 AndAlso SettingDialog.TimelinePeriodInt > 0 Then SettingDialog.TimelinePeriodInt = 30
552 If SettingDialog.ReplyPeriodInt < 30 AndAlso SettingDialog.ReplyPeriodInt > 0 Then SettingDialog.ReplyPeriodInt = 30
553 If SettingDialog.DMPeriodInt < 30 AndAlso SettingDialog.DMPeriodInt > 0 Then SettingDialog.DMPeriodInt = 30
554 If SettingDialog.PubSearchPeriodInt < 30 AndAlso SettingDialog.PubSearchPeriodInt > 0 Then SettingDialog.PubSearchPeriodInt = 30
557 'SettingDialog.ReadPages = _cfgCommon.ReadPages
558 'SettingDialog.ReadPagesReply = _cfgCommon.ReadPagesReply
559 'SettingDialog.ReadPagesDM = _cfgCommon.ReadPagesDM
561 '起動時読み込み分を既読にするか。Trueなら既読として処理
562 SettingDialog.Readed = _cfgCommon.Read
563 '新着取得時のリストスクロールをするか。Trueならスクロールしない
564 ListLockMenuItem.Checked = _cfgCommon.ListLock
565 Me.LockListFileMenuItem.Checked = _cfgCommon.ListLock
566 SettingDialog.IconSz = _cfgCommon.IconSize
568 SettingDialog.Status = _cfgLocal.StatusText
570 SettingDialog.UnreadManage = _cfgCommon.UnreadManage
572 SettingDialog.PlaySound = _cfgCommon.PlaySound
573 PlaySoundMenuItem.Checked = SettingDialog.PlaySound
574 Me.PlaySoundFileMenuItem.Checked = SettingDialog.PlaySound
576 SettingDialog.OneWayLove = _cfgCommon.OneWayLove
578 SettingDialog.FontUnread = _fntUnread
579 SettingDialog.ColorUnread = _clUnread
580 SettingDialog.FontReaded = _fntReaded
581 SettingDialog.ColorReaded = _clReaded
582 SettingDialog.ColorFav = _clFav
583 SettingDialog.ColorOWL = _clOWL
584 SettingDialog.ColorRetweet = _clRetweet
585 SettingDialog.FontDetail = _fntDetail
586 SettingDialog.ColorDetail = _clDetail
587 SettingDialog.ColorDetailLink = _clDetailLink
588 SettingDialog.ColorDetailBackcolor = _clDetailBackcolor
589 SettingDialog.ColorSelf = _clSelf
590 SettingDialog.ColorAtSelf = _clAtSelf
591 SettingDialog.ColorTarget = _clTarget
592 SettingDialog.ColorAtTarget = _clAtTarget
593 SettingDialog.ColorAtFromTarget = _clAtFromTarget
594 SettingDialog.ColorAtTo = _clAtTo
595 SettingDialog.ColorListBackcolor = _clListBackcolor
596 SettingDialog.ColorInputBackcolor = _clInputBackcolor
597 SettingDialog.ColorInputFont = _clInputFont
598 SettingDialog.FontInputFont = _fntInputFont
600 SettingDialog.NameBalloon = _cfgCommon.NameBalloon
601 SettingDialog.PostCtrlEnter = _cfgCommon.PostCtrlEnter
602 'SettingDialog.UseAPI = _cfgCommon.UseApi
603 SettingDialog.CountApi = _cfgCommon.CountApi
604 SettingDialog.CountApiReply = _cfgCommon.CountApiReply
605 SettingDialog.UsePostMethod = False
606 SettingDialog.BrowserPath = _cfgLocal.BrowserPath
607 'SettingDialog.CheckReply = _cfgCommon.CheckReply
608 SettingDialog.PostAndGet = _cfgCommon.PostAndGet
609 SettingDialog.UseRecommendStatus = _cfgLocal.UseRecommendStatus
610 SettingDialog.DispUsername = _cfgCommon.DispUsername
611 SettingDialog.CloseToExit = _cfgCommon.CloseToExit
612 SettingDialog.MinimizeToTray = _cfgCommon.MinimizeToTray
613 SettingDialog.DispLatestPost = _cfgCommon.DispLatestPost
614 SettingDialog.SortOrderLock = _cfgCommon.SortOrderLock
615 SettingDialog.TinyUrlResolve = _cfgCommon.TinyUrlResolve
617 SettingDialog.SelectedProxyType = _cfgLocal.ProxyType
618 SettingDialog.ProxyAddress = _cfgLocal.ProxyAddress
619 SettingDialog.ProxyPort = _cfgLocal.ProxyPort
620 SettingDialog.ProxyUser = _cfgLocal.ProxyUser
621 SettingDialog.ProxyPassword = _cfgLocal.ProxyPassword
623 SettingDialog.PeriodAdjust = _cfgCommon.PeriodAdjust
624 SettingDialog.StartupVersion = _cfgCommon.StartupVersion
625 'SettingDialog.StartupKey = _cfgCommon.StartupKey
626 SettingDialog.StartupFollowers = _cfgCommon.StartupFollowers
627 'SettingDialog.StartupAPImodeNoWarning = _cfgCommon.StartupApiModeNoWarning
628 SettingDialog.RestrictFavCheck = _cfgCommon.RestrictFavCheck
629 SettingDialog.AlwaysTop = _cfgCommon.AlwaysTop
630 SettingDialog.UrlConvertAuto = _cfgCommon.UrlConvertAuto
632 SettingDialog.OutputzEnabled = _cfgCommon.Outputz
633 SettingDialog.OutputzKey = _cfgCommon.OutputzKey
634 SettingDialog.OutputzUrlmode = _cfgCommon.OutputzUrlMode
636 SettingDialog.UseUnreadStyle = _cfgCommon.UseUnreadStyle
637 SettingDialog.DefaultTimeOut = _cfgCommon.DefaultTimeOut
638 SettingDialog.ProtectNotInclude = _cfgCommon.ProtectNotInclude
639 SettingDialog.PlaySound = _cfgCommon.PlaySound
640 SettingDialog.DateTimeFormat = _cfgCommon.DateTimeFormat
641 SettingDialog.LimitBalloon = _cfgCommon.LimitBalloon
642 SettingDialog.AutoShortUrlFirst = _cfgCommon.AutoShortUrlFirst
643 SettingDialog.TabIconDisp = _cfgCommon.TabIconDisp
644 SettingDialog.ReplyIconState = _cfgCommon.ReplyIconState
645 SettingDialog.ReadOwnPost = _cfgCommon.ReadOwnPost
646 SettingDialog.GetFav = _cfgCommon.GetFav
647 SettingDialog.ReadOldPosts = _cfgCommon.ReadOldPosts
648 SettingDialog.UseSsl = _cfgCommon.UseSsl
649 SettingDialog.BitlyUser = _cfgCommon.BilyUser
650 SettingDialog.BitlyPwd = _cfgCommon.BitlyPwd
651 SettingDialog.ShowGrid = _cfgCommon.ShowGrid
652 SettingDialog.Language = _cfgCommon.Language
653 SettingDialog.UseAtIdSupplement = _cfgCommon.UseAtIdSupplement
654 SettingDialog.UseHashSupplement = _cfgCommon.UseHashSupplement
655 AtIdSupl = New AtIdSupplement(SettingAtIdList.Load().AtIdList, "@")
657 SettingDialog.IsMonospace = _cfgCommon.IsMonospace
658 If SettingDialog.IsMonospace Then
659 detailHtmlFormatHeader = detailHtmlFormatMono1
660 detailHtmlFormatFooter = detailHtmlFormatMono7
662 detailHtmlFormatHeader = detailHtmlFormat1
663 detailHtmlFormatFooter = detailHtmlFormat7
665 detailHtmlFormatHeader += _fntDetail.Name + detailHtmlFormat2 + _fntDetail.Size.ToString() + detailHtmlFormat3 + _clDetail.R.ToString + "," + _clDetail.G.ToString + "," + _clDetail.B.ToString + detailHtmlFormat4 + _clDetailLink.R.ToString + "," + _clDetailLink.G.ToString + "," + _clDetailLink.B.ToString + detailHtmlFormat5 + _clDetailBackcolor.R.ToString + "," + _clDetailBackcolor.G.ToString + "," + _clDetailBackcolor.B.ToString
666 If SettingDialog.IsMonospace Then
667 detailHtmlFormatHeader += detailHtmlFormatMono6
669 detailHtmlFormatHeader += detailHtmlFormat6
671 Me.IdeographicSpaceToSpaceToolStripMenuItem.Checked = _cfgCommon.WideSpaceConvert
673 Dim statregex As New Regex("^0*")
674 SettingDialog.RecommendStatusText = " [TWNv" + statregex.Replace(fileVersion.Replace(".", ""), "") + "]"
678 If DateTime.Now.ToString(SettingDialog.DateTimeFormat).Length = 0 Then
680 ' 変換が成功した場合にLengthが0にならない
681 SettingDialog.DateTimeFormat = "yyyy/MM/dd H:mm:ss"
683 Catch ex As FormatException
684 ' FormatExceptionが発生したら初期値を設定 (=yyyy/MM/dd H:mm:ssとみなされる)
685 SettingDialog.DateTimeFormat = "yyyy/MM/dd H:mm:ss"
688 SettingDialog.Nicoms = _cfgCommon.Nicoms
690 HashSupl = New AtIdSupplement(_cfgCommon.HashTags, "#")
691 HashMgr = New HashtagManage(HashSupl, _
692 _cfgCommon.HashTags.ToArray, _
693 _cfgCommon.HashSelected, _
694 _cfgCommon.HashIsPermanent, _
695 _cfgCommon.HashIsHead)
696 If HashMgr.UseHash <> "" AndAlso HashMgr.IsPermanent Then HashStripSplitButton.Text = HashMgr.UseHash
700 'ユーザー名、パスワードが未設定なら設定画面を表示(初回起動時など)
701 If tw.Username = "" Then
702 '設定せずにキャンセルされた場合はプログラム終了
703 If SettingDialog.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
704 Application.Exit() '強制終了
707 '設定されたが、依然ユーザー名とパスワードが未設定ならプログラム終了
708 If tw.Username = "" Then
709 Application.Exit() '強制終了
714 _fntUnread = SettingDialog.FontUnread
715 _clUnread = SettingDialog.ColorUnread
716 _fntReaded = SettingDialog.FontReaded
717 _clReaded = SettingDialog.ColorReaded
718 _clFav = SettingDialog.ColorFav
719 _clOWL = SettingDialog.ColorOWL
720 _clRetweet = SettingDialog.ColorRetweet
721 _fntDetail = SettingDialog.FontDetail
722 _clDetail = SettingDialog.ColorDetail
723 _clDetailLink = SettingDialog.ColorDetailLink
724 _clDetailBackcolor = SettingDialog.ColorDetailBackcolor
725 _clSelf = SettingDialog.ColorSelf
726 _clAtSelf = SettingDialog.ColorAtSelf
727 _clTarget = SettingDialog.ColorTarget
728 _clAtTarget = SettingDialog.ColorAtTarget
729 _clAtFromTarget = SettingDialog.ColorAtFromTarget
730 _clAtTo = SettingDialog.ColorAtTo
731 _clListBackcolor = SettingDialog.ColorListBackcolor
732 _clInputBackcolor = SettingDialog.ColorInputBackcolor
733 _clInputFont = SettingDialog.ColorInputFont
734 _fntInputFont = SettingDialog.FontInputFont
735 _brsForeColorUnread.Dispose()
736 _brsForeColorReaded.Dispose()
737 _brsForeColorFav.Dispose()
738 _brsForeColorOWL.Dispose()
739 _brsForeColorRetweet.Dispose()
740 _brsForeColorUnread = New SolidBrush(_clUnread)
741 _brsForeColorReaded = New SolidBrush(_clReaded)
742 _brsForeColorFav = New SolidBrush(_clFav)
743 _brsForeColorOWL = New SolidBrush(_clOWL)
744 _brsForeColorRetweet = New SolidBrush(_clRetweet)
745 _brsBackColorMine.Dispose()
746 _brsBackColorAt.Dispose()
747 _brsBackColorYou.Dispose()
748 _brsBackColorAtYou.Dispose()
749 _brsBackColorAtFromTarget.Dispose()
750 _brsBackColorAtTo.Dispose()
751 _brsBackColorNone.Dispose()
752 _brsBackColorMine = New SolidBrush(_clSelf)
753 _brsBackColorAt = New SolidBrush(_clAtSelf)
754 _brsBackColorYou = New SolidBrush(_clTarget)
755 _brsBackColorAtYou = New SolidBrush(_clAtTarget)
756 _brsBackColorAtFromTarget = New SolidBrush(_clAtFromTarget)
757 _brsBackColorAtTo = New SolidBrush(_clAtTo)
758 _brsBackColorNone = New SolidBrush(_clListBackcolor)
760 If SettingDialog.IsMonospace Then
761 detailHtmlFormatHeader = detailHtmlFormatMono1
762 detailHtmlFormatFooter = detailHtmlFormatMono7
764 detailHtmlFormatHeader = detailHtmlFormat1
765 detailHtmlFormatFooter = detailHtmlFormat7
767 detailHtmlFormatHeader += _fntDetail.Name + detailHtmlFormat2 + _fntDetail.Size.ToString() + detailHtmlFormat3 + _clDetail.R.ToString + "," + _clDetail.G.ToString + "," + _clDetail.B.ToString + detailHtmlFormat4 + _clDetailLink.R.ToString + "," + _clDetailLink.G.ToString + "," + _clDetailLink.B.ToString + detailHtmlFormat5 + _clDetailBackcolor.R.ToString + "," + _clDetailBackcolor.G.ToString + "," + _clDetailBackcolor.B.ToString
768 If SettingDialog.IsMonospace Then
769 detailHtmlFormatHeader += detailHtmlFormatMono6
771 detailHtmlFormatHeader += detailHtmlFormat6
773 '他の設定項目は、随時設定画面で保持している値を読み出して使用
777 'Twitter.Username = SettingDialog.UserID
778 'Twitter.Password = SettingDialog.PasswordStr
779 HttpConnection.InitializeConnection(SettingDialog.DefaultTimeOut, _
780 SettingDialog.SelectedProxyType, _
781 SettingDialog.ProxyAddress, _
782 SettingDialog.ProxyPort, _
783 SettingDialog.ProxyUser, _
784 SettingDialog.ProxyPassword)
785 'Twitter.SelectedProxyType = SettingDialog.SelectedProxyType
786 'Twitter.ProxyAddress = SettingDialog.ProxyAddress
787 'Twitter.ProxyPort = SettingDialog.ProxyPort
788 'Twitter.ProxyUser = SettingDialog.ProxyUser
789 'Twitter.ProxyPassword = SettingDialog.ProxyPassword
790 'Twitter.NextThreshold = SettingDialog.NextPageThreshold '次頁取得閾値
791 'Twitter.NextPages = SettingDialog.NextPagesInt '閾値オーバー時の読み込みページ数(未使用)
792 'Twitter.DefaultTimeOut = SettingDialog.DefaultTimeOut
793 tw.CountApi = SettingDialog.CountApi
794 tw.CountApiReply = SettingDialog.CountApiReply
795 'Twitter.UseAPI = SettingDialog.UseAPI
796 'Twitter.UsePostMethod = False
797 tw.RestrictFavCheck = SettingDialog.RestrictFavCheck
798 tw.ReadOwnPost = SettingDialog.ReadOwnPost
799 tw.UseSsl = SettingDialog.UseSsl
800 tw.BitlyId = SettingDialog.BitlyUser
801 tw.BitlyKey = SettingDialog.BitlyPwd
802 HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl
803 HttpTwitter.TwitterSearchUrl = _cfgCommon.TwitterSearchUrl
804 'If IsNetworkAvailable() Then
805 ' If SettingDialog.StartupFollowers Then
806 ' '_waitFollower = True
807 ' GetTimeline(WORKERTYPE.Follower, 0, 0, "")
810 Outputz.Key = SettingDialog.OutputzKey
811 Outputz.Enabled = SettingDialog.OutputzEnabled
812 Select Case SettingDialog.OutputzUrlmode
813 Case OutputzUrlmode.twittercom
814 Outputz.OutUrl = "http://twitter.com/"
815 Case OutputzUrlmode.twittercomWithUsername
816 Outputz.OutUrl = "http://twitter.com/" + tw.Username
820 Me.ClientSize = _cfgLocal.FormSize
821 _mySize = _cfgLocal.FormSize 'サイズ保持(最小化・最大化されたまま終了した場合の対応用)
822 _myLoc = _cfgLocal.FormLocation
824 If Me.WindowState <> FormWindowState.Minimized Then
825 Me.DesktopLocation = _cfgLocal.FormLocation
826 Dim tbarRect As New Rectangle(Me.Location, New Size(_mySize.Width, SystemInformation.CaptionHeight))
827 Dim outOfScreen As Boolean = True
828 If Screen.AllScreens.Length = 1 Then 'ハングするとの報告
829 For Each scr As Screen In Screen.AllScreens
830 If Not Rectangle.Intersect(tbarRect, scr.Bounds).IsEmpty Then
836 Me.DesktopLocation = New Point(0, 0)
837 _myLoc = Me.DesktopLocation
841 Me.TopMost = SettingDialog.AlwaysTop
842 _mySpDis = _cfgLocal.SplitterDistance
843 _mySpDis2 = _cfgLocal.StatusTextHeight
844 MultiLineMenuItem.Checked = _cfgLocal.StatusMultiline
845 'Me.Tween_ClientSizeChanged(Me, Nothing)
846 PlaySoundMenuItem.Checked = SettingDialog.PlaySound
847 Me.PlaySoundFileMenuItem.Checked = SettingDialog.PlaySound
849 StatusText.Font = _fntInputFont
850 StatusText.ForeColor = _clInputFont
852 '全新着通知のチェック状態により、Reply&DMの新着通知有効無効切り替え(タブ別設定にするため削除予定)
853 If SettingDialog.UnreadManage = False Then
854 ReadedStripMenuItem.Enabled = False
855 UnreadStripMenuItem.Enabled = False
860 TimerTimeline.Interval = 1000
861 'If SettingDialog.TimelinePeriodInt > 0 Then
862 ' TimerTimeline.Interval = SettingDialog.TimelinePeriodInt * 1000
864 ' TimerTimeline.Interval = 600000
867 'If SettingDialog.ReplyPeriodInt > 0 Then
868 ' TimerReply.Interval = SettingDialog.ReplyPeriodInt * 1000
870 ' TimerReply.Interval = 6000000
873 'If SettingDialog.DMPeriodInt > 0 Then
874 ' TimerDM.Interval = SettingDialog.DMPeriodInt * 1000
876 ' TimerDM.Interval = 6000000
879 TimerRefreshIcon.Interval = 85
880 TimerRefreshIcon.Enabled = True
883 StatusLabel.Text = ""
884 StatusLabel.AutoToolTip = False
885 StatusLabel.ToolTipText = ""
887 lblLen.Text = GetRestStatusCount(True, False).ToString()
889 'If SettingDialog.StartupKey Then
890 ' Twitter.GetWedata()
893 ''''''''''''''''''''''''''''''''''''''''
894 _statuses.SortOrder = DirectCast(_cfgCommon.SortOrder, System.Windows.Forms.SortOrder)
895 Dim mode As IdComparerClass.ComparerMode
896 Select Case _cfgCommon.SortColumn
897 Case 0, 5, 6 '0:アイコン,5:未読マーク,6:プロテクト・フィルターマーク
899 mode = IdComparerClass.ComparerMode.Id 'Idソートに読み替え
901 mode = IdComparerClass.ComparerMode.Nickname
903 mode = IdComparerClass.ComparerMode.Data
905 mode = IdComparerClass.ComparerMode.Id
907 mode = IdComparerClass.ComparerMode.Name
909 mode = IdComparerClass.ComparerMode.Source
911 _statuses.SortMode = mode
912 ''''''''''''''''''''''''''''''''''''''''
914 Select Case SettingDialog.IconSz
915 Case IconSizes.IconNone
917 Case IconSizes.Icon16
919 Case IconSizes.Icon24
921 Case IconSizes.Icon48
923 Case IconSizes.Icon48_2
931 tw.IconSize = _iconSz
933 tw.TinyUrlResolve = SettingDialog.TinyUrlResolve
935 '発言詳細部アイコンをリストアイコンにサイズ変更
936 Dim sz As Integer = _iconSz
940 TIconSmallList = New ImageList
941 TIconSmallList.ImageSize = New Size(sz, sz)
942 TIconSmallList.ColorDepth = ColorDepth.Depth32Bit
944 TIconDic = New Dictionary(Of String, Image)
946 tw.ListIcon = TIconSmallList
947 tw.DetailIcon = TIconDic
949 StatusLabel.Text = My.Resources.Form1_LoadText1 '画面右下の状態表示を変更
950 StatusLabelUrl.Text = "" '画面左下のリンク先URL表示部を初期化
951 NameLabel.Text = "" '発言詳細部名前ラベル初期化
952 DateTimeLabel.Text = "" '発言詳細部日時ラベル初期化
955 'デフォルトタブの存在チェック、ない場合には追加
956 If _statuses.GetTabByType(TabUsageType.Home) Is Nothing Then
957 If Not _statuses.Tabs.ContainsKey(DEFAULTTAB.RECENT) Then
958 _statuses.AddTab(DEFAULTTAB.RECENT, TabUsageType.Home)
960 _statuses.Tabs(DEFAULTTAB.RECENT).TabType = TabUsageType.Home
963 If _statuses.GetTabByType(TabUsageType.Mentions) Is Nothing Then
964 If Not _statuses.Tabs.ContainsKey(DEFAULTTAB.REPLY) Then
965 _statuses.AddTab(DEFAULTTAB.REPLY, TabUsageType.Mentions)
967 _statuses.Tabs(DEFAULTTAB.REPLY).TabType = TabUsageType.Mentions
970 If _statuses.GetTabByType(TabUsageType.DirectMessage) Is Nothing Then
971 If Not _statuses.Tabs.ContainsKey(DEFAULTTAB.DM) Then
972 _statuses.AddTab(DEFAULTTAB.DM, TabUsageType.DirectMessage)
974 _statuses.Tabs(DEFAULTTAB.DM).TabType = TabUsageType.DirectMessage
977 If _statuses.GetTabByType(TabUsageType.Favorites) Is Nothing Then
978 If Not _statuses.Tabs.ContainsKey(DEFAULTTAB.FAV) Then
979 _statuses.AddTab(DEFAULTTAB.FAV, TabUsageType.Favorites)
981 _statuses.Tabs(DEFAULTTAB.FAV).TabType = TabUsageType.Favorites
984 For Each tn As String In _statuses.Tabs.Keys
985 If _statuses.Tabs(tn).TabType = TabUsageType.Undefined Then
986 _statuses.Tabs(tn).TabType = TabUsageType.UserDefined
988 If Not AddNewTab(tn, True, _statuses.Tabs(tn).TabType) Then Throw New Exception("タブ作成エラー")
991 Me.JumpReadOpMenuItem.ShortcutKeyDisplayString = "Space"
992 CopySTOTMenuItem.ShortcutKeyDisplayString = "Ctrl+C"
993 CopyURLMenuItem.ShortcutKeyDisplayString = "Ctrl+Shift+C"
994 'MenuItemSubSearch.ShortcutKeyDisplayString = "/"
995 'ReadedStripMenuItem.ShortcutKeyDisplayString = "B"
996 'UnreadStripMenuItem.ShortcutKeyDisplayString = "Shift+B"
998 If SettingDialog.MinimizeToTray = False OrElse Me.WindowState <> FormWindowState.Minimized Then
1001 _curTab = ListTab.SelectedTab
1003 _curList = DirectCast(_curTab.Tag, DetailsListView)
1004 SetMainWindowTitle()
1007 If SettingDialog.TabIconDisp Then
1008 ListTab.DrawMode = TabDrawMode.Normal
1010 ListTab.DrawMode = TabDrawMode.OwnerDrawFixed
1011 AddHandler ListTab.DrawItem, AddressOf ListTab_DrawItem
1012 ListTab.ImageList = Nothing
1015 TimerColorize.Interval = 200
1016 TimerColorize.Start()
1017 _ignoreConfigSave = False
1018 SaveConfigsAll(False)
1019 Me.TweenMain_Resize(Nothing, Nothing)
1022 Private Sub spaceKeyCanceler_SpaceCancel(ByVal sender As Object, ByVal e As EventArgs)
1023 JumpUnreadMenuItem_Click(Nothing, Nothing)
1026 Private Sub ListTab_DrawItem( _
1027 ByVal sender As Object, ByVal e As DrawItemEventArgs)
1030 txt = ListTab.TabPages(e.Index).Text
1031 Catch ex As Exception
1035 e.Graphics.FillRectangle(System.Drawing.SystemBrushes.Control, e.Bounds)
1036 If e.State = DrawItemState.Selected Then
1037 e.DrawFocusRectangle()
1041 If _statuses.Tabs(txt).UnreadCount > 0 Then
1044 fore = System.Drawing.SystemBrushes.ControlText
1046 Catch ex As Exception
1047 fore = System.Drawing.SystemBrushes.ControlText
1049 e.Graphics.DrawString(txt, e.Font, fore, e.Bounds, sfTab)
1052 Private Function LoadOldConfig() As Boolean
1053 Dim needToSave As Boolean = False
1054 _cfgCommon = SettingCommon.Load()
1055 _cfgLocal = SettingLocal.Load()
1056 If _cfgCommon.TabList.Count > 0 Then
1057 For Each tabName As String In _cfgCommon.TabList
1058 _statuses.Tabs.Add(tabName, SettingTab.Load(tabName).Tab)
1059 If tabName <> ReplaceInvalidFilename(tabName) Then
1060 Dim tb As TabClass = _statuses.Tabs(tabName)
1061 _statuses.RemoveTab(tabName)
1062 tb.TabName = ReplaceInvalidFilename(tabName)
1063 _statuses.Tabs.Add(ReplaceInvalidFilename(tabName), tb)
1064 Dim tabSetting As New SettingTab
1071 _statuses.AddTab(DEFAULTTAB.RECENT, TabUsageType.Home)
1072 _statuses.AddTab(DEFAULTTAB.REPLY, TabUsageType.Mentions)
1073 _statuses.AddTab(DEFAULTTAB.DM, TabUsageType.DirectMessage)
1074 _statuses.AddTab(DEFAULTTAB.FAV, TabUsageType.Favorites)
1077 _cfgCommon.TabList.Clear()
1078 For Each tabName As String In _statuses.Tabs.Keys
1079 _cfgCommon.TabList.Add(tabName)
1084 If System.IO.File.Exists(SettingCommon.GetSettingFilePath("")) Then
1091 Private Sub LoadConfig()
1092 Dim needToSave As Boolean = False
1093 _cfgCommon = SettingCommon.Load()
1094 _cfgLocal = SettingLocal.Load()
1095 Dim tabs As List(Of TabClass) = SettingTabs.Load().Tabs
1096 For Each tb As TabClass In tabs
1097 _statuses.Tabs.Add(tb.TabName, tb)
1099 If _statuses.Tabs.Count = 0 Then
1100 _statuses.AddTab(DEFAULTTAB.RECENT, TabUsageType.Home)
1101 _statuses.AddTab(DEFAULTTAB.REPLY, TabUsageType.Mentions)
1102 _statuses.AddTab(DEFAULTTAB.DM, TabUsageType.DirectMessage)
1103 _statuses.AddTab(DEFAULTTAB.FAV, TabUsageType.Favorites)
1107 Private Sub ConvertConfig()
1109 If System.IO.File.Exists(SettingTabs.GetSettingFilePath("")) Then
1113 If LoadOldConfig() Then Exit Sub
1115 '_cfg = SettingToConfig.Load()
1116 'If _cfg Is Nothing Then Exit Sub
1119 ''新しくエントリを増設する場合はここに書く必要はない
1120 '_cfgCommon.AlwaysTop = _cfg.AlwaysTop
1121 '_cfgCommon.AutoShortUrlFirst = _cfg.AutoShortUrlFirst
1122 '_cfgLocal.BrowserPath = _cfg.BrowserPath
1123 '_cfgCommon.CheckReply = _cfg.CheckReply
1124 '_cfgCommon.CloseToExit = _cfg.CloseToExit
1125 '_cfgLocal.ColorAtFromTarget = _cfg.ColorAtFromTarget
1126 '_cfgLocal.ColorAtSelf = _cfg.ColorAtSelf
1127 '_cfgLocal.ColorAtTarget = _cfg.ColorAtTarget
1128 '_cfgLocal.ColorFav = _cfg.ColorFav
1129 '_cfgLocal.ColorOWL = _cfg.ColorOWL
1130 '_cfgLocal.ColorRead = _cfg.ColorRead
1131 '_cfgLocal.ColorSelf = _cfg.ColorSelf
1132 '_cfgLocal.ColorTarget = _cfg.ColorTarget
1133 '_cfgLocal.ColorUnread = _cfg.ColorUnread
1134 '_cfgLocal.ColorInputBackcolor = _cfg.ColorInputBackcolor
1135 '_cfgLocal.ColorInputFont = _cfg.ColorInputFont
1136 '_cfgCommon.CountApi = _cfg.CountApi
1137 '_cfgCommon.CultureCode = _cfg.cultureCode
1138 '_cfgCommon.DateTimeFormat = _cfg.DateTimeFormat
1139 '_cfgCommon.DefaultTimeOut = _cfg.DefaultTimeOut
1140 '_cfgCommon.DispLatestPost = _cfg.DispLatestPost
1141 '_cfgLocal.DisplayIndex1 = _cfg.DisplayIndex1
1142 '_cfgLocal.DisplayIndex2 = _cfg.DisplayIndex2
1143 '_cfgLocal.DisplayIndex3 = _cfg.DisplayIndex3
1144 '_cfgLocal.DisplayIndex4 = _cfg.DisplayIndex4
1145 '_cfgLocal.DisplayIndex5 = _cfg.DisplayIndex5
1146 '_cfgLocal.DisplayIndex6 = _cfg.DisplayIndex6
1147 '_cfgLocal.DisplayIndex7 = _cfg.DisplayIndex7
1148 '_cfgLocal.DisplayIndex8 = _cfg.DisplayIndex8
1149 '_cfgCommon.DispUsername = _cfg.DispUsername
1150 '_cfgCommon.DMPeriod = _cfg.DMPeriod
1151 '_cfgLocal.FontDetail = _cfg.FontDetail
1152 '_cfgLocal.FontRead = _cfg.FontRead
1153 '_cfgLocal.FontUnread = _cfg.FontUnread
1154 '_cfgLocal.FontInputFont = _cfg.FontInputFont
1155 '_cfgLocal.FormLocation = _cfg.FormLocation
1156 '_cfgLocal.FormSize = _cfg.FormSize
1157 '_cfgCommon.HubServer = _cfg.HubServer
1158 '_cfgCommon.IconSize = _cfg.IconSize
1159 '_cfgCommon.LimitBalloon = _cfg.LimitBalloon
1160 '_cfgCommon.ListLock = _cfg.ListLock
1161 '_cfgCommon.MaxPostNum = _cfg.MaxPostNum
1162 '_cfgCommon.MinimizeToTray = _cfg.MinimizeToTray
1163 '_cfgCommon.NameBalloon = _cfg.NameBalloon
1164 '_cfgCommon.NewAllPop = _cfg.NewAllPop
1165 '_cfgCommon.NextPages = _cfg.NextPages
1166 '_cfgCommon.NextPageThreshold = _cfg.NextPageThreshold
1167 '_cfgCommon.OneWayLove = _cfg.OneWayLove
1168 '_cfgCommon.Outputz = _cfg.Outputz
1169 '_cfgCommon.OutputzKey = _cfg.OutputzKey
1170 '_cfgCommon.OutputzUrlMode = _cfg.OutputzUrlmode
1171 '_cfgCommon.Password = _cfg.Password
1172 '_cfgCommon.PeriodAdjust = _cfg.PeriodAdjust
1173 '_cfgCommon.PlaySound = _cfg.PlaySound
1174 '_cfgCommon.PostAndGet = _cfg.PostAndGet
1175 '_cfgCommon.PostCtrlEnter = _cfg.PostCtrlEnter
1176 '_cfgCommon.ProtectNotInclude = _cfg.ProtectNotInclude
1177 '_cfgLocal.ProxyAddress = _cfg.ProxyAddress
1178 '_cfgLocal.ProxyPassword = _cfg.ProxyPassword
1179 '_cfgLocal.ProxyPort = _cfg.ProxyPort
1180 '_cfgLocal.ProxyType = _cfg.ProxyType
1181 '_cfgLocal.ProxyUser = _cfg.ProxyUser
1182 '_cfgCommon.Read = _cfg.Read
1183 '_cfgCommon.ReadPages = _cfg.ReadPages
1184 '_cfgCommon.ReadPagesDM = _cfg.ReadPagesDM
1185 '_cfgCommon.ReadPagesReply = _cfg.ReadPagesReply
1186 '_cfgCommon.RestrictFavCheck = _cfg.RestrictFavCheck
1187 '_cfgCommon.SortColumn = _cfg.SortColumn
1188 '_cfgCommon.SortOrder = _cfg.SortOrder
1189 '_cfgCommon.SortOrderLock = _cfg.SortOrderLock
1190 '_cfgLocal.SplitterDistance = _cfg.SplitterDistance
1191 '_cfgCommon.StartupFollowers = _cfg.StartupFollowers
1192 '_cfgCommon.StartupKey = _cfg.StartupKey
1193 '_cfgCommon.StartupVersion = _cfg.StartupVersion
1194 '_cfgCommon.StartupApiModeNoWarning = _cfg.StartupAPImodeNoWarning
1195 '_cfgLocal.StatusMultiline = _cfg.StatusMultiline
1196 '_cfgLocal.StatusText = _cfg.StatusText
1197 '_cfgLocal.StatusTextHeight = _cfg.StatusTextHeight
1199 'For Each item As KeyValuePair(Of String, TabClass) In _cfg.Tabs
1200 ' Dim tabSetting As New SettingTab
1201 ' item.Value.TabName = ReplaceInvalidFilename(item.Value.TabName)
1202 ' tabSetting.Tab = item.Value
1204 ' _cfgCommon.TabList.Add(ReplaceInvalidFilename(item.Key))
1205 ' If Not _statuses.Tabs.ContainsKey(tabSetting.Tab.TabName) Then
1206 ' _statuses.Tabs.Add(tabSetting.Tab.TabName, tabSetting.Tab)
1207 ' ElseIf tabSetting.Tab.TabName = DEFAULTTAB.REPLY Then
1208 ' _statuses.Tabs(DEFAULTTAB.REPLY) = tabSetting.Tab
1211 '_cfgCommon.TimelinePeriod = _cfg.TimelinePeriod
1212 '_cfgCommon.TinyUrlResolve = _cfg.TinyURLResolve
1213 '_cfgCommon.UnreadManage = _cfg.UnreadManage
1214 '_cfgCommon.UrlConvertAuto = _cfg.UrlConvertAuto
1215 '_cfgCommon.UseApi = _cfg.UseAPI
1216 '_cfgCommon.UsePostMethod = _cfg.UsePostMethod
1217 '_cfgLocal.UseRecommendStatus = _cfg.UseRecommendStatus
1218 '_cfgCommon.UserName = _cfg.UserName
1219 '_cfgCommon.UseUnreadStyle = _cfg.UseUnreadStyle
1220 '_cfgLocal.Width1 = _cfg.Width1
1221 '_cfgLocal.Width2 = _cfg.Width2
1222 '_cfgLocal.Width3 = _cfg.Width3
1223 '_cfgLocal.Width4 = _cfg.Width4
1224 '_cfgLocal.Width5 = _cfg.Width5
1225 '_cfgLocal.Width6 = _cfg.Width6
1226 '_cfgLocal.Width7 = _cfg.Width7
1227 '_cfgLocal.Width8 = _cfg.Width8
1233 'Private Sub Network_NetworkAvailabilityChanged(ByVal sender As Object, ByVal e As Devices.NetworkAvailableEventArgs)
1234 ' If e.IsNetworkAvailable Then
1235 ' Dim args As New GetWorkerArg()
1236 ' PostButton.Enabled = True
1237 ' FavAddToolStripMenuItem.Enabled = True
1238 ' FavRemoveToolStripMenuItem.Enabled = True
1239 ' MoveToHomeToolStripMenuItem.Enabled = True
1240 ' MoveToRTHomeMenuItem.Enabled = True
1241 ' MoveToFavToolStripMenuItem.Enabled = True
1242 ' DeleteStripMenuItem.Enabled = True
1243 ' RefreshStripMenuItem.Enabled = True
1244 ' _myStatusOnline = True
1245 ' If Not _initial Then
1246 ' 'If SettingDialog.DMPeriodInt > 0 Then TimerDM.Enabled = True
1247 ' 'If SettingDialog.TimelinePeriodInt > 0 Then TimerTimeline.Enabled = True
1248 ' 'If SettingDialog.ReplyPeriodInt > 0 Then TimerReply.Enabled = True
1250 ' GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, 0, "")
1253 ' _myStatusOnline = False
1254 ' PostButton.Enabled = False
1255 ' FavAddToolStripMenuItem.Enabled = False
1256 ' FavRemoveToolStripMenuItem.Enabled = False
1257 ' MoveToHomeToolStripMenuItem.Enabled = False
1258 ' MoveToRTHomeMenuItem.Enabled = False
1259 ' MoveToFavToolStripMenuItem.Enabled = False
1260 ' DeleteStripMenuItem.Enabled = False
1261 ' RefreshStripMenuItem.Enabled = False
1265 Private Sub TimerTimeline_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerTimeline.Tick
1266 If _homeCounter > 0 Then _homeCounter -= 1
1267 If _mentionCounter > 0 Then _mentionCounter -= 1
1268 If _dmCounter > 0 Then _dmCounter -= 1
1269 If _pubSearchCounter > 0 Then _pubSearchCounter -= 1
1271 If _homeCounter <= 0 AndAlso SettingDialog.TimelinePeriodInt > 0 Then
1272 GetTimeline(WORKERTYPE.Timeline, 1, 0, "")
1274 If _mentionCounter <= 0 AndAlso SettingDialog.ReplyPeriodInt > 0 Then
1275 GetTimeline(WORKERTYPE.Reply, 1, 0, "")
1277 If _dmCounter <= 0 AndAlso SettingDialog.DMPeriodInt > 0 Then
1278 GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, 0, "")
1280 If _pubSearchCounter <= 0 AndAlso SettingDialog.PubSearchPeriodInt > 0 Then
1281 _pubSearchCounter = SettingDialog.PubSearchPeriodInt
1282 GetTimeline(WORKERTYPE.PublicSearch, 1, 0, "")
1286 Private Sub RefreshTimeline()
1288 Dim smode As Integer = -1 '-1:制御しない,-2:最新へ,その他:topitem使用
1289 Dim topId As Long = GetScrollPos(smode)
1290 Dim befCnt As Integer = _curList.VirtualListSize
1293 Dim selId As New Dictionary(Of String, Long())
1294 Dim focusedId As New Dictionary(Of String, Long)
1295 SaveSelectedStatus(selId, focusedId)
1298 Dim notifyPosts() As PostClass = Nothing
1299 Dim soundFile As String = ""
1300 Dim addCount As Integer = 0
1301 addCount = _statuses.SubmitUpdate(soundFile, notifyPosts)
1303 If _endingFlag Then Exit Sub
1307 For Each tab As TabPage In ListTab.TabPages
1308 Dim lst As DetailsListView = DirectCast(tab.Tag, DetailsListView)
1309 Dim tabInfo As TabClass = _statuses.Tabs(tab.Text)
1311 If lst.VirtualListSize <> tabInfo.AllCount Then
1312 If lst.Equals(_curList) Then
1313 _itemCache = Nothing
1314 _postCache = Nothing
1316 lst.VirtualListSize = tabInfo.AllCount 'リスト件数更新
1317 Me.SelectListItem(lst, _
1318 _statuses.IndexOf(tab.Text, selId(tab.Text)), _
1319 _statuses.IndexOf(tab.Text, focusedId(tab.Text)))
1322 If tabInfo.UnreadCount > 0 Then
1323 If SettingDialog.TabIconDisp Then
1324 If tab.ImageIndex = -1 Then tab.ImageIndex = 0 'タブアイコン
1328 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
1329 Catch ex As Exception
1330 'ex.Data("Msg") = "Ref1, UseAPI=" + SettingDialog.UseAPI.ToString
1336 If befCnt <> _curList.VirtualListSize Then
1340 _curList.EnsureVisible(0)
1343 _curList.EnsureVisible(_curList.VirtualListSize - 1)
1348 If _curList.VirtualListSize > 0 Then
1349 _curList.EnsureVisible(_curList.VirtualListSize - 1)
1350 _curList.EnsureVisible(_statuses.IndexOf(_curTab.Text, topId))
1354 Catch ex As Exception
1355 ex.Data("Msg") = "Ref2"
1360 NotifyNewPosts(notifyPosts, soundFile, addCount)
1362 SetMainWindowTitle()
1363 If Not StatusLabelUrl.Text.StartsWith("http") Then SetStatusLabel()
1365 HashSupl.AddRangeItem(tw.GetHashList)
1369 Private Function GetScrollPos(ByRef smode As Integer) As Long
1370 Dim topId As Long = -1
1371 If _curList IsNot Nothing AndAlso _curTab IsNot Nothing AndAlso _curList.VirtualListSize > 0 Then
1372 If _statuses.SortMode = IdComparerClass.ComparerMode.Id Then
1373 If _statuses.SortOrder = SortOrder.Ascending Then
1375 If ListLockMenuItem.Checked Then
1379 topId = _statuses.GetId(_curTab.Text, _curList.TopItem.Index)
1382 '最下行が表示されていたら、最下行へ強制スクロール。最下行が表示されていなかったら制御しない
1383 Dim _item As ListViewItem
1384 _item = _curList.GetItemAt(0, _curList.ClientSize.Height - 1) '一番下
1385 If _item Is Nothing Then _item = _curList.Items(_curList.Items.Count - 1)
1386 If _item.Index = _curList.Items.Count - 1 Then
1390 topId = _statuses.GetId(_curTab.Text, _curList.TopItem.Index)
1396 If ListLockMenuItem.Checked Then
1398 topId = _statuses.GetId(_curTab.Text, _curList.TopItem.Index)
1401 '最上行が表示されていたら、制御しない。最上行が表示されていなかったら、現在表示位置へ強制スクロール
1402 Dim _item As ListViewItem
1404 _item = _curList.GetItemAt(0, 10) '一番上
1405 If _item Is Nothing Then _item = _curList.Items(0)
1406 If _item.Index = 0 Then
1409 topId = _statuses.GetId(_curTab.Text, _curList.TopItem.Index)
1416 topId = _statuses.GetId(_curTab.Text, _curList.TopItem.Index)
1425 Private Sub SaveSelectedStatus(ByVal selId As Dictionary(Of String, Long()), ByVal focusedId As Dictionary(Of String, Long))
1426 If _endingFlag Then Exit Sub
1427 For Each tab As TabPage In ListTab.TabPages
1428 Dim lst As DetailsListView = DirectCast(tab.Tag, DetailsListView)
1429 If lst.SelectedIndices.Count > 0 AndAlso lst.SelectedIndices.Count < 31 Then
1430 selId.Add(tab.Text, _statuses.GetId(tab.Text, lst.SelectedIndices))
1432 selId.Add(tab.Text, New Long(0) {-1})
1434 If lst.FocusedItem IsNot Nothing Then
1435 focusedId.Add(tab.Text, _statuses.GetId(tab.Text, lst.FocusedItem.Index))
1437 focusedId.Add(tab.Text, -1)
1443 Private Sub NotifyNewPosts(ByVal notifyPosts() As PostClass, ByVal soundFile As String, ByVal addCount As Integer)
1446 NewPostPopMenuItem.Checked AndAlso _
1447 notifyPosts IsNot Nothing AndAlso _
1448 notifyPosts.Length > 0 AndAlso _
1449 Not _initial AndAlso _
1452 SettingDialog.LimitBalloon AndAlso _
1454 Me.WindowState = FormWindowState.Minimized OrElse _
1455 Not Me.Visible OrElse _
1456 Form.ActiveForm Is Nothing _
1459 Not SettingDialog.LimitBalloon _
1462 Not IsScreenSaverRunning() Then
1463 Dim sb As New StringBuilder
1464 Dim reply As Boolean = False
1465 Dim dm As Boolean = False
1466 For Each post As PostClass In notifyPosts
1467 If post.IsReply Then reply = True
1468 If post.IsDm Then dm = True
1469 If sb.Length > 0 Then sb.Append(System.Environment.NewLine)
1470 Select Case SettingDialog.NameBalloon
1471 Case NameBalloonEnum.UserID
1472 sb.Append(post.Name).Append(" : ")
1473 Case NameBalloonEnum.NickName
1474 sb.Append(post.Nickname).Append(" : ")
1476 sb.Append(post.Data)
1478 If SettingDialog.DispUsername Then NotifyIcon1.BalloonTipTitle = tw.Username + " - " Else NotifyIcon1.BalloonTipTitle = ""
1480 NotifyIcon1.BalloonTipIcon = ToolTipIcon.Warning
1481 NotifyIcon1.BalloonTipTitle += "Tween [DM] " + My.Resources.RefreshDirectMessageText1 + " " + addCount.ToString() + My.Resources.RefreshDirectMessageText2
1483 NotifyIcon1.BalloonTipIcon = ToolTipIcon.Warning
1484 NotifyIcon1.BalloonTipTitle += "Tween [Reply!] " + My.Resources.RefreshTimelineText1 + " " + addCount.ToString() + My.Resources.RefreshTimelineText2
1486 NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info
1487 NotifyIcon1.BalloonTipTitle += "Tween " + My.Resources.RefreshTimelineText1 + " " + addCount.ToString() + My.Resources.RefreshTimelineText2
1489 Dim bText As String = sb.ToString
1490 If String.IsNullOrEmpty(bText) Then Exit Sub
1491 NotifyIcon1.BalloonTipText = sb.ToString()
1492 NotifyIcon1.ShowBalloonTip(500)
1496 If Not _initial AndAlso SettingDialog.PlaySound AndAlso soundFile <> "" Then
1498 Dim dir As String = My.Application.Info.DirectoryPath
1499 If Directory.Exists(Path.Combine(dir, "Sounds")) Then
1500 dir = Path.Combine(dir, "Sounds")
1502 My.Computer.Audio.Play(Path.Combine(dir, soundFile), AudioPlayMode.Background)
1503 Catch ex As Exception
1509 'Private Sub Mylist_Scrolled(ByVal sender As Object, ByVal e As System.EventArgs)
1510 ' 'TimerColorize.Stop()
1511 ' 'TimerColorize.Start()
1514 Private Sub MyList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
1515 If _curList.SelectedIndices.Count <> 1 Then Exit Sub
1516 'If _curList.SelectedIndices.Count = 0 Then Exit Sub
1518 _curItemIndex = _curList.SelectedIndices(0)
1519 'If _curPost Is GetCurTabPost(_curItemIndex) Then Exit Sub 'refreshで既読化されるのを防ぐため追加
1520 _curPost = GetCurTabPost(_curItemIndex)
1521 If SettingDialog.UnreadManage Then _statuses.SetRead(True, _curTab.Text, _curItemIndex)
1522 'MyList.RedrawItems(MyList.SelectedIndices(0), MyList.SelectedIndices(0), False) 'RetrieveVirtualItemが発生することを期待
1524 ChangeCacheStyleRead(True, _curItemIndex, _curTab) '既読へ(フォント、文字色)
1526 'ColorizeList(-1) '全キャッシュ更新(背景色)
1529 TimerColorize.Stop()
1530 TimerColorize.Start()
1534 Private Sub ChangeCacheStyleRead(ByVal Read As Boolean, ByVal Index As Integer, ByVal Tab As TabPage)
1535 'Read:True=既読 False=未読
1536 '未読管理していなかったら既読として扱う
1537 If Not _statuses.Tabs(_curTab.Text).UnreadManage OrElse _
1538 Not SettingDialog.UnreadManage Then Read = True
1541 Dim itm As ListViewItem
1542 Dim post As PostClass
1543 If Tab.Equals(_curTab) AndAlso _itemCache IsNot Nothing AndAlso Index >= _itemCacheIndex AndAlso Index < _itemCacheIndex + _itemCache.Length Then
1544 itm = _itemCache(Index - _itemCacheIndex)
1545 post = _postCache(Index - _itemCacheIndex)
1547 itm = DirectCast(Tab.Tag, DetailsListView).Items(Index)
1548 post = _statuses.Item(Tab.Text, Index)
1551 ChangeItemStyleRead(Read, itm, post, DirectCast(Tab.Tag, DetailsListView))
1554 Private Sub ChangeItemStyleRead(ByVal Read As Boolean, ByVal Item As ListViewItem, ByVal Post As PostClass, ByVal DList As DetailsListView)
1559 Item.SubItems(5).Text = ""
1562 Item.SubItems(5).Text = "★"
1568 ElseIf Post.RetweetedId > 0 Then
1570 ElseIf Post.IsOwl AndAlso (Post.IsDm OrElse SettingDialog.OneWayLove) Then
1572 ElseIf Read OrElse Not SettingDialog.UseUnreadStyle Then
1577 If DList Is Nothing OrElse Item.Index = -1 Then
1579 If SettingDialog.UseUnreadStyle Then
1584 If SettingDialog.UseUnreadStyle Then
1585 DList.ChangeItemFontAndColor(Item.Index, cl, fnt)
1587 DList.ChangeItemForeColor(Item.Index, cl)
1589 'If _itemCache IsNot Nothing Then DList.RedrawItems(_itemCacheIndex, _itemCacheIndex + _itemCache.Length - 1, False)
1593 Private Sub ColorizeList()
1594 'Index:更新対象のListviewItem.Index。Colorを返す。
1595 '-1は全キャッシュ。Colorは返さない(ダミーを戻す)
1596 Dim _post As PostClass
1603 If _itemCache Is Nothing Then Exit Sub
1605 'For cnt As Integer = 0 To _itemCache.Length - 1
1606 ' If Not _postCache(cnt).IsRead AndAlso SettingDialog.UnreadManage AndAlso _statuses.Tabs(_curTab.Text).UnreadManage Then
1607 ' _itemCache(cnt).Font = _fntUnread
1609 ' _itemCache(cnt).Font = _fntReaded
1613 If _post Is Nothing Then Exit Sub
1616 For cnt As Integer = 0 To _itemCache.Length - 1
1617 '_itemCache(cnt).BackColor = JudgeColor(_post, _postCache(cnt))
1618 _curList.ChangeItemBackColor(_itemCacheIndex + cnt, JudgeColor(_post, _postCache(cnt)))
1620 Catch ex As Exception
1624 Private Sub ColorizeList(ByVal Item As ListViewItem, ByVal Index As Integer)
1625 'Index:更新対象のListviewItem.Index。Colorを返す。
1626 '-1は全キャッシュ。Colorは返さない(ダミーを戻す)
1627 Dim _post As PostClass
1634 Dim tPost As PostClass = GetCurTabPost(Index)
1636 'If Not tPost.IsRead AndAlso SettingDialog.UnreadManage AndAlso _statuses.Tabs(_curTab.Text).UnreadManage Then
1637 ' Item.Font = _fntUnread
1639 ' Item.Font = _fntReaded
1642 If _post Is Nothing Then Exit Sub
1644 If Item.Index = -1 Then
1645 Item.BackColor = JudgeColor(_post, tPost)
1647 _curList.ChangeItemBackColor(Item.Index, JudgeColor(_post, tPost))
1651 Private Function JudgeColor(ByVal BasePost As PostClass, ByVal TargetPost As PostClass) As Color
1653 If TargetPost.Id = BasePost.InReplyToId Then
1656 ElseIf TargetPost.IsMe Then
1659 ElseIf TargetPost.Name.Equals(BasePost.Name, StringComparison.OrdinalIgnoreCase) Then
1662 ElseIf TargetPost.IsReply Then
1665 ElseIf BasePost.ReplyToList.Contains(TargetPost.Name.ToLower()) Then
1667 cl = _clAtFromTarget
1668 ElseIf TargetPost.ReplyToList.Contains(BasePost.Name.ToLower()) Then
1673 'cl = System.Drawing.SystemColors.Window
1674 cl = _clListBackcolor
1679 Private Sub PostButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PostButton.Click
1680 If StatusText.Text.Trim.Length = 0 Then
1685 _history(_history.Count - 1) = StatusText.Text.Trim
1687 If SettingDialog.UrlConvertAuto Then
1688 StatusText.SelectionStart = StatusText.Text.Length - 1
1689 UrlConvertAutoToolStripMenuItem_Click(Nothing, Nothing)
1690 ElseIf SettingDialog.Nicoms Then
1691 StatusText.SelectionStart = StatusText.Text.Length - 1
1692 UrlConvert(UrlConverter.Nicoms)
1694 StatusText.SelectionStart = StatusText.Text.Length - 1
1695 Dim args As New GetWorkerArg()
1698 args.type = WORKERTYPE.PostMessage
1699 CheckReplyTo(StatusText.Text)
1702 Dim adjustCount As Integer = 0
1703 Dim tmpStatus As String = StatusText.Text.Trim
1704 If ToolStripMenuItemApiCommandEvasion.Checked Then
1706 Dim regex As New Regex("^[+\-\[\]\s\\.,*/(){}^~|='&%$#""<>?]*(get|g|fav|follow|f|on|off|stop|quit|leave|l|whois|w|nudge|n|stats|invite|track|untrack|tracks|tracking|\*)([+\-\[\]\s\\.,*/(){}^~|='&%$#""<>?]+|$)", RegexOptions.IgnoreCase)
1707 If regex.IsMatch(tmpStatus) AndAlso tmpStatus.EndsWith(" .") = False Then adjustCount += 2
1710 If ToolStripMenuItemUrlMultibyteSplit.Checked Then
1712 Dim regex2 As New Regex("https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:\@&=+\$,%#]+")
1713 adjustCount += regex2.Matches(tmpStatus).Count
1716 If IdeographicSpaceToSpaceToolStripMenuItem.Checked Then
1717 ' 文中の全角スペースを半角スペース2個にする
1718 For i As Integer = 0 To tmpStatus.Length - 1
1719 If tmpStatus.Substring(i, 1) = " " Then adjustCount += 1
1724 Dim isCutOff As Boolean = False
1725 Dim isRemoveFooter As Boolean = My.Computer.Keyboard.ShiftKeyDown
1726 If StatusText.Multiline AndAlso Not SettingDialog.PostCtrlEnter Then
1727 '複数行でEnter投稿の場合、Ctrlも押されていたらフッタ付加しない
1728 isRemoveFooter = My.Computer.Keyboard.CtrlKeyDown
1730 If Not isRemoveFooter AndAlso (StatusText.Text.Contains("RT @") OrElse StatusText.Text.Contains("QT @")) Then
1731 isRemoveFooter = True
1733 If GetRestStatusCount(False, Not isRemoveFooter) - adjustCount < 0 Then
1734 If MessageBox.Show(My.Resources.PostLengthOverMessage1, My.Resources.PostLengthOverMessage2, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.OK Then
1736 If Not SettingDialog.UrlConvertAuto Then UrlConvertAutoToolStripMenuItem_Click(Nothing, Nothing)
1737 If GetRestStatusCount(False, Not isRemoveFooter) - adjustCount < 0 Then
1738 isRemoveFooter = True
1745 Dim footer As String = ""
1746 Dim header As String = ""
1747 If StatusText.Text.StartsWith("D ") OrElse StatusText.Text.StartsWith("d ") Then
1752 If HashMgr.UseHash <> "" Then
1753 If HashMgr.IsHead Then
1754 header = HashMgr.UseHash + " "
1756 footer = " " + HashMgr.UseHash
1759 If Not isRemoveFooter Then
1760 If SettingDialog.UseRecommendStatus Then
1762 footer += SettingDialog.RecommendStatusText
1764 ' テキストボックスに入力されている文字列を使用する
1765 footer += " " + SettingDialog.Status.Trim
1769 args.status = header + StatusText.Text.Trim + footer
1771 If ToolStripMenuItemApiCommandEvasion.Checked Then
1773 Dim regex As New Regex("^[+\-\[\]\s\\.,*/(){}^~|='&%$#""<>?]*(get|g|fav|follow|f|on|off|stop|quit|leave|l|whois|w|nudge|n|stats|invite|track|untrack|tracks|tracking|\*)([+\-\[\]\s\\.,*/(){}^~|='&%$#""<>?]+|$)", RegexOptions.IgnoreCase)
1774 If regex.IsMatch(args.status) AndAlso args.status.EndsWith(" .") = False Then args.status += " ."
1777 If ToolStripMenuItemUrlMultibyteSplit.Checked Then
1779 Dim regex2 As New Regex("https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:\@&=+\$,%#]+")
1780 Dim mc2 As Match = regex2.Match(args.status)
1781 If mc2.Success Then args.status = regex2.Replace(args.status, "$& ")
1784 If IdeographicSpaceToSpaceToolStripMenuItem.Checked Then
1785 ' 文中の全角スペースを半角スペース2個にする
1786 args.status = args.status.Replace(" ", " ")
1789 If isCutOff AndAlso args.status.Length > 140 Then
1790 args.status = args.status.Substring(0, 140)
1791 If MessageBox.Show(args.status, "Post or Cancel?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then Exit Sub
1797 If StatusText.Text.StartsWith("Google:") AndAlso StatusText.Text.Trim.Length > 7 Then
1798 Dim tmp As String = String.Format(My.Resources.SearchItem2Url, HttpUtility.UrlEncode(StatusText.Text.Substring(7)))
1802 DirectCast(ListTab.SelectedTab.Tag, Control).Focus()
1805 Private Sub EndToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EndToolStripMenuItem.Click, EndFileMenuItem.Click
1810 Private Sub Tween_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
1811 If Not SettingDialog.CloseToExit AndAlso e.CloseReason = CloseReason.UserClosing AndAlso _endingFlag = False Then
1812 '_endingFlag=False:フォームの×ボタン
1816 _ignoreConfigSave = True
1818 TimerTimeline.Enabled = False
1819 'TimerReply.Enabled = False
1820 'TimerDM.Enabled = False
1821 TimerColorize.Enabled = False
1822 TimerRefreshIcon.Enabled = False
1826 Private Sub NotifyIcon1_BalloonTipClicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotifyIcon1.BalloonTipClicked
1828 If Me.WindowState = FormWindowState.Minimized Then
1829 Me.WindowState = FormWindowState.Normal
1834 Private Shared Function CheckAccountValid() As Boolean
1835 Static errorCount As Integer = 0
1836 If Twitter.AccountState <> ACCOUNT_STATE.Valid Then
1838 If errorCount > 5 Then
1840 Twitter.AccountState = ACCOUNT_STATE.Valid
1849 Private Sub GetTimelineWorker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
1850 Dim bw As BackgroundWorker = DirectCast(sender, BackgroundWorker)
1851 If bw.CancellationPending OrElse _endingFlag Then
1856 Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.BelowNormal
1858 My.Application.InitCulture()
1860 Dim ret As String = ""
1861 Dim rslt As New GetWorkerResult()
1863 Dim read As Boolean = Not SettingDialog.UnreadManage
1864 If _initial AndAlso SettingDialog.UnreadManage Then read = SettingDialog.Readed
1866 Dim args As GetWorkerArg = DirectCast(e.Argument, GetWorkerArg)
1868 If Not CheckAccountValid() Then
1869 rslt.retMsg = "Auth error. Check your account"
1870 rslt.type = args.type
1871 rslt.tName = args.tName
1876 If args.type <> WORKERTYPE.OpenUri Then bw.ReportProgress(0, "") 'Notifyアイコンアニメーション開始
1877 Select Case args.type
1878 Case WORKERTYPE.Timeline, WORKERTYPE.Reply
1879 bw.ReportProgress(50, MakeStatusMessage(args, False))
1880 ret = tw.GetTimelineApi(read, args.type, args.page = -1)
1881 'If SettingDialog.UseAPI Then
1882 ' ret = Twitter.GetTimelineApi(read, args.type)
1884 ' ret = Twitter.GetTimeline(args.page, read, args.endPage, args.type, rslt.newDM)
1887 If ret = "" AndAlso args.type = WORKERTYPE.Timeline AndAlso SettingDialog.ReadOldPosts Then
1890 rslt.addCount = _statuses.DistributePosts()
1891 Case WORKERTYPE.DirectMessegeRcv '送信分もまとめて取得
1892 bw.ReportProgress(50, MakeStatusMessage(args, False))
1893 ret = tw.GetDirectMessageApi(read, WORKERTYPE.DirectMessegeRcv, args.page = -1)
1894 If ret = "" Then ret = tw.GetDirectMessageApi(read, WORKERTYPE.DirectMessegeSnt, args.page = -1)
1895 'If SettingDialog.UseAPI Then
1896 ' ret = Twitter.GetDirectMessageApi(read, WORKERTYPE.DirectMessegeRcv)
1897 ' If ret = "" Then ret = Twitter.GetDirectMessageApi(read, WORKERTYPE.DirectMessegeSnt)
1899 ' ret = Twitter.GetDirectMessage(args.page, read, args.endPage, args.type)
1901 rslt.addCount = _statuses.DistributePosts()
1902 Case WORKERTYPE.FavAdd
1904 For i As Integer = 0 To args.ids.Count - 1
1905 Dim post As PostClass = _statuses.Item(args.ids(i))
1907 bw.ReportProgress(50, MakeStatusMessage(args, False))
1908 If Not post.IsFav Then
1909 If post.RetweetedId = 0 Then
1910 ret = tw.PostFavAdd(post.Id)
1912 ret = tw.PostFavAdd(post.RetweetedId)
1914 If ret.Length = 0 Then
1915 args.sIds.Add(post.Id)
1916 post.IsFav = True 'リスト再描画必要
1917 _favTimestamps.Add(Now)
1918 If post.SearchTabName = "" Then
1919 '検索タブからのfavは、favタブへ追加せず
1920 _statuses.GetTabByType(TabUsageType.Favorites).Add(post.Id, post.IsRead, False)
1923 For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.PublicSearch)
1924 If tb.Contains(post.Id) Then tb.Posts(post.Id).IsFav = True
1929 rslt.sIds = args.sIds
1930 Case WORKERTYPE.FavRemove
1932 For i As Integer = 0 To args.ids.Count - 1
1933 Dim post As PostClass = _statuses.Item(args.ids(i))
1935 bw.ReportProgress(50, MakeStatusMessage(args, False))
1937 If post.RetweetedId = 0 Then
1938 ret = tw.PostFavRemove(post.Id)
1940 ret = tw.PostFavRemove(post.RetweetedId)
1942 If ret.Length = 0 Then
1943 args.sIds.Add(post.Id)
1944 post.IsFav = False 'リスト再描画必要
1946 For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.PublicSearch)
1947 If tb.Contains(post.Id) Then tb.Posts(post.Id).IsFav = False
1952 rslt.sIds = args.sIds
1953 Case WORKERTYPE.PostMessage
1954 bw.ReportProgress(200)
1955 For i As Integer = 0 To 1
1956 ret = tw.PostStatus(args.status, _reply_to_id)
1957 If ret = "" OrElse ret = "OK:Delaying?" OrElse ret.StartsWith("Outputz:") Then Exit For
1959 If ret = "" OrElse ret.StartsWith("Outputz") OrElse ret.StartsWith("OK:") Then
1963 bw.ReportProgress(300)
1964 Case WORKERTYPE.Retweet
1965 bw.ReportProgress(200)
1966 ret = tw.PostRetweet(args.ids(0), read)
1967 bw.ReportProgress(300)
1968 Case WORKERTYPE.Follower
1969 bw.ReportProgress(50, My.Resources.UpdateFollowersMenuItem1_ClickText1)
1970 ret = tw.GetFollowersApi()
1971 'If SettingDialog.UseAPI Then
1972 ' ret = Twitter.GetFollowersApi()
1974 ' ret = Twitter.GetFollowers(False) ' Followersリストキャッシュ有効
1976 Case WORKERTYPE.OpenUri
1977 Dim myPath As String = Convert.ToString(args.status)
1980 If SettingDialog.BrowserPath <> "" Then
1981 'Shell(SettingDialog.BrowserPath & " " & myPath)
1982 If SettingDialog.BrowserPath.StartsWith("""") AndAlso SettingDialog.BrowserPath.Length > 2 AndAlso SettingDialog.BrowserPath.IndexOf("""", 2) > -1 Then
1983 Dim sep As Integer = SettingDialog.BrowserPath.IndexOf("""", 2)
1984 Dim browserPath As String = SettingDialog.BrowserPath.Substring(1, sep - 1)
1985 Dim arg As String = ""
1986 If sep < SettingDialog.BrowserPath.Length - 1 Then
1987 arg = SettingDialog.BrowserPath.Substring(sep + 1)
1989 myPath = arg + " " + myPath
1990 System.Diagnostics.Process.Start(browserPath, myPath)
1992 System.Diagnostics.Process.Start(SettingDialog.BrowserPath, myPath)
1995 System.Diagnostics.Process.Start(myPath)
1997 Catch ex As Exception
1998 ' MessageBox.Show("ブラウザの起動に失敗、またはタイムアウトしました。" + ex.ToString())
2000 Case WORKERTYPE.Favorites
2001 bw.ReportProgress(50, MakeStatusMessage(args, False))
2002 ret = tw.GetFavoritesApi(read, args.type)
2003 'If SettingDialog.UseAPI Then
2004 ' ret = Twitter.GetFavoritesApi(read, args.type)
2006 ' ret = Twitter.GetFavorites(args.page, read, args.endPage, args.type, rslt.newDM)
2008 rslt.addCount = _statuses.DistributePosts()
2009 Case WORKERTYPE.PublicSearch
2010 bw.ReportProgress(50, MakeStatusMessage(args, False))
2011 If args.tName = "" Then
2012 For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.PublicSearch)
2013 If tb.SearchWords <> "" Then ret = tw.GetSearch(read, tb, False)
2016 Dim tb As TabClass = _statuses.GetTabByName(args.tName)
2017 If tb IsNot Nothing Then
2018 ret = tw.GetSearch(read, tb, False)
2019 If ret = "" AndAlso args.page = -1 Then
2020 ret = tw.GetSearch(read, tb, True)
2025 rslt.addCount = _statuses.DistributePosts()
2028 If bw.CancellationPending Then
2034 If args.type = WORKERTYPE.FavAdd Then
2035 Dim oneHour As Date = Now.Subtract(New TimeSpan(1, 0, 0))
2036 For i As Integer = _favTimestamps.Count - 1 To 0 Step -1
2037 If _favTimestamps(i).CompareTo(oneHour) < 0 Then
2038 _favTimestamps.RemoveAt(i)
2042 If args.type = WORKERTYPE.Timeline AndAlso Not _initial Then
2043 SyncLock _syncObject
2044 Dim tm As Date = Now
2045 If _tlTimestamps.ContainsKey(tm) Then
2046 _tlTimestamps(tm) += rslt.addCount
2048 _tlTimestamps.Add(Now, rslt.addCount)
2050 Dim oneHour As Date = Now.Subtract(New TimeSpan(1, 0, 0))
2051 Dim keys As New List(Of Date)
2053 For Each key As Date In _tlTimestamps.Keys
2054 If key.CompareTo(oneHour) < 0 Then
2057 _tlCount += _tlTimestamps(key)
2060 For Each key As Date In keys
2061 _tlTimestamps.Remove(key)
2068 If args.type <> WORKERTYPE.OpenUri Then bw.ReportProgress(100, MakeStatusMessage(args, True)) 'ステータス書き換え、Notifyアイコンアニメーション開始
2071 rslt.type = args.type
2072 rslt.tName = args.tName
2073 If args.type = WORKERTYPE.DirectMessegeRcv OrElse _
2074 args.type = WORKERTYPE.DirectMessegeSnt OrElse _
2075 args.type = WORKERTYPE.Reply OrElse _
2076 args.type = WORKERTYPE.Timeline OrElse _
2077 args.type = WORKERTYPE.Favorites Then
2078 rslt.page = args.page - 1 '値が正しいか後でチェック。10ページ毎の継続確認
2085 Private Function MakeStatusMessage(ByVal AsyncArg As GetWorkerArg, ByVal Finish As Boolean) As String
2086 Dim smsg As String = ""
2089 Select Case AsyncArg.type
2090 Case WORKERTYPE.Timeline
2091 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText5 + AsyncArg.page.ToString() + My.Resources.GetTimelineWorker_RunWorkerCompletedText6
2092 Case WORKERTYPE.Reply
2093 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText4 + AsyncArg.page.ToString() + My.Resources.GetTimelineWorker_RunWorkerCompletedText6
2094 Case WORKERTYPE.DirectMessegeRcv
2095 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText8 + AsyncArg.page.ToString() + My.Resources.GetTimelineWorker_RunWorkerCompletedText6
2096 'Case WORKERTYPE.DirectMessegeSnt
2097 ' smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText12 + AsyncArg.page.ToString() + My.Resources.GetTimelineWorker_RunWorkerCompletedText6
2098 Case WORKERTYPE.FavAdd
2099 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText15 + AsyncArg.page.ToString() + "/" + AsyncArg.ids.Count.ToString() + _
2100 My.Resources.GetTimelineWorker_RunWorkerCompletedText16 + (AsyncArg.page - AsyncArg.sIds.Count - 1).ToString()
2101 Case WORKERTYPE.FavRemove
2102 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText17 + AsyncArg.page.ToString() + "/" + AsyncArg.ids.Count.ToString() + _
2103 My.Resources.GetTimelineWorker_RunWorkerCompletedText18 + (AsyncArg.page - AsyncArg.sIds.Count - 1).ToString()
2104 Case WORKERTYPE.Favorites
2105 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText19
2106 Case WORKERTYPE.PublicSearch
2107 smsg = "Search refreshing..."
2111 Select Case AsyncArg.type
2112 Case WORKERTYPE.Timeline
2113 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText1
2114 Case WORKERTYPE.Reply
2115 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText9
2116 Case WORKERTYPE.DirectMessegeRcv
2117 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText11
2118 Case WORKERTYPE.DirectMessegeSnt
2119 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText13
2120 Case WORKERTYPE.FavAdd
2122 Case WORKERTYPE.FavRemove
2124 Case WORKERTYPE.Favorites
2125 smsg = My.Resources.GetTimelineWorker_RunWorkerCompletedText20
2126 Case WORKERTYPE.Follower
2127 smsg = My.Resources.UpdateFollowersMenuItem1_ClickText3
2128 Case WORKERTYPE.PublicSearch
2129 smsg = "Search refreshed"
2135 Private Sub GetTimelineWorker_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs)
2136 If _endingFlag Then Exit Sub
2137 If e.ProgressPercentage > 100 Then
2139 If e.ProgressPercentage = 200 Then '開始
2140 StatusLabel.Text = "Posting..."
2141 StatusText.Enabled = False
2142 PostButton.Enabled = False
2143 ReplyStripMenuItem.Enabled = False
2144 DMStripMenuItem.Enabled = False
2146 If e.ProgressPercentage = 300 Then '終了
2147 StatusLabel.Text = My.Resources.PostWorker_RunWorkerCompletedText4
2148 StatusText.Enabled = True
2149 PostButton.Enabled = True
2150 ReplyStripMenuItem.Enabled = True
2151 DMStripMenuItem.Enabled = True
2154 Dim smsg As String = DirectCast(e.UserState, String)
2155 If smsg.Length > 0 Then StatusLabel.Text = smsg
2159 Private Sub GetTimelineWorker_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs)
2161 If _endingFlag OrElse e.Cancelled Then Exit Sub 'キャンセル
2163 IsNetworkAvailable()
2165 'If _myStatusOnline Then
2167 ' If SettingDialog.TimelinePeriodInt > 0 AndAlso Not TimerTimeline.Enabled Then TimerTimeline.Enabled = True
2168 ' If SettingDialog.DMPeriodInt > 0 AndAlso Not TimerDM.Enabled Then TimerDM.Enabled = True
2169 ' If SettingDialog.ReplyPeriodInt > 0 AndAlso Not TimerReply.Enabled Then TimerReply.Enabled = True
2172 If e.Error IsNot Nothing Then
2173 _myStatusError = True
2174 _waitTimeline = False
2178 _waitPubSearch = False
2179 Throw New Exception("BackgroundWorker Exception", e.Error)
2183 Dim rslt As GetWorkerResult = DirectCast(e.Result, GetWorkerResult)
2184 Dim args As New GetWorkerArg()
2186 If rslt.type = WORKERTYPE.OpenUri Then Exit Sub
2189 If rslt.retMsg.Length > 0 Then
2190 _myStatusError = True
2191 StatusLabel.Text = rslt.retMsg
2192 'If Twitter.AccountState = ACCOUNT_STATE.Invalid Then
2194 ' Twitter.AccountState = ACCOUNT_STATE.Validating
2195 ' SettingStripMenuItem_Click(Nothing, Nothing)
2196 ' Twitter.AccountState = ACCOUNT_STATE.Valid
2197 ' Catch ex As Exception
2198 ' Twitter.AccountState = ACCOUNT_STATE.Invalid
2203 If rslt.type = WORKERTYPE.FavRemove Then
2204 DispSelectedPost() ' 詳細画面書き直し
2205 Dim favTabName As String = _statuses.GetTabByType(TabUsageType.Favorites).TabName
2206 For Each i As Long In rslt.sIds
2207 _statuses.RemoveFavPost(i)
2209 If _curTab.Text.Equals(favTabName) Then
2210 _itemCache = Nothing 'キャッシュ破棄
2211 _postCache = Nothing
2215 For Each tp As TabPage In ListTab.TabPages
2216 If tp.Text = favTabName Then
2217 DirectCast(tp.Tag, DetailsListView).VirtualListSize = _statuses.Tabs(favTabName).AllCount
2224 Dim busy As Boolean = False
2225 For Each bw As BackgroundWorker In _bw
2226 If bw IsNot Nothing AndAlso bw.IsBusy Then
2231 If Not busy Then RefreshTimeline() 'background処理なければ、リスト反映
2233 Select Case rslt.type
2234 Case WORKERTYPE.Timeline
2235 _waitTimeline = False
2236 If Not _initial Then
2239 'If Not SettingDialog.UseAPI Then
2240 ' If SettingDialog.PeriodAdjust AndAlso SettingDialog.TimelinePeriodInt > 0 Then
2241 ' If rslt.addCount >= 20 Then
2242 ' _homeCounterAdjuster += 5
2243 ' If SettingDialog.TimelinePeriodInt - _homeCounterAdjuster < 15 Then _homeCounterAdjuster = SettingDialog.TimelinePeriodInt - 15
2244 ' 'Dim itv As Integer = TimerTimeline.Interval
2246 ' 'If itv < 15000 Then itv = 15000
2247 ' 'TimerTimeline.Interval = itv
2249 ' _homeCounterAdjuster -= 1
2250 ' If _homeCounterAdjuster < 0 Then _homeCounterAdjuster = 0
2251 ' 'TimerTimeline.Interval += 1000
2252 ' 'If TimerTimeline.Interval > SettingDialog.TimelinePeriodInt * 1000 Then TimerTimeline.Interval = SettingDialog.TimelinePeriodInt * 1000
2255 ' If rslt.newDM Then
2256 ' GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, 0, "")
2259 ' 'API使用時の取得調整は別途考える(カウント調整?)
2262 Case WORKERTYPE.Reply
2264 If rslt.newDM AndAlso Not _initial Then
2265 GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, 0, "")
2267 Case WORKERTYPE.Favorites
2269 Case WORKERTYPE.DirectMessegeRcv
2271 Case WORKERTYPE.FavAdd, WORKERTYPE.FavRemove
2272 _curList.BeginUpdate()
2273 If rslt.type = WORKERTYPE.FavRemove AndAlso _statuses.Tabs(_curTab.Text).TabType = TabUsageType.Favorites Then
2276 For i As Integer = 0 To rslt.sIds.Count - 1
2277 If _curTab.Text.Equals(rslt.tName) Then
2278 Dim idx As Integer = _statuses.Tabs(rslt.tName).IndexOf(rslt.sIds(i))
2280 Dim post As PostClass = _statuses.Item(rslt.sIds(i))
2281 ChangeCacheStyleRead(post.IsRead, idx, _curTab)
2282 If idx = _curItemIndex Then DispSelectedPost() '選択アイテム再表示
2287 _curList.EndUpdate()
2288 Case WORKERTYPE.PostMessage
2289 urlUndoBuffer = Nothing
2290 UrlUndoToolStripMenuItem.Enabled = False 'Undoをできないように設定
2292 If rslt.retMsg.Length > 0 AndAlso Not rslt.retMsg.StartsWith("Outputz") AndAlso rslt.retMsg <> "OK:Delaying?" Then
2293 StatusLabel.Text = rslt.retMsg
2295 _postTimestamps.Add(Now)
2296 Dim oneHour As Date = Now.Subtract(New TimeSpan(1, 0, 0))
2297 For i As Integer = _postTimestamps.Count - 1 To 0 Step -1
2298 If _postTimestamps(i).CompareTo(oneHour) < 0 Then
2299 _postTimestamps.RemoveAt(i)
2303 If rslt.retMsg.Length > 0 Then StatusLabel.Text = rslt.retMsg 'Outputz失敗時
2305 StatusText.Text = ""
2307 _hisIdx = _history.Count - 1
2308 If Not HashMgr.IsPermanent AndAlso HashMgr.UseHash <> "" Then
2309 HashMgr.ClearHashtag()
2310 Me.HashStripSplitButton.Text = "#[-]"
2312 SetMainWindowTitle()
2314 If rslt.retMsg.Length = 0 AndAlso SettingDialog.PostAndGet Then GetTimeline(WORKERTYPE.Timeline, 1, 0, "")
2315 Case WORKERTYPE.Retweet
2316 If rslt.retMsg.Length > 0 Then
2317 StatusLabel.Text = rslt.retMsg
2319 _postTimestamps.Add(Now)
2320 Dim oneHour As Date = Now.Subtract(New TimeSpan(1, 0, 0))
2321 For i As Integer = _postTimestamps.Count - 1 To 0 Step -1
2322 If _postTimestamps(i).CompareTo(oneHour) < 0 Then
2323 _postTimestamps.RemoveAt(i)
2327 If rslt.retMsg.Length = 0 AndAlso SettingDialog.PostAndGet Then GetTimeline(WORKERTYPE.Timeline, 1, 0, "")
2328 Case WORKERTYPE.Follower
2329 '_waitFollower = False
2330 _itemCache = Nothing
2331 _postCache = Nothing
2333 Case WORKERTYPE.PublicSearch
2334 _waitPubSearch = False
2339 Private Sub GetTimeline(ByVal WkType As WORKERTYPE, ByVal fromPage As Integer, ByVal toPage As Integer, ByVal tabName As String)
2341 If Not IsNetworkAvailable() Then Exit Sub
2343 If WkType = WORKERTYPE.Timeline AndAlso SettingDialog.TimelinePeriodInt > 0 Then
2344 _homeCounter = SettingDialog.TimelinePeriodInt - _homeCounterAdjuster
2346 If WkType = WORKERTYPE.Reply AndAlso SettingDialog.ReplyPeriodInt > 0 Then
2347 _mentionCounter = SettingDialog.ReplyPeriodInt
2349 If WkType = WORKERTYPE.DirectMessegeRcv AndAlso SettingDialog.DMPeriodInt > 0 Then
2350 _dmCounter = SettingDialog.DMPeriodInt
2354 Dim args As New GetWorkerArg
2355 args.page = fromPage
2356 args.endPage = toPage
2358 args.tName = tabName
2360 Static lastTime As New Dictionary(Of WORKERTYPE, DateTime)
2361 If Not lastTime.ContainsKey(WkType) Then lastTime.Add(WkType, New DateTime)
2362 If Now.Subtract(lastTime(WkType)).TotalSeconds > 1 Then
2363 lastTime(WkType) = Now
2367 'Timeline取得モードの場合はReplyも同時に取得
2368 'If Not SettingDialog.UseAPI AndAlso _
2369 ' Not _initial AndAlso _
2370 ' WkType = WORKERTYPE.Timeline AndAlso _
2371 ' SettingDialog.CheckReply Then
2372 ' 'TimerReply.Enabled = False
2373 ' _mentionCounter = SettingDialog.ReplyPeriodInt
2374 ' Dim _args As New GetWorkerArg
2375 ' _args.page = fromPage
2376 ' _args.endPage = toPage
2377 ' _args.type = WORKERTYPE.Reply
2382 Private Function NextPageMessage(ByVal page As Integer) As DialogResult
2383 Dim flashRslt As Integer = Win32Api.FlashWindow(Me.Handle.ToInt32, 1)
2384 Return MessageBox.Show((page * 20).ToString + My.Resources.GetTimelineWorker_RunWorkerCompletedText2, _
2385 My.Resources.GetTimelineWorker_RunWorkerCompletedText3, _
2386 MessageBoxButtons.YesNo, _
2387 MessageBoxIcon.Question)
2390 Private Sub NotifyIcon1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
2391 If e.Button = Windows.Forms.MouseButtons.Left Then
2393 If Me.WindowState = FormWindowState.Minimized Then
2394 Me.WindowState = FormWindowState.Normal
2400 Private Sub MyList_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
2401 MakeReplyOrDirectStatus()
2404 Private Sub FavAddToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FavAddToolStripMenuItem.Click, FavOpMenuItem.Click
2405 If _statuses.Tabs(_curTab.Text).TabType = TabUsageType.DirectMessage OrElse _curList.SelectedIndices.Count = 0 Then Exit Sub
2408 If _curList.SelectedIndices.Count > 1 Then
2409 If MessageBox.Show(My.Resources.FavAddToolStripMenuItem_ClickText1, My.Resources.FavAddToolStripMenuItem_ClickText2, _
2410 MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then
2415 Dim args As New GetWorkerArg
2416 args.ids = New List(Of Long)
2417 args.sIds = New List(Of Long)
2418 args.tName = _curTab.Text
2419 args.type = WORKERTYPE.FavAdd
2420 For Each idx As Integer In _curList.SelectedIndices
2421 Dim post As PostClass = GetCurTabPost(idx)
2422 If Not post.IsFav Then args.ids.Add(post.Id)
2424 If args.ids.Count = 0 Then
2425 StatusLabel.Text = My.Resources.FavAddToolStripMenuItem_ClickText4
2432 Private Sub FavRemoveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FavRemoveToolStripMenuItem.Click, UnFavOpMenuItem.Click
2433 If _statuses.Tabs(_curTab.Text).TabType = TabUsageType.DirectMessage OrElse _curList.SelectedIndices.Count = 0 Then Exit Sub
2435 If _curList.SelectedIndices.Count > 1 Then
2436 If MessageBox.Show(My.Resources.FavRemoveToolStripMenuItem_ClickText1, My.Resources.FavRemoveToolStripMenuItem_ClickText2, _
2437 MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then
2442 Dim args As New GetWorkerArg()
2443 args.ids = New List(Of Long)()
2444 args.sIds = New List(Of Long)()
2445 args.tName = _curTab.Text
2446 args.type = WORKERTYPE.FavRemove
2447 For Each idx As Integer In _curList.SelectedIndices
2448 Dim post As PostClass = GetCurTabPost(idx)
2449 If post.IsFav Then args.ids.Add(post.Id)
2451 If args.ids.Count = 0 Then
2452 StatusLabel.Text = My.Resources.FavRemoveToolStripMenuItem_ClickText4
2459 Private Function GetCurTabPost(ByVal Index As Integer) As PostClass
2460 If _postCache IsNot Nothing AndAlso Index >= _itemCacheIndex AndAlso Index < _itemCacheIndex + _postCache.Length Then
2461 Return _postCache(Index - _itemCacheIndex)
2463 Return _statuses.Item(_curTab.Text, Index)
2468 Private Sub MoveToHomeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MoveToHomeToolStripMenuItem.Click, OpenHomeOpMenuItem.Click
2469 If _curList.SelectedIndices.Count > 0 Then
2470 OpenUriAsync("http://twitter.com/" + GetCurTabPost(_curList.SelectedIndices(0)).Name)
2474 Private Sub MoveToFavToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MoveToFavToolStripMenuItem.Click, OpenFavOpMenuItem.Click
2475 If _curList.SelectedIndices.Count > 0 Then
2476 OpenUriAsync("http://twitter.com/" + GetCurTabPost(_curList.SelectedIndices(0)).Name + "/favorites")
2480 Private Sub Tween_ClientSizeChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.ClientSizeChanged
2481 If Me.WindowState <> FormWindowState.Minimized Then
2482 If Not _initialLayout AndAlso Me.Visible = True Then
2483 If Me.WindowState = FormWindowState.Normal Then
2484 _mySize = Me.ClientSize
2485 _mySpDis = Me.SplitContainer1.SplitterDistance
2486 If StatusText.Multiline Then _mySpDis2 = Me.StatusText.Height
2487 modifySettingLocal = True
2493 Private Sub MyList_ColumnClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs)
2494 If SettingDialog.SortOrderLock Then Exit Sub
2495 Dim mode As IdComparerClass.ComparerMode
2497 mode = IdComparerClass.ComparerMode.Id
2499 Select Case e.Column
2500 Case 0, 5, 6 '0:アイコン,5:未読マーク,6:プロテクト・フィルターマーク
2504 mode = IdComparerClass.ComparerMode.Nickname
2506 mode = IdComparerClass.ComparerMode.Data
2508 mode = IdComparerClass.ComparerMode.Id
2510 mode = IdComparerClass.ComparerMode.Name
2512 mode = IdComparerClass.ComparerMode.Source
2515 _statuses.ToggleSortOrder(mode)
2516 _itemCache = Nothing
2517 _postCache = Nothing
2519 modifySettingCommon = True
2522 Private Sub Tween_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LocationChanged
2523 If Me.WindowState = FormWindowState.Normal AndAlso Not _initialLayout Then
2524 _myLoc = Me.DesktopLocation
2525 modifySettingLocal = True
2529 Private Sub ContextMenuStrip2_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip2.Opening
2530 If ListTab.SelectedTab Is Nothing Then Exit Sub
2531 If _statuses Is Nothing OrElse _statuses.Tabs Is Nothing OrElse Not _statuses.Tabs.ContainsKey(ListTab.SelectedTab.Text) Then Exit Sub
2532 If _statuses.Tabs(ListTab.SelectedTab.Text).TabType = TabUsageType.DirectMessage Then
2533 FavAddToolStripMenuItem.Enabled = False
2534 FavRemoveToolStripMenuItem.Enabled = False
2535 StatusOpenMenuItem.Enabled = False
2536 FavorareMenuItem.Enabled = False
2538 If IsNetworkAvailable() Then
2539 FavAddToolStripMenuItem.Enabled = True
2540 FavRemoveToolStripMenuItem.Enabled = True
2541 StatusOpenMenuItem.Enabled = True
2542 FavorareMenuItem.Enabled = True
2545 If _curPost Is Nothing OrElse _curPost.IsDm Then
2546 ReTweetStripMenuItem.Enabled = False
2547 ReTweetOriginalStripMenuItem.Enabled = False
2548 QuoteStripMenuItem.Enabled = False
2550 ReTweetStripMenuItem.Enabled = True
2551 ReTweetOriginalStripMenuItem.Enabled = True
2552 QuoteStripMenuItem.Enabled = True
2554 If _statuses.Tabs(ListTab.SelectedTab.Text).TabType <> TabUsageType.Favorites Then
2555 RefreshMoreStripMenuItem.Enabled = True
2557 RefreshMoreStripMenuItem.Enabled = False
2561 Private Sub ReplyStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReplyStripMenuItem.Click, ReplyOpMenuItem.Click
2562 MakeReplyOrDirectStatus(False, True)
2565 Private Sub DMStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DMStripMenuItem.Click, DmOpMenuItem.Click
2566 MakeReplyOrDirectStatus(False, False)
2569 Private Sub DeleteStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteStripMenuItem.Click, DelOpMenuItem.Click
2570 If _curTab Is Nothing OrElse _curList Is Nothing Then Exit Sub
2571 If _statuses.Tabs(_curTab.Text).TabType <> TabUsageType.DirectMessage Then
2572 Dim myPost As Boolean = False
2573 For Each idx As Integer In _curList.SelectedIndices
2574 If GetCurTabPost(idx).IsMe OrElse _
2575 GetCurTabPost(idx).RetweetedBy.ToLower = tw.Username.ToLower Then
2580 If Not myPost Then Exit Sub
2583 Dim tmp As String = String.Format(My.Resources.DeleteStripMenuItem_ClickText1, Environment.NewLine)
2585 If MessageBox.Show(tmp, My.Resources.DeleteStripMenuItem_ClickText2, _
2586 MessageBoxButtons.OKCancel, _
2587 MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then Exit Sub
2590 If _curList.FocusedItem IsNot Nothing Then
2591 fidx = _curList.FocusedItem.Index
2592 ElseIf _curList.TopItem IsNot Nothing Then
2593 fidx = _curList.TopItem.Index
2599 Me.Cursor = Cursors.WaitCursor
2601 Dim rslt As Boolean = True
2602 For Each Id As Long In _statuses.GetId(_curTab.Text, _curList.SelectedIndices)
2603 Dim rtn As String = ""
2604 If _statuses.Tabs(_curTab.Text).TabType = TabUsageType.DirectMessage Then
2605 rtn = tw.RemoveDirectMessage(Id)
2607 If _statuses.Item(Id).IsMe OrElse _statuses.Item(Id).RetweetedBy.ToLower = tw.Username.ToLower Then
2608 rtn = tw.RemoveStatus(Id)
2613 If rtn.Length > 0 Then
2617 _statuses.RemovePost(Id)
2622 StatusLabel.Text = My.Resources.DeleteStripMenuItem_ClickText3 '失敗
2624 StatusLabel.Text = My.Resources.DeleteStripMenuItem_ClickText4 '成功
2627 _itemCache = Nothing 'キャッシュ破棄
2628 _postCache = Nothing
2631 For Each tb As TabPage In ListTab.TabPages
2632 DirectCast(tb.Tag, DetailsListView).VirtualListSize = _statuses.Tabs(tb.Text).AllCount
2633 If _curTab.Equals(tb) Then
2634 _curList.SelectedIndices.Clear()
2635 If _statuses.Tabs(tb.Text).AllCount > 0 Then
2636 If _statuses.Tabs(tb.Text).AllCount - 1 > fidx AndAlso fidx > -1 Then
2637 _curList.SelectedIndices.Add(fidx)
2639 _curList.SelectedIndices.Add(_statuses.Tabs(tb.Text).AllCount - 1)
2641 If _curList.SelectedIndices.Count > 0 Then
2642 _curList.EnsureVisible(_curList.SelectedIndices(0))
2643 _curList.FocusedItem = _curList.Items(_curList.SelectedIndices(0))
2647 If _statuses.Tabs(tb.Text).UnreadCount = 0 Then
2648 If SettingDialog.TabIconDisp Then
2649 If tb.ImageIndex = 0 Then tb.ImageIndex = -1 'タブアイコン
2653 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
2655 Me.Cursor = Cursors.Default
2659 Private Sub ReadedStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReadedStripMenuItem.Click, ReadOpMenuItem.Click
2660 _curList.BeginUpdate()
2661 If SettingDialog.UnreadManage Then
2662 For Each idx As Integer In _curList.SelectedIndices
2663 _statuses.SetRead(True, _curTab.Text, idx)
2666 For Each idx As Integer In _curList.SelectedIndices
2667 ChangeCacheStyleRead(True, idx, _curTab)
2670 _curList.EndUpdate()
2671 For Each tb As TabPage In ListTab.TabPages
2672 If _statuses.Tabs(tb.Text).UnreadCount = 0 Then
2673 If SettingDialog.TabIconDisp Then
2674 If tb.ImageIndex = 0 Then tb.ImageIndex = -1 'タブアイコン
2678 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
2681 Private Sub UnreadStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnreadStripMenuItem.Click, UnreadOpMenuItem.Click
2682 _curList.BeginUpdate()
2683 If SettingDialog.UnreadManage Then
2684 For Each idx As Integer In _curList.SelectedIndices
2685 _statuses.SetRead(False, _curTab.Text, idx)
2688 For Each idx As Integer In _curList.SelectedIndices
2689 ChangeCacheStyleRead(False, idx, _curTab)
2692 _curList.EndUpdate()
2693 For Each tb As TabPage In ListTab.TabPages
2694 If _statuses.Tabs(tb.Text).UnreadCount > 0 Then
2695 If SettingDialog.TabIconDisp Then
2696 If tb.ImageIndex = -1 Then tb.ImageIndex = 0 'タブアイコン
2700 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
2703 Private Sub RefreshStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshStripMenuItem.Click, RefreshOpMenuItem.Click
2707 Private Sub DoRefresh()
2708 If _curTab IsNot Nothing Then
2709 Select Case _statuses.Tabs(_curTab.Text).TabType
2710 Case TabUsageType.Mentions
2711 GetTimeline(WORKERTYPE.Reply, 1, 0, "")
2712 Case TabUsageType.DirectMessage
2713 GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, 0, "")
2714 Case TabUsageType.Favorites
2715 GetTimeline(WORKERTYPE.Favorites, 1, 0, "")
2716 'Case TabUsageType.Profile
2718 Case TabUsageType.PublicSearch
2720 Dim tb As TabClass = _statuses.Tabs(_curTab.Text)
2721 If tb.SearchWords = "" Then Exit Sub
2722 GetTimeline(WORKERTYPE.PublicSearch, 1, 0, _curTab.Text)
2724 GetTimeline(WORKERTYPE.Timeline, 1, 0, "")
2727 GetTimeline(WORKERTYPE.Timeline, 1, 0, "")
2731 Private Sub DoRefreshMore()
2732 If _curTab IsNot Nothing Then
2733 Select Case _statuses.Tabs(_curTab.Text).TabType
2734 Case TabUsageType.Mentions
2735 GetTimeline(WORKERTYPE.Reply, -1, 0, "")
2736 Case TabUsageType.DirectMessage
2737 GetTimeline(WORKERTYPE.DirectMessegeRcv, -1, 0, "")
2738 Case TabUsageType.Favorites
2739 ' GetTimeline(WORKERTYPE.Favorites, -1, 0, "")
2740 Case TabUsageType.Profile
2742 Case TabUsageType.PublicSearch
2744 Dim tb As TabClass = _statuses.Tabs(_curTab.Text)
2745 If tb.SearchWords = "" Then Exit Sub
2746 GetTimeline(WORKERTYPE.PublicSearch, -1, 0, _curTab.Text)
2748 GetTimeline(WORKERTYPE.Timeline, -1, 0, "")
2751 GetTimeline(WORKERTYPE.Timeline, -1, 0, "")
2755 Private Sub SettingStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SettingStripMenuItem.Click, SettingFileMenuItem.Click
2756 'Dim chgUseApi As Boolean = False
2757 Dim result As DialogResult
2760 result = SettingDialog.ShowDialog()
2761 Catch ex As Exception
2764 If result = Windows.Forms.DialogResult.OK Then
2765 SyncLock _syncObject
2766 'Twitter.Username = SettingDialog.UserID
2767 'Twitter.Password = SettingDialog.PasswordStr
2769 If SettingDialog.TimelinePeriodInt > 0 Then
2770 _homeCounterAdjuster = 0
2771 'If SettingDialog.PeriodAdjust AndAlso Not SettingDialog.UseAPI Then
2772 ' If SettingDialog.TimelinePeriodInt < _homeCounter - _homeCounterAdjuster Then
2773 ' _homeCounter = SettingDialog.TimelinePeriodInt
2774 ' _homeCounterAdjuster = 0
2777 ' _homeCounterAdjuster = 0
2780 Catch ex As Exception
2781 ex.Data("Instance") = "Set Timers"
2782 ex.Data("IsTerminatePermission") = False
2785 'Twitter.NextThreshold = SettingDialog.NextPageThreshold
2786 'Twitter.NextPages = SettingDialog.NextPagesInt
2787 'If Twitter.UseAPI <> SettingDialog.UseAPI AndAlso Not _initial Then
2790 'Twitter.UseAPI = SettingDialog.UseAPI
2791 tw.CountApi = SettingDialog.CountApi
2792 tw.CountApiReply = SettingDialog.CountApiReply
2793 'Twitter.UsePostMethod = False
2794 tw.TinyUrlResolve = SettingDialog.TinyUrlResolve
2795 tw.RestrictFavCheck = SettingDialog.RestrictFavCheck
2796 tw.ReadOwnPost = SettingDialog.ReadOwnPost
2797 tw.UseSsl = SettingDialog.UseSsl
2798 tw.BitlyId = SettingDialog.BitlyUser
2799 tw.BitlyKey = SettingDialog.BitlyPwd
2800 HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl
2801 HttpTwitter.TwitterSearchUrl = _cfgCommon.TwitterSearchUrl
2803 'Twitter.SelectedProxyType = SettingDialog.SelectedProxyType
2804 'Twitter.ProxyAddress = SettingDialog.ProxyAddress
2805 'Twitter.ProxyPort = SettingDialog.ProxyPort
2806 'Twitter.ProxyUser = SettingDialog.ProxyUser
2807 'Twitter.ProxyPassword = SettingDialog.ProxyPassword
2808 HttpConnection.InitializeConnection(SettingDialog.DefaultTimeOut, _
2809 SettingDialog.SelectedProxyType, _
2810 SettingDialog.ProxyAddress, _
2811 SettingDialog.ProxyPort, _
2812 SettingDialog.ProxyUser, _
2813 SettingDialog.ProxyPassword)
2815 If SettingDialog.TabIconDisp Then
2816 RemoveHandler ListTab.DrawItem, AddressOf ListTab_DrawItem
2817 ListTab.DrawMode = TabDrawMode.Normal
2818 ListTab.ImageList = Me.TabImage
2820 RemoveHandler ListTab.DrawItem, AddressOf ListTab_DrawItem
2821 AddHandler ListTab.DrawItem, AddressOf ListTab_DrawItem
2822 ListTab.DrawMode = TabDrawMode.OwnerDrawFixed
2823 ListTab.ImageList = Nothing
2825 Catch ex As Exception
2826 ex.Data("Instance") = "ListTab(TabIconDisp)"
2827 ex.Data("IsTerminatePermission") = False
2832 If Not SettingDialog.UnreadManage Then
2833 ReadedStripMenuItem.Enabled = False
2834 UnreadStripMenuItem.Enabled = False
2835 If SettingDialog.TabIconDisp Then
2836 For Each myTab As TabPage In ListTab.TabPages
2837 myTab.ImageIndex = -1
2841 ReadedStripMenuItem.Enabled = True
2842 UnreadStripMenuItem.Enabled = True
2844 Catch ex As Exception
2845 ex.Data("Instance") = "ListTab(UnreadManage)"
2846 ex.Data("IsTerminatePermission") = False
2851 For Each mytab As TabPage In ListTab.TabPages
2852 Dim lst As DetailsListView = DirectCast(mytab.Tag, DetailsListView)
2853 lst.GridLines = SettingDialog.ShowGrid
2855 Catch ex As Exception
2856 ex.Data("Instance") = "ListTab(ShowGrid)"
2857 ex.Data("IsTerminatePermission") = False
2861 PlaySoundMenuItem.Checked = SettingDialog.PlaySound
2862 Me.PlaySoundFileMenuItem.Checked = SettingDialog.PlaySound
2863 _fntUnread = SettingDialog.FontUnread
2864 _clUnread = SettingDialog.ColorUnread
2865 _fntReaded = SettingDialog.FontReaded
2866 _clReaded = SettingDialog.ColorReaded
2867 _clFav = SettingDialog.ColorFav
2868 _clOWL = SettingDialog.ColorOWL
2869 _clRetweet = SettingDialog.ColorRetweet
2870 _fntDetail = SettingDialog.FontDetail
2871 _clDetail = SettingDialog.ColorDetail
2872 _clDetailLink = SettingDialog.ColorDetailLink
2873 _clDetailBackcolor = SettingDialog.ColorDetailBackcolor
2874 _clSelf = SettingDialog.ColorSelf
2875 _clAtSelf = SettingDialog.ColorAtSelf
2876 _clTarget = SettingDialog.ColorTarget
2877 _clAtTarget = SettingDialog.ColorAtTarget
2878 _clAtFromTarget = SettingDialog.ColorAtFromTarget
2879 _clAtTo = SettingDialog.ColorAtTo
2880 _clListBackcolor = SettingDialog.ColorListBackcolor
2881 _clInputBackcolor = SettingDialog.ColorInputBackcolor
2882 _clInputFont = SettingDialog.ColorInputFont
2883 _fntInputFont = SettingDialog.FontInputFont
2885 If StatusText.Focused Then StatusText.BackColor = _clInputBackcolor
2886 StatusText.Font = _fntInputFont
2887 StatusText.ForeColor = _clInputFont
2888 Catch ex As Exception
2889 MessageBox.Show(ex.Message)
2892 _brsForeColorUnread.Dispose()
2893 _brsForeColorReaded.Dispose()
2894 _brsForeColorFav.Dispose()
2895 _brsForeColorOWL.Dispose()
2896 _brsForeColorRetweet.Dispose()
2897 _brsForeColorUnread = New SolidBrush(_clUnread)
2898 _brsForeColorReaded = New SolidBrush(_clReaded)
2899 _brsForeColorFav = New SolidBrush(_clFav)
2900 _brsForeColorOWL = New SolidBrush(_clOWL)
2901 _brsForeColorRetweet = New SolidBrush(_clRetweet)
2902 _brsBackColorMine.Dispose()
2903 _brsBackColorAt.Dispose()
2904 _brsBackColorYou.Dispose()
2905 _brsBackColorAtYou.Dispose()
2906 _brsBackColorAtFromTarget.Dispose()
2907 _brsBackColorAtTo.Dispose()
2908 _brsBackColorNone.Dispose()
2909 _brsBackColorMine = New SolidBrush(_clSelf)
2910 _brsBackColorAt = New SolidBrush(_clAtSelf)
2911 _brsBackColorYou = New SolidBrush(_clTarget)
2912 _brsBackColorAtYou = New SolidBrush(_clAtTarget)
2913 _brsBackColorAtFromTarget = New SolidBrush(_clAtFromTarget)
2914 _brsBackColorAtTo = New SolidBrush(_clAtTo)
2915 _brsBackColorNone = New SolidBrush(_clListBackcolor)
2917 If SettingDialog.IsMonospace Then
2918 detailHtmlFormatHeader = detailHtmlFormatMono1
2919 detailHtmlFormatFooter = detailHtmlFormatMono7
2921 detailHtmlFormatHeader = detailHtmlFormat1
2922 detailHtmlFormatFooter = detailHtmlFormat7
2924 detailHtmlFormatHeader += _fntDetail.Name + detailHtmlFormat2 + _fntDetail.Size.ToString() + detailHtmlFormat3 + _clDetail.R.ToString + "," + _clDetail.G.ToString + "," + _clDetail.B.ToString + detailHtmlFormat4 + _clDetailLink.R.ToString + "," + _clDetailLink.G.ToString + "," + _clDetailLink.B.ToString + detailHtmlFormat5 + _clDetailBackcolor.R.ToString + "," + _clDetailBackcolor.G.ToString + "," + _clDetailBackcolor.B.ToString
2925 If SettingDialog.IsMonospace Then
2926 detailHtmlFormatHeader += detailHtmlFormatMono6
2928 detailHtmlFormatHeader += detailHtmlFormat6
2930 Catch ex As Exception
2931 ex.Data("Instance") = "Font"
2932 ex.Data("IsTerminatePermission") = False
2936 _statuses.SetUnreadManage(SettingDialog.UnreadManage)
2937 Catch ex As Exception
2938 ex.Data("Instance") = "_statuses"
2939 ex.Data("IsTerminatePermission") = False
2944 For Each tb As TabPage In ListTab.TabPages
2945 If SettingDialog.TabIconDisp Then
2946 If _statuses.Tabs(tb.Text).UnreadCount = 0 Then
2952 If tb.Tag IsNot Nothing AndAlso tb.Controls.Count > 0 Then
2953 DirectCast(tb.Tag, DetailsListView).Font = _fntReaded
2954 DirectCast(tb.Tag, DetailsListView).BackColor = _clListBackcolor
2957 Catch ex As Exception
2958 ex.Data("Instance") = "ListTab(TabIconDisp no2)"
2959 ex.Data("IsTerminatePermission") = False
2962 SetMainWindowTitle()
2965 _itemCache = Nothing
2966 _postCache = Nothing
2967 If _curList IsNot Nothing Then _curList.Refresh()
2970 Outputz.Key = SettingDialog.OutputzKey
2971 Outputz.Enabled = SettingDialog.OutputzEnabled
2972 Select Case SettingDialog.OutputzUrlmode
2973 Case OutputzUrlmode.twittercom
2974 Outputz.OutUrl = "http://twitter.com/"
2975 Case OutputzUrlmode.twittercomWithUsername
2976 Outputz.OutUrl = "http://twitter.com/" + tw.Username
2982 Twitter.AccountState = ACCOUNT_STATE.Valid
2984 Me.TopMost = SettingDialog.AlwaysTop
2985 SaveConfigsAll(False)
2987 'If chgUseApi AndAlso SettingDialog.OneWayLove Then doGetFollowersMenu(False) 'API使用を切り替えたら取り直し
2990 Private Sub PostBrowser_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles PostBrowser.Navigated
2991 If e.Url.AbsoluteUri <> "about:blank" Then
2993 OpenUriAsync(e.Url.OriginalString)
2997 Private Sub PostBrowser_Navigating(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles PostBrowser.Navigating
2998 If e.Url.Scheme = "data" Then
2999 StatusLabelUrl.Text = PostBrowser.StatusText.Replace("&", "&&")
3000 ElseIf e.Url.AbsoluteUri <> "about:blank" Then
3003 If e.Url.AbsoluteUri.StartsWith("http://twitter.com/search?q=%23") OrElse _
3004 e.Url.AbsoluteUri.StartsWith("https://twitter.com/search?q=%23") Then
3006 Dim urlStr As String = HttpUtility.UrlDecode(e.Url.AbsoluteUri)
3007 Dim hash As String = urlStr.Substring(urlStr.IndexOf("#"))
3008 AddNewTabForSearch(hash)
3011 OpenUriAsync(e.Url.OriginalString)
3016 Private Sub AddNewTabForSearch(ByVal searchWord As String)
3017 '同一検索条件のタブが既に存在すれば、そのタブアクティブにして終了
3018 For Each tb As TabClass In _statuses.GetTabsByType(TabUsageType.PublicSearch)
3019 If tb.SearchWords = searchWord AndAlso tb.SearchLang = "" Then
3020 For Each tp As TabPage In ListTab.TabPages
3021 If tb.TabName = tp.Text Then
3022 ListTab.SelectedTab = tp
3029 Dim tabName As String = searchWord
3030 For i As Integer = 0 To 100
3031 If _statuses.ContainsTab(tabName) Then
3038 AddNewTab(tabName, False, TabUsageType.PublicSearch)
3039 _statuses.AddTab(tabName, TabUsageType.PublicSearch)
3041 ListTab.SelectedIndex = ListTab.TabPages.Count - 1
3043 Dim cmb As ComboBox = DirectCast(ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch"), ComboBox)
3044 cmb.Items.Add(searchWord)
3045 cmb.Text = searchWord
3048 Me.SearchButton_Click(ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch"), Nothing)
3051 Public Function AddNewTab(ByVal tabName As String, ByVal startup As Boolean, ByVal tabType As TabUsageType) As Boolean
3053 For Each tb As TabPage In ListTab.TabPages
3054 If tb.Text = tabName Then Return False
3058 If tabName = My.Resources.AddNewTabText1 Then Return False
3059 'If tabName <> ReplaceInvalidFilename(tabName) Then Return False
3063 If tabType = TabUsageType.DirectMessage OrElse _
3064 tabType = TabUsageType.Favorites OrElse _
3065 tabType = TabUsageType.Home OrElse _
3066 tabType = TabUsageType.Mentions Then
3067 If _statuses.GetTabByType(tabType) IsNot Nothing Then Return False
3070 'Dim myTab As New TabStructure()
3072 Dim _tabPage As TabPage = New TabPage
3073 Dim _listCustom As DetailsListView = New DetailsListView
3074 Dim _colHd1 As ColumnHeader = New ColumnHeader() 'アイコン
3075 Dim _colHd2 As ColumnHeader = New ColumnHeader() 'ニックネーム
3076 Dim _colHd3 As ColumnHeader = New ColumnHeader() '本文
3077 Dim _colHd4 As ColumnHeader = New ColumnHeader() '日付
3078 Dim _colHd5 As ColumnHeader = New ColumnHeader() 'ユーザID
3079 Dim _colHd6 As ColumnHeader = New ColumnHeader() '未読
3080 Dim _colHd7 As ColumnHeader = New ColumnHeader() 'マーク&プロテクト
3081 Dim _colHd8 As ColumnHeader = New ColumnHeader() 'ソース
3082 'If Not _iconCol Then
3083 '_colHd2 = New ColumnHeader()
3084 '_colHd3 = New ColumnHeader()
3085 '_colHd4 = New ColumnHeader()
3086 '_colHd5 = New ColumnHeader()
3087 '_colHd6 = New ColumnHeader()
3088 '_colHd7 = New ColumnHeader()
3089 '_colHd8 = New ColumnHeader()
3090 '_colHd9 = New ColumnHeader()
3093 'If Not startup Then _section.ListElement.Add(New ListElement(tabName))
3095 Dim cnt As Integer = ListTab.TabPages.Count
3097 '''ToDo:Create and set controls follow tabtypes
3099 Me.SplitContainer1.Panel1.SuspendLayout()
3100 Me.SplitContainer1.Panel2.SuspendLayout()
3101 Me.SplitContainer1.SuspendLayout()
3102 Me.ListTab.SuspendLayout()
3105 _tabPage.SuspendLayout()
3110 Dim pnl As Panel = Nothing
3111 If tabType = TabUsageType.PublicSearch Then
3114 Dim lbl As New Label
3115 Dim cmb As New ComboBox
3116 Dim btn As New Button
3117 Dim cmbLang As New ComboBox
3122 pnl.Controls.Add(cmb)
3123 pnl.Controls.Add(cmbLang)
3124 pnl.Controls.Add(btn)
3125 pnl.Controls.Add(lbl)
3126 pnl.Name = "panelSearch"
3127 pnl.Dock = DockStyle.Top
3128 pnl.Height = cmb.Height
3129 AddHandler pnl.Enter, AddressOf SearchControls_Enter
3130 AddHandler pnl.Leave, AddressOf SearchControls_Leave
3133 cmb.Anchor = AnchorStyles.Left Or AnchorStyles.Right
3134 cmb.Dock = DockStyle.Fill
3135 cmb.Name = "comboSearch"
3136 cmb.DropDownStyle = ComboBoxStyle.DropDown
3137 cmb.ImeMode = Windows.Forms.ImeMode.NoControl
3139 cmb.AutoCompleteMode = AutoCompleteMode.None
3141 If _statuses.ContainsTab(tabName) Then
3142 cmb.Items.Add(_statuses.Tabs(tabName).SearchWords)
3143 cmb.Text = _statuses.Tabs(tabName).SearchWords
3147 cmbLang.Anchor = AnchorStyles.Left Or AnchorStyles.Right
3148 cmbLang.Dock = DockStyle.Right
3150 cmbLang.Name = "comboLang"
3151 cmbLang.DropDownStyle = ComboBoxStyle.DropDownList
3152 cmbLang.TabStop = False
3153 cmbLang.Items.Add("")
3154 cmbLang.Items.Add("ja")
3155 cmbLang.Items.Add("en")
3156 cmbLang.Items.Add("ar")
3157 cmbLang.Items.Add("da")
3158 cmbLang.Items.Add("nl")
3159 cmbLang.Items.Add("fa")
3160 cmbLang.Items.Add("fi")
3161 cmbLang.Items.Add("fr")
3162 cmbLang.Items.Add("de")
3163 cmbLang.Items.Add("hu")
3164 cmbLang.Items.Add("is")
3165 cmbLang.Items.Add("it")
3166 cmbLang.Items.Add("no")
3167 cmbLang.Items.Add("pl")
3168 cmbLang.Items.Add("pt")
3169 cmbLang.Items.Add("ru")
3170 cmbLang.Items.Add("es")
3171 cmbLang.Items.Add("sv")
3172 cmbLang.Items.Add("th")
3173 If _statuses.ContainsTab(tabName) Then cmbLang.Text = _statuses.Tabs(tabName).SearchLang
3174 'AddHandler cmbLang.Enter, AddressOf SearchControls_Enter
3175 'AddHandler cmbLang.Leave, AddressOf SearchControls_Leave
3177 lbl.Text = "Search(C-S-f)"
3179 lbl.Dock = DockStyle.Left
3181 lbl.Height = cmb.Height
3182 lbl.TextAlign = ContentAlignment.MiddleLeft
3185 btn.Name = "buttonSearch"
3186 btn.UseVisualStyleBackColor = True
3187 btn.Dock = DockStyle.Right
3189 AddHandler btn.Click, AddressOf SearchButton_Click
3190 'AddHandler btn.Enter, AddressOf SearchControls_Enter
3191 'AddHandler btn.Leave, AddressOf SearchControls_Leave
3195 Me.ListTab.Controls.Add(_tabPage)
3196 _tabPage.Controls.Add(_listCustom)
3198 If tabType = TabUsageType.PublicSearch Then _tabPage.Controls.Add(pnl)
3200 _tabPage.Location = New Point(4, 4)
3201 _tabPage.Name = "CTab" + cnt.ToString()
3202 _tabPage.Size = New Size(380, 260)
3203 _tabPage.TabIndex = 2 + cnt
3204 _tabPage.Text = tabName
3205 _tabPage.UseVisualStyleBackColor = True
3207 _listCustom.AllowColumnReorder = True
3208 If Not _iconCol Then
3209 _listCustom.Columns.AddRange(New ColumnHeader() {_colHd1, _colHd2, _colHd3, _colHd4, _colHd5, _colHd6, _colHd7, _colHd8})
3211 _listCustom.Columns.AddRange(New ColumnHeader() {_colHd1, _colHd3})
3213 _listCustom.ContextMenuStrip = Me.ContextMenuStrip2
3214 _listCustom.Dock = DockStyle.Fill
3215 _listCustom.FullRowSelect = True
3216 _listCustom.HideSelection = False
3217 _listCustom.Location = New Point(0, 0)
3218 _listCustom.Margin = New Padding(0)
3219 _listCustom.Name = "CList" + Environment.TickCount.ToString()
3220 _listCustom.ShowItemToolTips = True
3221 _listCustom.Size = New Size(380, 260)
3222 _listCustom.TabIndex = 4 'これ大丈夫?
3223 _listCustom.UseCompatibleStateImageBehavior = False
3224 _listCustom.View = View.Details
3225 _listCustom.OwnerDraw = True
3226 _listCustom.VirtualMode = True
3227 _listCustom.Font = _fntReaded
3228 _listCustom.BackColor = _clListBackcolor
3230 _listCustom.GridLines = SettingDialog.ShowGrid
3232 AddHandler _listCustom.SelectedIndexChanged, AddressOf MyList_SelectedIndexChanged
3233 AddHandler _listCustom.MouseDoubleClick, AddressOf MyList_MouseDoubleClick
3234 AddHandler _listCustom.ColumnClick, AddressOf MyList_ColumnClick
3235 AddHandler _listCustom.DrawColumnHeader, AddressOf MyList_DrawColumnHeader
3239 AddHandler _listCustom.DrawItem, AddressOf MyList_DrawItem
3241 AddHandler _listCustom.DrawItem, AddressOf MyList_DrawItemDefault
3244 'AddHandler _listCustom.Scrolled, AddressOf Mylist_Scrolled
3245 AddHandler _listCustom.MouseClick, AddressOf MyList_MouseClick
3246 AddHandler _listCustom.ColumnReordered, AddressOf MyList_ColumnReordered
3247 AddHandler _listCustom.ColumnWidthChanged, AddressOf MyList_ColumnWidthChanged
3248 AddHandler _listCustom.CacheVirtualItems, AddressOf MyList_CacheVirtualItems
3249 AddHandler _listCustom.RetrieveVirtualItem, AddressOf MyList_RetrieveVirtualItem
3250 AddHandler _listCustom.DrawSubItem, AddressOf MyList_DrawSubItem
3251 'AddHandler _listCustom.KeyDown, AddressOf MyList_KeyDown
3255 'If Not _iconCol Then
3256 _colHd2.Text = My.Resources.AddNewTabText2
3258 _colHd3.Text = My.Resources.AddNewTabText3
3260 _colHd4.Text = My.Resources.AddNewTabText4_2
3261 'If SettingDialog.UseAPI Then
3262 ' _colHd4.Text = My.Resources.AddNewTabText4_2
3264 ' _colHd4.Text = My.Resources.AddNewTabText4
3267 _colHd5.Text = My.Resources.AddNewTabText5
3273 _colHd8.Text = "Source"
3277 If (_statuses.Tabs.ContainsKey(tabName) AndAlso _statuses.Tabs(tabName).TabType = TabUsageType.Mentions) _
3278 OrElse (Not _statuses.IsDefaultTab(tabName) AndAlso tabType <> TabUsageType.PublicSearch) Then
3279 TabDialog.AddTab(tabName)
3282 _listCustom.SmallImageList = TIconSmallList
3283 '_listCustom.ListViewItemSorter = listViewItemSorter
3284 Dim dispOrder(7) As Integer
3286 For i As Integer = 0 To _curList.Columns.Count - 1
3287 For j As Integer = 0 To _curList.Columns.Count - 1
3288 If _curList.Columns(j).DisplayIndex = i Then
3294 For i As Integer = 0 To _curList.Columns.Count - 1
3295 _listCustom.Columns(i).Width = _curList.Columns(i).Width
3296 _listCustom.Columns(dispOrder(i)).DisplayIndex = i
3300 _listCustom.Columns(0).Width = _cfgLocal.Width1
3301 _listCustom.Columns(1).Width = _cfgLocal.Width3
3302 _listCustom.Columns(0).DisplayIndex = 0
3303 _listCustom.Columns(1).DisplayIndex = 1
3305 For i As Integer = 0 To 7
3306 If _cfgLocal.DisplayIndex1 = i Then
3308 ElseIf _cfgLocal.DisplayIndex2 = i Then
3310 ElseIf _cfgLocal.DisplayIndex3 = i Then
3312 ElseIf _cfgLocal.DisplayIndex4 = i Then
3314 ElseIf _cfgLocal.DisplayIndex5 = i Then
3316 ElseIf _cfgLocal.DisplayIndex6 = i Then
3318 ElseIf _cfgLocal.DisplayIndex7 = i Then
3320 ElseIf _cfgLocal.DisplayIndex8 = i Then
3324 _listCustom.Columns(0).Width = _cfgLocal.Width1
3325 _listCustom.Columns(1).Width = _cfgLocal.Width2
3326 _listCustom.Columns(2).Width = _cfgLocal.Width3
3327 _listCustom.Columns(3).Width = _cfgLocal.Width4
3328 _listCustom.Columns(4).Width = _cfgLocal.Width5
3329 _listCustom.Columns(5).Width = _cfgLocal.Width6
3330 _listCustom.Columns(6).Width = _cfgLocal.Width7
3331 _listCustom.Columns(7).Width = _cfgLocal.Width8
3332 For i As Integer = 0 To 7
3333 _listCustom.Columns(dispOrder(i)).DisplayIndex = i
3341 If tabType = TabUsageType.PublicSearch Then pnl.ResumeLayout(False)
3344 _tabPage.ResumeLayout(False)
3346 Me.SplitContainer1.Panel1.ResumeLayout(False)
3347 Me.SplitContainer1.Panel2.ResumeLayout(False)
3348 Me.SplitContainer1.ResumeLayout(False)
3349 Me.ListTab.ResumeLayout(False)
3350 Me.ResumeLayout(False)
3352 _tabPage.Tag = _listCustom
3356 Public Function RemoveSpecifiedTab(ByVal TabName As String) As Boolean
3357 Dim idx As Integer = 0
3358 For idx = 0 To ListTab.TabPages.Count - 1
3359 If ListTab.TabPages(idx).Text = TabName Then Exit For
3362 If _statuses.IsDefaultTab(TabName) Then Return False
3364 Dim tmp As String = String.Format(My.Resources.RemoveSpecifiedTabText1, Environment.NewLine)
3365 If MessageBox.Show(tmp, My.Resources.RemoveSpecifiedTabText2, _
3366 MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then
3370 SetListProperty() '他のタブに列幅等を反映
3372 Dim tabType As TabUsageType = _statuses.Tabs(TabName).TabType
3375 Me.SplitContainer1.Panel1.SuspendLayout()
3376 Me.SplitContainer1.Panel2.SuspendLayout()
3377 Me.SplitContainer1.SuspendLayout()
3378 Me.ListTab.SuspendLayout()
3381 Dim _tabPage As TabPage = ListTab.TabPages(idx)
3382 Dim _listCustom As DetailsListView = DirectCast(_tabPage.Tag, DetailsListView)
3383 _tabPage.Tag = Nothing
3385 _tabPage.SuspendLayout()
3387 Me.ListTab.Controls.Remove(_tabPage)
3389 Dim pnl As Control = Nothing
3390 If tabType = TabUsageType.PublicSearch Then
3391 pnl = _tabPage.Controls("panelSearch")
3392 For Each ctrl As Control In pnl.Controls
3393 If ctrl.Name = "buttonSearch" Then
3394 RemoveHandler ctrl.Click, AddressOf SearchButton_Click
3396 RemoveHandler ctrl.Enter, AddressOf SearchControls_Enter
3397 RemoveHandler ctrl.Leave, AddressOf SearchControls_Leave
3398 pnl.Controls.Remove(ctrl)
3401 _tabPage.Controls.Remove(pnl)
3404 _tabPage.Controls.Remove(_listCustom)
3405 _listCustom.Columns.Clear()
3406 _listCustom.ContextMenuStrip = Nothing
3408 RemoveHandler _listCustom.SelectedIndexChanged, AddressOf MyList_SelectedIndexChanged
3409 RemoveHandler _listCustom.MouseDoubleClick, AddressOf MyList_MouseDoubleClick
3410 RemoveHandler _listCustom.ColumnClick, AddressOf MyList_ColumnClick
3411 RemoveHandler _listCustom.DrawColumnHeader, AddressOf MyList_DrawColumnHeader
3415 RemoveHandler _listCustom.DrawItem, AddressOf MyList_DrawItem
3417 RemoveHandler _listCustom.DrawItem, AddressOf MyList_DrawItemDefault
3420 'RemoveHandler _listCustom.Scrolled, AddressOf Mylist_Scrolled
3421 RemoveHandler _listCustom.MouseClick, AddressOf MyList_MouseClick
3422 RemoveHandler _listCustom.ColumnReordered, AddressOf MyList_ColumnReordered
3423 RemoveHandler _listCustom.ColumnWidthChanged, AddressOf MyList_ColumnWidthChanged
3424 RemoveHandler _listCustom.CacheVirtualItems, AddressOf MyList_CacheVirtualItems
3425 RemoveHandler _listCustom.RetrieveVirtualItem, AddressOf MyList_RetrieveVirtualItem
3426 RemoveHandler _listCustom.DrawSubItem, AddressOf MyList_DrawSubItem
3427 'RemoveHandler _listCustom.KeyDown, AddressOf MyList_KeyDown
3429 TabDialog.RemoveTab(TabName)
3431 _listCustom.SmallImageList = Nothing
3432 _listCustom.ListViewItemSorter = Nothing
3435 If _curTab.Equals(_tabPage) Then
3441 _itemCache = Nothing
3442 _itemCacheIndex = -1
3443 _postCache = Nothing
3445 _tabPage.ResumeLayout(False)
3447 Me.SplitContainer1.Panel1.ResumeLayout(False)
3448 Me.SplitContainer1.Panel2.ResumeLayout(False)
3449 Me.SplitContainer1.ResumeLayout(False)
3450 Me.ListTab.ResumeLayout(False)
3451 Me.ResumeLayout(False)
3455 _listCustom.Dispose()
3456 _statuses.RemoveTab(TabName)
3458 'SaveConfigsCommon()
3459 'SaveConfigsTab(False)
3461 For Each tp As TabPage In ListTab.TabPages
3462 Dim lst As DetailsListView = DirectCast(tp.Tag, DetailsListView)
3463 If lst.VirtualListSize <> _statuses.Tabs(tp.Text).AllCount Then
3464 lst.VirtualListSize = _statuses.Tabs(tp.Text).AllCount
3470 Private Sub ListTab_Deselected(ByVal sender As Object, ByVal e As System.Windows.Forms.TabControlEventArgs) Handles ListTab.Deselected
3471 _itemCache = Nothing
3472 _itemCacheIndex = -1
3473 _postCache = Nothing
3476 Private Sub ListTab_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListTab.MouseMove
3478 Dim cpos As New Point(e.X, e.Y)
3480 If e.Button = Windows.Forms.MouseButtons.Left AndAlso _tabDrag Then
3481 Dim tn As String = ""
3482 For i As Integer = 0 To ListTab.TabPages.Count - 1
3483 Dim rect As Rectangle = ListTab.GetTabRect(i)
3484 If rect.Left <= cpos.X AndAlso cpos.X <= rect.Right AndAlso _
3485 rect.Top <= cpos.Y AndAlso cpos.Y <= rect.Bottom Then
3486 tn = ListTab.TabPages(i).Text
3491 If tn = "" Then Exit Sub
3493 For Each tb As TabPage In ListTab.TabPages
3494 If tb.Text = tn Then
3495 ListTab.DoDragDrop(tb, DragDropEffects.All)
3503 For i As Integer = 0 To ListTab.TabPages.Count - 1
3504 Dim rect As Rectangle = ListTab.GetTabRect(i)
3505 If rect.Left <= cpos.X And cpos.X <= rect.Right And _
3506 rect.Top <= cpos.Y And cpos.Y <= rect.Bottom Then
3507 _rclickTabName = ListTab.TabPages(i).Text
3513 Private Sub ListTab_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListTab.SelectedIndexChanged
3516 SetMainWindowTitle()
3520 Private Sub SetListProperty()
3522 If _curList Is Nothing Then Exit Sub
3523 If Not _isColumnChanged Then Exit Sub
3525 Dim dispOrder(_curList.Columns.Count - 1) As Integer
3526 For i As Integer = 0 To _curList.Columns.Count - 1
3527 For j As Integer = 0 To _curList.Columns.Count - 1
3528 If _curList.Columns(j).DisplayIndex = i Then
3536 For Each tb As TabPage In ListTab.TabPages
3537 If Not tb.Equals(_curTab) Then
3538 If tb.Tag IsNot Nothing AndAlso tb.Controls.Count > 0 Then
3539 Dim lst As DetailsListView = DirectCast(tb.Tag, DetailsListView)
3540 For i As Integer = 0 To lst.Columns.Count - 1
3541 lst.Columns(dispOrder(i)).DisplayIndex = i
3542 lst.Columns(i).Width = _curList.Columns(i).Width
3548 _isColumnChanged = False
3551 Private Sub PostBrowser_StatusTextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles PostBrowser.StatusTextChanged
3552 If PostBrowser.StatusText.StartsWith("http") OrElse PostBrowser.StatusText.StartsWith("ftp") _
3553 OrElse PostBrowser.StatusText.StartsWith("data") Then
3554 StatusLabelUrl.Text = PostBrowser.StatusText.Replace("&", "&&")
3556 If PostBrowser.StatusText = "" Then
3561 Private Sub StatusText_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles StatusText.KeyPress
3562 If e.KeyChar = "@" Then
3563 If Not SettingDialog.UseAtIdSupplement Then Exit Sub
3565 ShowSuplDialog(AtIdSupl)
3567 ElseIf e.KeyChar = "#" Then
3568 If Not SettingDialog.UseHashSupplement Then Exit Sub
3569 ShowSuplDialog(HashSupl)
3574 Private Sub ShowSuplDialog(ByVal dialog As AtIdSupplement)
3576 Me.TopMost = SettingDialog.AlwaysTop
3577 If dialog.inputText <> "" Then
3578 Dim fHalf As String = ""
3579 Dim eHalf As String = ""
3580 Dim selStart As Integer = StatusText.SelectionStart
3581 If selStart > 0 Then
3582 fHalf = StatusText.Text.Substring(0, selStart)
3584 If selStart < StatusText.Text.Length Then
3585 eHalf = StatusText.Text.Substring(selStart)
3587 StatusText.Text = fHalf + dialog.inputText + eHalf
3588 StatusText.SelectionStart = selStart + dialog.inputText.Length
3592 Private Sub StatusText_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles StatusText.KeyUp
3594 If Not e.Alt AndAlso Not e.Control AndAlso Not e.Shift Then
3595 If e.KeyCode = Keys.Space OrElse e.KeyCode = Keys.ProcessKey Then
3596 If StatusText.Text = " " OrElse StatusText.Text = " " Then
3598 StatusText.Text = ""
3599 JumpUnreadMenuItem_Click(Nothing, Nothing)
3603 Me.StatusText_TextChanged(Nothing, Nothing)
3606 Private Sub StatusText_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusText.TextChanged
3608 Dim pLen As Integer = GetRestStatusCount(True, False)
3609 lblLen.Text = pLen.ToString()
3611 StatusText.ForeColor = Color.Red
3613 StatusText.ForeColor = _clInputFont
3615 If StatusText.Text = "" Then
3621 Private Function GetRestStatusCount(ByVal isAuto As Boolean, ByVal isAddFooter As Boolean) As Integer
3623 Dim pLen As Integer = 140 - StatusText.Text.Length
3624 If (isAuto AndAlso Not My.Computer.Keyboard.ShiftKeyDown) OrElse _
3625 (Not isAuto AndAlso isAddFooter) Then
3626 If SettingDialog.UseRecommendStatus Then
3627 pLen -= SettingDialog.RecommendStatusText.Length
3628 ElseIf SettingDialog.Status.Length > 0 Then
3629 pLen -= SettingDialog.Status.Length + 1
3632 If HashMgr.UseHash <> "" Then
3633 pLen -= HashMgr.UseHash.Length + 1
3638 Private Sub MyList_CacheVirtualItems(ByVal sender As System.Object, ByVal e As System.Windows.Forms.CacheVirtualItemsEventArgs)
3639 If _itemCache IsNot Nothing AndAlso _
3640 e.StartIndex >= _itemCacheIndex AndAlso _
3641 e.EndIndex < _itemCacheIndex + _itemCache.Length AndAlso _
3642 _curList.Equals(sender) Then
3643 'If the newly requested cache is a subset of the old cache,
3644 'no need to rebuild everything, so do nothing.
3648 'Now we need to rebuild the cache.
3649 If _curList.Equals(sender) Then CreateCache(e.StartIndex, e.EndIndex)
3652 Private Sub MyList_RetrieveVirtualItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.RetrieveVirtualItemEventArgs)
3653 If _itemCache IsNot Nothing AndAlso e.ItemIndex >= _itemCacheIndex AndAlso e.ItemIndex < _itemCacheIndex + _itemCache.Length AndAlso _curList.Equals(sender) Then
3654 'A cache hit, so get the ListViewItem from the cache instead of making a new one.
3655 e.Item = _itemCache(e.ItemIndex - _itemCacheIndex)
3657 'A cache miss, so create a new ListViewItem and pass it back.
3658 Dim tb As TabPage = DirectCast(DirectCast(sender, Tween.TweenCustomControl.DetailsListView).Parent, TabPage)
3660 e.Item = CreateItem(tb, _
3661 _statuses.Item(tb.Text, e.ItemIndex), _
3663 Catch ex As Exception
3665 Dim sitem() As String = {"", "", "", "", "", "", "", ""}
3666 e.Item = New ListViewItem(sitem, -1)
3671 Private Sub CreateCache(ByVal StartIndex As Integer, ByVal EndIndex As Integer)
3673 'キャッシュ要求(要求範囲±30を作成)
3675 If StartIndex < 0 Then StartIndex = 0
3677 If EndIndex >= _statuses.Tabs(_curTab.Text).AllCount Then EndIndex = _statuses.Tabs(_curTab.Text).AllCount - 1
3678 _postCache = _statuses.Item(_curTab.Text, StartIndex, EndIndex) '配列で取得
3679 _itemCacheIndex = StartIndex
3681 _itemCache = New ListViewItem(_postCache.Length - 1) {}
3682 For i As Integer = 0 To _postCache.Length - 1
3683 _itemCache(i) = CreateItem(_curTab, _postCache(i), StartIndex + i)
3685 Catch ex As Exception
3686 'キャッシュ要求が実データとずれるため(イベントの遅延?)
3687 _postCache = Nothing
3688 _itemCache = Nothing
3692 Private Function CreateItem(ByVal Tab As TabPage, ByVal Post As PostClass, ByVal Index As Integer) As ListViewItem
3693 Dim mk As String = ""
3694 If Post.IsMark Then mk += "♪"
3695 If Post.IsProtect Then mk += "Ю"
3696 If Post.InReplyToId > 0 Then mk += "⇒"
3697 Dim itm As ListViewItem
3698 If Post.RetweetedId = 0 Then
3699 Dim sitem() As String = {"", Post.Nickname, Post.Data, Post.PDate.ToString(SettingDialog.DateTimeFormat), Post.Name, "", mk, Post.Source}
3700 itm = New ListViewItem(sitem, Post.ImageIndex)
3702 Dim sitem() As String = {"", Post.Nickname, Post.Data, Post.PDate.ToString(SettingDialog.DateTimeFormat), Post.Name + "(RT:" + Post.RetweetedBy + ")", "", mk, Post.Source}
3703 itm = New ListViewItem(sitem, Post.ImageIndex)
3705 Dim read As Boolean = Post.IsRead
3706 '未読管理していなかったら既読として扱う
3707 If Not _statuses.Tabs(Tab.Text).UnreadManage OrElse _
3708 Not SettingDialog.UnreadManage Then read = True
3709 ChangeItemStyleRead(read, itm, Post, Nothing)
3710 If Tab.Equals(_curTab) Then ColorizeList(itm, Index)
3714 Private Sub MyList_DrawColumnHeader(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawListViewColumnHeaderEventArgs)
3715 e.DrawDefault = True
3718 Private Sub MyList_DrawItemDefault(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawListViewItemEventArgs)
3719 e.DrawDefault = True
3722 Private Sub MyList_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawListViewItemEventArgs)
3723 'アイコンサイズ26,48はオーナードロー(DrawSubItem発生させる)
3724 If e.State = 0 Then Exit Sub
3725 e.DrawDefault = False
3726 If Not e.Item.Selected Then 'e.ItemStateでうまく判定できない???
3727 Dim brs2 As SolidBrush = Nothing
3728 Select Case e.Item.BackColor
3730 brs2 = _brsBackColorMine
3732 brs2 = _brsBackColorAt
3734 brs2 = _brsBackColorYou
3736 brs2 = _brsBackColorAtYou
3737 Case _clAtFromTarget
3738 brs2 = _brsBackColorAtFromTarget
3740 brs2 = _brsBackColorAtTo
3742 brs2 = _brsBackColorNone
3744 e.Graphics.FillRectangle(brs2, e.Bounds)
3747 If DirectCast(sender, Windows.Forms.Control).Focused Then
3748 e.Graphics.FillRectangle(_brsHighLight, e.Bounds)
3750 e.Graphics.FillRectangle(_brsDeactiveSelection, e.Bounds)
3753 If (e.State And ListViewItemStates.Focused) = ListViewItemStates.Focused Then e.DrawFocusRectangle()
3756 Private Sub MyList_DrawSubItem(ByVal sender As Object, ByVal e As DrawListViewSubItemEventArgs)
3757 If e.ItemState = 0 Then Exit Sub
3758 If e.ColumnIndex > 0 Then
3759 Dim rct As RectangleF = e.Bounds
3760 Dim rctB As RectangleF = e.Bounds
3761 rct.Width = e.Header.Width
3762 rctB.Width = e.Header.Width
3763 If _iconCol Then rct.Height = e.Item.Font.Height
3765 If Not e.Item.Selected Then 'e.ItemStateでうまく判定できない???
3768 Dim brs As SolidBrush = Nothing
3769 Dim flg As Boolean = False
3770 Select Case e.Item.ForeColor
3772 brs = _brsForeColorUnread
3774 brs = _brsForeColorReaded
3776 brs = _brsForeColorFav
3778 brs = _brsForeColorOWL
3780 brs = _brsForeColorRetweet
3782 brs = New SolidBrush(e.Item.ForeColor)
3785 If rct.Width > 0 Then
3787 Dim fnt As New Font(e.Item.Font, FontStyle.Bold)
3788 e.Graphics.DrawString(System.Environment.NewLine + e.Item.SubItems(2).Text, e.Item.Font, brs, rctB, sf)
3789 e.Graphics.DrawString(e.Item.SubItems(4).Text + " / " + e.Item.SubItems(1).Text + " (" + e.Item.SubItems(3).Text + ") " + e.Item.SubItems(5).Text + e.Item.SubItems(6).Text + " [" + e.Item.SubItems(7).Text + "]", fnt, brs, rct, sf)
3792 e.Graphics.DrawString(e.SubItem.Text, e.Item.Font, brs, rct, sf)
3795 If flg Then brs.Dispose()
3797 If rct.Width > 0 Then
3799 Dim fnt As New Font(e.Item.Font, FontStyle.Bold)
3800 If DirectCast(sender, Windows.Forms.Control).Focused Then
3802 e.Graphics.DrawString(System.Environment.NewLine + e.Item.SubItems(2).Text, e.Item.Font, _brsHighLightText, rctB, sf)
3803 e.Graphics.DrawString(e.Item.SubItems(4).Text + " / " + e.Item.SubItems(1).Text + " (" + e.Item.SubItems(3).Text + ") " + e.Item.SubItems(5).Text + e.Item.SubItems(6).Text + " [" + e.Item.SubItems(7).Text + "]", fnt, _brsHighLightText, rct, sf)
3805 e.Graphics.DrawString(e.SubItem.Text, e.Item.Font, _brsHighLightText, rct, sf)
3809 e.Graphics.DrawString(System.Environment.NewLine + e.Item.SubItems(2).Text, e.Item.Font, _brsForeColorUnread, rctB, sf)
3810 e.Graphics.DrawString(e.Item.SubItems(4).Text + " / " + e.Item.SubItems(1).Text + " (" + e.Item.SubItems(3).Text + ") " + e.Item.SubItems(5).Text + e.Item.SubItems(6).Text + " [" + e.Item.SubItems(7).Text + "]", fnt, _brsForeColorUnread, rct, sf)
3812 e.Graphics.DrawString(e.SubItem.Text, e.Item.Font, _brsForeColorUnread, rct, sf)
3820 e.DrawDefault = True
3824 Private Sub DoTabSearch(ByVal _word As String, _
3825 ByVal CaseSensitive As Boolean, _
3826 ByVal UseRegex As Boolean, _
3827 ByVal SType As SEARCHTYPE)
3828 Dim cidx As Integer = 0
3829 Dim fnd As Boolean = False
3830 Dim toIdx As Integer
3831 Dim stp As Integer = 1
3833 If _curList.VirtualListSize = 0 Then
3834 MessageBox.Show(My.Resources.DoTabSearchText2, My.Resources.DoTabSearchText3, MessageBoxButtons.OK, MessageBoxIcon.Information)
3837 If _curList.SelectedIndices.Count > 0 Then
3838 cidx = _curList.SelectedIndices(0)
3840 toIdx = _curList.VirtualListSize - 1
3843 Case SEARCHTYPE.DialogSearch 'ダイアログからの検索
3844 If _curList.SelectedIndices.Count > 0 Then
3845 cidx = _curList.SelectedIndices(0)
3849 Case SEARCHTYPE.NextSearch '次を検索
3850 If _curList.SelectedIndices.Count > 0 Then
3851 cidx = _curList.SelectedIndices(0) + 1
3852 If cidx > toIdx Then cidx = toIdx
3856 Case SEARCHTYPE.PrevSearch '前を検索
3857 If _curList.SelectedIndices.Count > 0 Then
3858 cidx = _curList.SelectedIndices(0) - 1
3859 If cidx < 0 Then cidx = 0
3867 Dim regOpt As RegexOptions = RegexOptions.None
3868 Dim fndOpt As StringComparison = StringComparison.Ordinal
3869 If Not CaseSensitive Then
3870 regOpt = RegexOptions.IgnoreCase
3871 fndOpt = StringComparison.OrdinalIgnoreCase
3877 Dim _search As Regex
3879 _search = New Regex(_word)
3880 For idx As Integer = cidx To toIdx Step stp
3881 Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
3882 If _search.IsMatch(post.Nickname, regOpt) _
3883 OrElse _search.IsMatch(post.Data, regOpt) _
3884 OrElse _search.IsMatch(post.Name, regOpt) _
3886 SelectListItem(_curList, idx)
3887 _curList.EnsureVisible(idx)
3891 Catch ex As ArgumentException
3892 MsgBox(My.Resources.DoTabSearchText1, MsgBoxStyle.Critical)
3897 For idx As Integer = cidx To toIdx Step stp
3898 Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
3899 If post.Nickname.IndexOf(_word, fndOpt) > -1 _
3900 OrElse post.Data.IndexOf(_word, fndOpt) > -1 _
3901 OrElse post.Name.IndexOf(_word, fndOpt) > -1 _
3903 SelectListItem(_curList, idx)
3904 _curList.EnsureVisible(idx)
3912 Case SEARCHTYPE.DialogSearch, SEARCHTYPE.NextSearch
3915 Case SEARCHTYPE.PrevSearch
3917 cidx = _curList.Items.Count - 1
3922 Catch ex As ArgumentOutOfRangeException
3925 MessageBox.Show(My.Resources.DoTabSearchText2, My.Resources.DoTabSearchText3, MessageBoxButtons.OK, MessageBoxIcon.Information)
3928 Private Sub MenuItemSubSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemSubSearch.Click
3930 SearchDialog.Owner = Me
3931 If SearchDialog.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
3932 Me.TopMost = SettingDialog.AlwaysTop
3935 Me.TopMost = SettingDialog.AlwaysTop
3937 If SearchDialog.SWord <> "" Then
3938 DoTabSearch(SearchDialog.SWord, _
3939 SearchDialog.CheckCaseSensitive, _
3940 SearchDialog.CheckRegex, _
3941 SEARCHTYPE.DialogSearch)
3945 Private Sub MenuItemSearchNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemSearchNext.Click
3947 If SearchDialog.SWord = "" Then
3948 If SearchDialog.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
3949 Me.TopMost = SettingDialog.AlwaysTop
3952 Me.TopMost = SettingDialog.AlwaysTop
3953 If SearchDialog.SWord = "" Then Exit Sub
3955 DoTabSearch(SearchDialog.SWord, _
3956 SearchDialog.CheckCaseSensitive, _
3957 SearchDialog.CheckRegex, _
3958 SEARCHTYPE.DialogSearch)
3960 DoTabSearch(SearchDialog.SWord, _
3961 SearchDialog.CheckCaseSensitive, _
3962 SearchDialog.CheckRegex, _
3963 SEARCHTYPE.NextSearch)
3967 Private Sub MenuItemSearchPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemSearchPrev.Click
3969 If SearchDialog.SWord = "" Then
3970 If SearchDialog.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
3971 Me.TopMost = SettingDialog.AlwaysTop
3974 Me.TopMost = SettingDialog.AlwaysTop
3975 If SearchDialog.SWord = "" Then Exit Sub
3978 DoTabSearch(SearchDialog.SWord, _
3979 SearchDialog.CheckCaseSensitive, _
3980 SearchDialog.CheckRegex, _
3981 SEARCHTYPE.PrevSearch)
3984 Private Sub AboutMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutMenuItem.Click
3985 TweenAboutBox.ShowDialog()
3986 Me.TopMost = SettingDialog.AlwaysTop
3989 Private Sub JumpUnreadMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JumpUnreadMenuItem.Click, JumpReadOpMenuItem.Click
3990 Dim bgnIdx As Integer = ListTab.TabPages.IndexOf(_curTab)
3991 Dim idx As Integer = -1
3992 Dim lst As DetailsListView = Nothing
3995 For i As Integer = bgnIdx To ListTab.TabPages.Count - 1
3997 idx = _statuses.GetOldestUnreadId(ListTab.TabPages(i).Text)
3999 ListTab.SelectedIndex = i
4000 lst = DirectCast(ListTab.TabPages(i).Tag, DetailsListView)
4001 '_curTab = ListTab.TabPages(i)
4006 '未読みつからず&現在タブが先頭ではなかったら、先頭タブから現在タブの手前まで探索
4007 If idx = -1 AndAlso bgnIdx > 0 Then
4008 For i As Integer = 0 To bgnIdx - 1
4009 idx = _statuses.GetOldestUnreadId(ListTab.TabPages(i).Text)
4011 ListTab.SelectedIndex = i
4012 lst = DirectCast(ListTab.TabPages(i).Tag, DetailsListView)
4013 '_curTab = ListTab.TabPages(i)
4019 '全部調べたが未読見つからず→先頭タブの最新発言へ
4021 ListTab.SelectedIndex = 0
4022 lst = DirectCast(ListTab.TabPages(0).Tag, DetailsListView)
4023 '_curTab = ListTab.TabPages(0)
4024 If _statuses.SortOrder = SortOrder.Ascending Then
4025 idx = lst.VirtualListSize - 1
4031 If lst.VirtualListSize > 0 AndAlso idx > -1 AndAlso lst.VirtualListSize > idx Then
4032 SelectListItem(lst, idx)
4033 If _statuses.SortMode = IdComparerClass.ComparerMode.Id Then
4034 If _statuses.SortOrder = SortOrder.Ascending AndAlso lst.Items(idx).Position.Y > lst.ClientSize.Height - _iconSz - 10 OrElse _
4035 _statuses.SortOrder = SortOrder.Descending AndAlso lst.Items(idx).Position.Y < _iconSz + 10 Then
4038 lst.EnsureVisible(idx)
4041 lst.EnsureVisible(idx)
4047 Private Sub StatusOpenMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusOpenMenuItem.Click, OpenStatusOpMenuItem.Click
4048 If _curList.SelectedIndices.Count > 0 AndAlso _statuses.Tabs(_curTab.Text).TabType <> TabUsageType.DirectMessage Then
4049 Dim post As PostClass = _statuses.Item(_curTab.Text, _curList.SelectedIndices(0))
4050 If post.RetweetedId = 0 Then
4051 OpenUriAsync("http://twitter.com/" + post.Name + "/status/" + post.Id.ToString)
4053 OpenUriAsync("http://twitter.com/" + post.Name + "/status/" + post.RetweetedId.ToString)
4058 Private Sub FavorareMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles FavorareMenuItem.Click, OpenFavotterOpMenuItem.Click
4059 If _curList.SelectedIndices.Count > 0 Then
4060 Dim post As PostClass = _statuses.Item(_curTab.Text, _curList.SelectedIndices(0))
4061 OpenUriAsync("http://favotter.net/user.php?user=" + post.Name)
4065 Private Sub VerUpMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerUpMenuItem.Click
4069 Private Sub RunTweenUp()
4071 Dim pinfo As New ProcessStartInfo
4072 pinfo.UseShellExecute = True
4073 pinfo.WorkingDirectory = Application.StartupPath
4074 pinfo.FileName = Path.Combine(Application.StartupPath(), "TweenUp.exe")
4076 Process.Start(pinfo)
4077 Catch ex As Exception
4078 MsgBox("Failed to execute TweenUp.exe.")
4082 Private Sub CheckNewVersion(Optional ByVal startup As Boolean = False)
4083 Dim retMsg As String = ""
4084 Dim strVer As String = ""
4085 Dim strDetail As String = ""
4086 Dim forceUpdate As Boolean = My.Computer.Keyboard.ShiftKeyDown
4089 retMsg = tw.GetVersionInfo()
4090 Catch ex As Exception
4091 StatusLabel.Text = My.Resources.CheckNewVersionText9
4092 If Not startup Then MessageBox.Show(My.Resources.CheckNewVersionText10, My.Resources.CheckNewVersionText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
4095 If retMsg.Length > 0 Then
4096 strVer = retMsg.Substring(0, 4)
4097 If retMsg.Length > 4 Then
4098 strDetail = retMsg.Substring(5).Trim
4100 If strVer.CompareTo(fileVersion.Replace(".", "")) > 0 Then
4101 Dim tmp As String = String.Format(My.Resources.CheckNewVersionText3, strVer)
4102 Using dialogAsShieldicon As New DialogAsShieldIcon
4103 If dialogAsShieldicon.Show(tmp, strDetail, My.Resources.CheckNewVersionText1, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
4104 retMsg = tw.GetTweenBinary(strVer)
4105 If retMsg.Length = 0 Then
4108 ' Application.Exit()
4111 dialogAsShieldicon.Dispose()
4116 If Not startup Then MessageBox.Show(My.Resources.CheckNewVersionText5 + System.Environment.NewLine + retMsg, My.Resources.CheckNewVersionText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
4119 dialogAsShieldicon.Dispose()
4123 Dim tmp As String = String.Format(My.Resources.CheckNewVersionText6, strVer)
4124 Using dialogAsShieldicon As New DialogAsShieldIcon
4125 If dialogAsShieldicon.Show(tmp, strDetail, My.Resources.CheckNewVersionText1, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
4126 retMsg = tw.GetTweenBinary(strVer)
4127 If retMsg.Length = 0 Then
4130 ' Application.Exit()
4133 dialogAsShieldicon.Dispose()
4138 If Not startup Then MessageBox.Show(My.Resources.CheckNewVersionText5 + System.Environment.NewLine + retMsg, My.Resources.CheckNewVersionText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
4141 dialogAsShieldicon.Dispose()
4143 ElseIf Not startup Then
4144 MessageBox.Show(My.Resources.CheckNewVersionText7 + fileVersion.Replace(".", "") + My.Resources.CheckNewVersionText8 + strVer, My.Resources.CheckNewVersionText2, MessageBoxButtons.OK, MessageBoxIcon.Information)
4148 StatusLabel.Text = My.Resources.CheckNewVersionText9
4149 If Not startup Then MessageBox.Show(My.Resources.CheckNewVersionText10, My.Resources.CheckNewVersionText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
4153 Private Sub TimerColorize_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerColorize.Tick
4154 If TimerColorize.Enabled = False Then Exit Sub
4156 TimerColorize.Stop()
4157 TimerColorize.Enabled = False
4158 TimerColorize.Interval = 200
4161 If SettingDialog.DispLatestPost <> DispTitleEnum.None AndAlso _
4162 SettingDialog.DispLatestPost <> DispTitleEnum.Post AndAlso _
4163 SettingDialog.DispLatestPost <> DispTitleEnum.Ver Then
4164 SetMainWindowTitle()
4166 If Not StatusLabelUrl.Text.StartsWith("http") Then SetStatusLabel()
4167 For Each tb As TabPage In ListTab.TabPages
4168 If _statuses.Tabs(tb.Text).UnreadCount = 0 Then
4169 If SettingDialog.TabIconDisp Then
4170 If tb.ImageIndex = 0 Then tb.ImageIndex = -1
4174 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
4177 Private Sub DispSelectedPost()
4179 If _curList.SelectedIndices.Count = 0 OrElse _curPost Is Nothing Then Exit Sub
4181 Dim dTxt As String = detailHtmlFormatHeader + _curPost.OriginalData + detailHtmlFormatFooter
4182 If _statuses.Tabs(_curTab.Text).TabType = TabUsageType.DirectMessage AndAlso _curPost.IsOwl Then
4183 NameLabel.Text = "DM TO -> "
4184 ElseIf _statuses.Tabs(_curTab.Text).TabType = TabUsageType.DirectMessage Then
4185 NameLabel.Text = "DM FROM <- "
4189 NameLabel.Text += _curPost.Name + "/" + _curPost.Nickname
4190 If Not String.IsNullOrEmpty(_curPost.RetweetedBy) Then
4191 NameLabel.Text += " (RT:" + _curPost.RetweetedBy + ")"
4193 'If UserPicture.Image IsNot Nothing Then UserPicture.Image.Dispose()
4194 If _curPost.ImageIndex > -1 Then
4195 UserPicture.Image = TIconDic(_curPost.ImageUrl)
4197 UserPicture.Image = Nothing
4199 'UserPicture.Refresh()
4201 NameLabel.ForeColor = System.Drawing.SystemColors.ControlText
4202 DateTimeLabel.Text = _curPost.PDate.ToString()
4203 If _curPost.IsOwl AndAlso (SettingDialog.OneWayLove OrElse _statuses.Tabs(_curTab.Text).TabType = TabUsageType.DirectMessage) Then NameLabel.ForeColor = _clOWL
4204 If _curPost.RetweetedId > 0 Then NameLabel.ForeColor = _clRetweet
4205 If _curPost.IsFav Then NameLabel.ForeColor = _clFav
4207 If DumpPostClassToolStripMenuItem.Checked Then
4208 Dim sb As New StringBuilder(512)
4210 sb.Append("-----Start PostClass Dump<br>")
4211 sb.AppendFormat("Data : {0}<br>", _curPost.Data)
4212 sb.AppendFormat("(PlainText) : <xmp>{0}</xmp><br>", _curPost.Data)
4213 sb.AppendFormat("Id : {0}<br>", _curPost.Id.ToString)
4214 sb.AppendFormat("ImageIndex : {0}<br>", _curPost.ImageIndex.ToString)
4215 sb.AppendFormat("ImageUrl : {0}<br>", _curPost.ImageUrl)
4216 sb.AppendFormat("InReplyToId : {0}<br>", _curPost.InReplyToId.ToString)
4217 sb.AppendFormat("InReplyToUser : {0}<br>", _curPost.InReplyToUser)
4218 sb.AppendFormat("IsDM : {0}<br>", _curPost.IsDm.ToString)
4219 sb.AppendFormat("IsFav : {0}<br>", _curPost.IsFav.ToString)
4220 sb.AppendFormat("IsMark : {0}<br>", _curPost.IsMark.ToString)
4221 sb.AppendFormat("IsMe : {0}<br>", _curPost.IsMe.ToString)
4222 sb.AppendFormat("IsOwl : {0}<br>", _curPost.IsOwl.ToString)
4223 sb.AppendFormat("IsProtect : {0}<br>", _curPost.IsProtect.ToString)
4224 sb.AppendFormat("IsRead : {0}<br>", _curPost.IsRead.ToString)
4225 sb.AppendFormat("IsReply : {0}<br>", _curPost.IsReply.ToString)
4227 For Each nm As String In _curPost.ReplyToList
4228 sb.AppendFormat("ReplyToList : {0}<br>", nm)
4231 sb.AppendFormat("Name : {0}<br>", _curPost.Name)
4232 sb.AppendFormat("NickName : {0}<br>", _curPost.Nickname)
4233 sb.AppendFormat("OriginalData : {0}<br>", _curPost.OriginalData)
4234 sb.AppendFormat("(PlainText) : <xmp>{0}</xmp><br>", _curPost.OriginalData)
4235 sb.AppendFormat("PDate : {0}<br>", _curPost.PDate.ToString)
4236 sb.AppendFormat("Source : {0}<br>", _curPost.Source)
4237 sb.Append("-----End PostClass Dump<br>")
4239 PostBrowser.Visible = False
4240 PostBrowser.DocumentText = detailHtmlFormatHeader + sb.ToString + detailHtmlFormatFooter
4241 PostBrowser.Visible = True
4244 If PostBrowser.DocumentText <> dTxt Then
4245 PostBrowser.Visible = False
4246 PostBrowser.DocumentText = dTxt
4248 Catch ex As System.Runtime.InteropServices.COMException
4251 PostBrowser.Visible = True
4256 Private Sub MatomeMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MatomeMenuItem.Click
4257 OpenUriAsync("http://sourceforge.jp/projects/tween/wiki/FrontPage")
4260 Private Sub ListTab_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ListTab.KeyDown
4261 If ListTab.SelectedTab IsNot Nothing Then
4262 If _statuses.Tabs(ListTab.SelectedTab.Text).TabType = TabUsageType.PublicSearch Then
4263 Dim pnl As Control = ListTab.SelectedTab.Controls("panelSearch")
4264 If pnl.Controls("comboSearch").Focused OrElse _
4265 pnl.Controls("comboLang").Focused OrElse _
4266 pnl.Controls("buttonSearch").Focused Then Exit Sub
4269 If e.Modifiers = Keys.None Then
4270 ' ModifierKeyが押されていない場合
4271 If e.KeyCode = Keys.N OrElse e.KeyCode = Keys.Right Then
4273 e.SuppressKeyPress = True
4277 If e.KeyCode = Keys.P OrElse e.KeyCode = Keys.Left Then
4279 e.SuppressKeyPress = True
4283 If e.KeyCode = Keys.OemPeriod Then
4285 e.SuppressKeyPress = True
4290 If e.KeyCode = Keys.Space OrElse e.KeyCode = Keys.ProcessKey Then
4292 e.SuppressKeyPress = True
4293 JumpUnreadMenuItem_Click(Nothing, Nothing)
4295 If e.KeyCode = Keys.Enter OrElse e.KeyCode = Keys.Return Then
4297 e.SuppressKeyPress = True
4298 MakeReplyOrDirectStatus()
4300 If e.KeyCode = Keys.L Then
4302 e.SuppressKeyPress = True
4305 If e.KeyCode = Keys.H Then
4307 e.SuppressKeyPress = True
4310 If e.KeyCode = Keys.Z Or e.KeyCode = Keys.Oemcomma Then
4312 e.SuppressKeyPress = True
4315 If e.KeyCode = Keys.R Then
4317 e.SuppressKeyPress = True
4320 If e.KeyCode = Keys.S Then
4322 e.SuppressKeyPress = True
4325 If e.KeyCode = Keys.A Then
4327 e.SuppressKeyPress = True
4330 'If e.KeyCode = Keys.OemQuestion Then
4332 ' e.SuppressKeyPress = True
4333 ' MenuItemSubSearch_Click(Nothing, Nothing) '/検索
4335 If e.KeyCode = Keys.F Then
4337 e.SuppressKeyPress = True
4338 SendKeys.Send("{PGDN}")
4340 If e.KeyCode = Keys.B Then
4342 e.SuppressKeyPress = True
4343 SendKeys.Send("{PGUP}")
4347 If e.Control AndAlso Not e.Alt AndAlso Not e.Shift Then
4349 If e.KeyCode = Keys.Home OrElse e.KeyCode = Keys.End Then
4350 TimerColorize.Stop()
4351 TimerColorize.Start()
4353 If e.KeyCode = Keys.N Then GoNextTab(True)
4354 If e.KeyCode = Keys.P Then GoNextTab(False)
4355 'If e.KeyCode = Keys.F Then
4357 ' e.SuppressKeyPress = True
4358 ' MovePageScroll(True)
4360 'If e.KeyCode = Keys.B Then
4362 ' e.SuppressKeyPress = True
4363 ' MovePageScroll(False)
4366 If Not e.Control AndAlso e.Alt AndAlso Not e.Shift Then
4368 ' 別タブの同じ書き込みへ(ALT+←/→)
4369 If e.KeyCode = Keys.Right Then
4371 e.SuppressKeyPress = True
4372 GoSamePostToAnotherTab(False)
4374 If e.KeyCode = Keys.Left Then
4376 e.SuppressKeyPress = True
4377 GoSamePostToAnotherTab(True)
4380 If e.Shift AndAlso Not e.Control AndAlso Not e.Alt Then
4382 If e.KeyCode = Keys.H Then
4384 e.SuppressKeyPress = True
4387 If e.KeyCode = Keys.L Then
4389 e.SuppressKeyPress = True
4392 If e.KeyCode = Keys.M Then
4394 e.SuppressKeyPress = True
4397 If e.KeyCode = Keys.G Then
4399 e.SuppressKeyPress = True
4402 If e.KeyCode = Keys.Z Then
4404 e.SuppressKeyPress = True
4408 ' お気に入り前後ジャンプ(SHIFT+N←/P→)
4409 If e.KeyCode = Keys.N OrElse e.KeyCode = Keys.Right Then
4411 e.SuppressKeyPress = True
4414 If e.KeyCode = Keys.P OrElse e.KeyCode = Keys.Left Then
4416 e.SuppressKeyPress = True
4419 'If e.KeyCode = Keys.B Then
4421 ' e.SuppressKeyPress = True
4422 ' UnreadStripMenuItem_Click(Nothing, Nothing)
4424 If e.KeyCode = Keys.R Then
4426 e.SuppressKeyPress = True
4431 If e.KeyCode = Keys.J Then
4433 e.SuppressKeyPress = True
4434 SendKeys.Send("{DOWN}")
4436 If e.KeyCode = Keys.K Then
4438 e.SuppressKeyPress = True
4439 SendKeys.Send("{UP}")
4442 If e.KeyCode = Keys.C Then
4443 Dim clstr As String = ""
4444 If e.Control AndAlso Not e.Alt AndAlso Not e.Shift Then
4446 e.SuppressKeyPress = True
4449 If e.Control AndAlso e.Shift AndAlso Not e.Alt Then
4451 e.SuppressKeyPress = True
4457 Private Sub GoNextTab(ByVal forward As Boolean)
4458 Dim idx As Integer = ListTab.SelectedIndex
4461 If idx > ListTab.TabPages.Count - 1 Then idx = 0
4464 If idx < 0 Then idx = ListTab.TabPages.Count - 1
4466 ListTab.SelectedIndex = idx
4467 ListTabSelect(ListTab.TabPages(idx))
4470 Private Sub CopyStot()
4471 Dim clstr As String = ""
4472 Dim sb As New StringBuilder()
4473 For Each idx As Integer In _curList.SelectedIndices
4474 Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
4475 If post.IsProtect AndAlso SettingDialog.ProtectNotInclude Then Continue For
4476 If post.RetweetedId = 0 Then
4477 sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.Name, post.Data, post.Id, Environment.NewLine)
4479 sb.AppendFormat("{0}:{1} [http://twitter.com/{2}/status/{3}]{4}", post.Name, post.Data, post.RetweetedBy, post.Id, Environment.NewLine)
4482 If sb.Length > 0 Then
4483 clstr = sb.ToString()
4485 Clipboard.SetDataObject(clstr, False, 5, 100)
4486 Catch ex As Exception
4487 MessageBox.Show(ex.Message)
4492 Private Sub CopyIdUri()
4493 Dim clstr As String = ""
4494 Dim sb As New StringBuilder()
4495 For Each idx As Integer In _curList.SelectedIndices
4496 Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
4497 If String.IsNullOrEmpty(post.RetweetedBy) Then
4498 sb.AppendFormat("http://twitter.com/{0}/status/{1}{2}", post.Name, post.Id, Environment.NewLine)
4500 sb.AppendFormat("http://twitter.com/{0}/status/{1}{2}", post.RetweetedBy, post.Id, Environment.NewLine)
4503 If sb.Length > 0 Then
4504 clstr = sb.ToString()
4506 Clipboard.SetDataObject(clstr, False, 5, 100)
4507 Catch ex As Exception
4508 MessageBox.Show(ex.Message)
4513 Private Sub GoFav(ByVal forward As Boolean)
4514 If _curList.VirtualListSize = 0 Then Exit Sub
4515 Dim fIdx As Integer = 0
4516 Dim toIdx As Integer = 0
4517 Dim stp As Integer = 1
4520 If _curList.SelectedIndices.Count = 0 Then
4523 fIdx = _curList.SelectedIndices(0) + 1
4524 If fIdx > _curList.VirtualListSize - 1 Then Exit Sub
4526 toIdx = _curList.VirtualListSize - 1
4529 If _curList.SelectedIndices.Count = 0 Then
4530 fIdx = _curList.VirtualListSize - 1
4532 fIdx = _curList.SelectedIndices(0) - 1
4533 If fIdx < 0 Then Exit Sub
4539 For idx As Integer = fIdx To toIdx Step stp
4540 If _statuses.Item(_curTab.Text, idx).IsFav Then
4541 SelectListItem(_curList, idx)
4542 _curList.EnsureVisible(idx)
4548 Private Sub GoSamePostToAnotherTab(ByVal left As Boolean)
4549 If _curList.VirtualListSize = 0 Then Exit Sub
4550 Dim fIdx As Integer = 0
4551 Dim toIdx As Integer = 0
4552 Dim stp As Integer = 1
4553 Dim targetId As Long = 0
4555 If _statuses.Tabs(_curTab.Text).TabType = TabUsageType.DirectMessage Then Exit Sub ' Directタブは対象外(見つかるはずがない)
4556 If _curList.SelectedIndices.Count = 0 Then Exit Sub '未選択も処理しない
4558 targetId = GetCurTabPost(_curList.SelectedIndices(0)).Id
4562 If ListTab.SelectedIndex = 0 Then
4565 fIdx = ListTab.SelectedIndex - 1
4571 If ListTab.SelectedIndex = ListTab.TabCount - 1 Then
4574 fIdx = ListTab.SelectedIndex + 1
4576 toIdx = ListTab.TabCount - 1
4580 Dim found As Boolean = False
4581 For tabidx As Integer = fIdx To toIdx Step stp
4582 If _statuses.Tabs(ListTab.TabPages(tabidx).Text).TabType = TabUsageType.DirectMessage Then Continue For ' Directタブは対象外
4583 '_itemCache = Nothing
4584 '_postCache = Nothing
4585 For idx As Integer = 0 To DirectCast(ListTab.TabPages(tabidx).Tag, DetailsListView).VirtualListSize - 1
4586 If _statuses.Item(ListTab.TabPages(tabidx).Text, idx).Id = targetId Then
4587 ListTab.SelectedIndex = tabidx
4588 ListTabSelect(ListTab.TabPages(tabidx))
4589 SelectListItem(_curList, idx)
4590 _curList.EnsureVisible(idx)
4595 If found Then Exit For
4597 '_itemCache = Nothing
4598 '_postCache = Nothing
4601 Private Sub GoPost(ByVal forward As Boolean)
4602 If _curList.SelectedIndices.Count = 0 OrElse _curPost Is Nothing Then Exit Sub
4603 Dim fIdx As Integer = 0
4604 Dim toIdx As Integer = 0
4605 Dim stp As Integer = 1
4608 fIdx = _curList.SelectedIndices(0) + 1
4609 If fIdx > _curList.VirtualListSize - 1 Then Exit Sub
4610 toIdx = _curList.VirtualListSize - 1
4613 fIdx = _curList.SelectedIndices(0) - 1
4614 If fIdx < 0 Then Exit Sub
4619 Dim name As String = ""
4620 If _curPost.RetweetedId = 0 Then
4621 name = _curPost.Name
4623 name = _curPost.RetweetedBy
4625 For idx As Integer = fIdx To toIdx Step stp
4626 If _statuses.Item(_curTab.Text, idx).RetweetedId = 0 Then
4627 If _statuses.Item(_curTab.Text, idx).Name = name Then
4628 SelectListItem(_curList, idx)
4629 _curList.EnsureVisible(idx)
4633 If _statuses.Item(_curTab.Text, idx).RetweetedBy = name Then
4634 SelectListItem(_curList, idx)
4635 _curList.EnsureVisible(idx)
4642 Private Sub GoRelPost(ByVal forward As Boolean)
4643 If _curList.SelectedIndices.Count = 0 Then Exit Sub
4645 Dim fIdx As Integer = 0
4646 Dim toIdx As Integer = 0
4647 Dim stp As Integer = 1
4649 fIdx = _curList.SelectedIndices(0) + 1
4650 If fIdx > _curList.VirtualListSize - 1 Then Exit Sub
4651 toIdx = _curList.VirtualListSize - 1
4654 fIdx = _curList.SelectedIndices(0) - 1
4655 If fIdx < 0 Then Exit Sub
4660 If Not _anchorFlag Then
4661 If _curPost Is Nothing Then Exit Sub
4662 _anchorPost = _curPost
4665 If _anchorPost Is Nothing Then Exit Sub
4668 For idx As Integer = fIdx To toIdx Step stp
4669 Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
4670 If post.Name = _anchorPost.Name OrElse _
4671 post.RetweetedBy = _anchorPost.Name OrElse _
4672 post.Name = _anchorPost.RetweetedBy OrElse _
4673 (Not String.IsNullOrEmpty(post.RetweetedBy) AndAlso post.RetweetedBy = _anchorPost.RetweetedBy) OrElse _
4674 _anchorPost.ReplyToList.Contains(post.Name.ToLower()) OrElse _
4675 _anchorPost.ReplyToList.Contains(post.RetweetedBy.ToLower()) OrElse _
4676 post.ReplyToList.Contains(_anchorPost.Name.ToLower()) OrElse _
4677 post.ReplyToList.Contains(_anchorPost.RetweetedBy.ToLower()) Then
4678 SelectListItem(_curList, idx)
4679 _curList.EnsureVisible(idx)
4685 Private Sub GoAnchor()
4686 If _anchorPost Is Nothing Then Exit Sub
4687 Dim idx As Integer = _statuses.Tabs(_curTab.Text).IndexOf(_anchorPost.Id)
4688 If idx = -1 Then Exit Sub
4690 SelectListItem(_curList, idx)
4691 _curList.EnsureVisible(idx)
4694 Private Sub GoTopEnd(ByVal GoTop As Boolean)
4695 Dim _item As ListViewItem
4699 _item = _curList.GetItemAt(0, 25)
4700 If _item Is Nothing Then
4706 _item = _curList.GetItemAt(0, _curList.ClientSize.Height - 1)
4707 If _item Is Nothing Then
4708 idx = _curList.VirtualListSize - 1
4713 SelectListItem(_curList, idx)
4716 Private Sub GoMiddle()
4717 Dim _item As ListViewItem
4722 _item = _curList.GetItemAt(0, 0)
4723 If _item Is Nothing Then
4728 _item = _curList.GetItemAt(0, _curList.ClientSize.Height - 1)
4729 If _item Is Nothing Then
4730 idx2 = _curList.VirtualListSize - 1
4734 idx3 = (idx1 + idx2) \ 2
4736 SelectListItem(_curList, idx3)
4739 Private Sub GoLast()
4740 If _curList.VirtualListSize = 0 Then Exit Sub
4742 If _statuses.SortOrder = SortOrder.Ascending Then
4743 SelectListItem(_curList, _curList.VirtualListSize - 1)
4744 _curList.EnsureVisible(_curList.VirtualListSize - 1)
4746 SelectListItem(_curList, 0)
4747 _curList.EnsureVisible(0)
4751 Private Sub MoveTop()
4752 If _curList.SelectedIndices.Count = 0 Then Exit Sub
4753 Dim idx As Integer = _curList.SelectedIndices(0)
4754 If _statuses.SortOrder = SortOrder.Ascending Then
4755 _curList.EnsureVisible(_curList.VirtualListSize - 1)
4757 _curList.EnsureVisible(0)
4759 _curList.EnsureVisible(idx)
4762 'Private Sub MovePageScroll(ByVal down As Boolean)
4763 ' Dim _item As ListViewItem
4764 ' Dim idx As Integer
4767 ' _item = _curList.GetItemAt(0, _curList.ClientSize.Height - 25)
4768 ' If _item Is Nothing Then
4769 ' If _curList.VirtualListSize > 0 Then
4770 ' SelectListItem(_curList, _curList.VirtualListSize - 1)
4771 ' _curList.EnsureVisible(_curList.VirtualListSize - 1)
4777 ' Dim idx2 As Integer = -1
4778 ' If _curList.Focused Then
4779 ' idx2 = _curList.FocusedItem.Index
4781 ' If idx2 >= idx Then
4783 ' Dim idx3 As Integer = 0
4784 ' _item = _curList.GetItemAt(0, 25)
4785 ' If _item IsNot Nothing Then
4786 ' idx3 = _item.Index
4788 ' Dim rowCount As Integer = idx - idx3
4789 ' Dim toIndex As Integer = 0
4790 ' If idx2 + rowCount > _curList.VirtualListSize - 1 Then
4791 ' toIndex = _curList.VirtualListSize - 1
4793 ' toIndex = idx2 + rowCount
4795 ' SelectListItem(_curList, toIndex)
4796 ' _curList.EnsureVisible(toIndex)
4799 ' SelectListItem(_curList, idx)
4802 ' _item = _curList.GetItemAt(0, 25)
4803 ' If _item Is Nothing Then
4804 ' If _curList.VirtualListSize > 0 Then
4805 ' SelectListItem(_curList, 0)
4806 ' _curList.EnsureVisible(0)
4812 ' Dim idx2 As Integer = -1
4813 ' If _curList.Focused Then
4814 ' idx2 = _curList.FocusedItem.Index
4816 ' If idx2 <= idx Then
4818 ' Dim idx3 As Integer = 0
4819 ' _item = _curList.GetItemAt(0, _curList.ClientSize.Height - 25)
4820 ' If _item IsNot Nothing Then
4821 ' idx3 = _item.Index
4823 ' Dim rowCount As Integer = idx3 - idx
4824 ' Dim toIndex As Integer = 0
4825 ' If idx2 - rowCount < 0 Then
4828 ' toIndex = idx2 - rowCount
4830 ' SelectListItem(_curList, toIndex)
4831 ' _curList.EnsureVisible(toIndex)
4834 ' SelectListItem(_curList, idx)
4840 Private Sub MyList_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
4844 Private Sub StatusText_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusText.Enter
4845 ' フォーカスの戻り先を StatusText に設定
4847 StatusText.BackColor = _clInputBackcolor
4850 Private Sub StatusText_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusText.Leave
4851 ' フォーカスがメニューに遷移しないならばフォーカスはタブに移ることを期待
4852 If ListTab.SelectedTab IsNot Nothing AndAlso MenuStrip1.Tag Is Nothing Then Me.Tag = ListTab.SelectedTab.Tag
4853 StatusText.BackColor = Color.FromKnownColor(KnownColor.Window)
4856 Private Sub StatusText_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles StatusText.KeyDown
4857 If e.Control AndAlso Not e.Alt AndAlso Not e.Shift Then
4858 If e.KeyCode = Keys.A Then
4859 StatusText.SelectAll()
4860 ElseIf e.KeyCode = Keys.Up OrElse e.KeyCode = Keys.Down Then
4861 If StatusText.Text.Trim() <> "" Then _history(_hisIdx) = StatusText.Text
4862 If e.KeyCode = Keys.Up Then
4864 If _hisIdx < 0 Then _hisIdx = 0
4867 If _hisIdx > _history.Count - 1 Then _hisIdx = _history.Count - 1
4869 StatusText.Text = _history(_hisIdx)
4870 StatusText.SelectionStart = StatusText.Text.Length
4872 e.SuppressKeyPress = True
4873 ElseIf e.KeyCode = Keys.PageUp Then
4874 If ListTab.SelectedIndex = 0 Then
4875 ListTab.SelectedIndex = ListTab.TabCount - 1
4877 ListTab.SelectedIndex -= 1
4880 e.SuppressKeyPress = True
4882 ElseIf e.KeyCode = Keys.PageDown Then
4883 If ListTab.SelectedIndex = ListTab.TabCount - 1 Then
4884 ListTab.SelectedIndex = 0
4886 ListTab.SelectedIndex += 1
4889 e.SuppressKeyPress = True
4893 Me.StatusText_TextChanged(Nothing, Nothing)
4896 Private Sub SaveConfigsAll(ByVal ifModified As Boolean)
4897 If Not ifModified Then
4900 'SaveConfigsTab(True) 'True:事前に設定ファイル削除
4903 If modifySettingCommon Then SaveConfigsCommon()
4904 If modifySettingLocal Then SaveConfigsLocal()
4905 If modifySettingAtId AndAlso SettingDialog.UseAtIdSupplement AndAlso AtIdSupl IsNot Nothing Then
4906 modifySettingAtId = False
4907 Dim cfgAtId As New SettingAtIdList(AtIdSupl.GetItemList)
4913 Private Sub SaveConfigsCommon()
4914 If _ignoreConfigSave Then Exit Sub
4916 modifySettingCommon = False
4917 SyncLock _syncObject
4918 _cfgCommon.UserName = tw.Username
4919 _cfgCommon.Password = tw.Password
4920 _cfgCommon.IsOAuth = SettingDialog.IsOAuth
4921 '_cfgCommon.Password = SettingDialog.PasswordStr
4922 _cfgCommon.Token = tw.AccessToken
4923 _cfgCommon.TokenSecret = tw.AccessTokenSecret
4924 '_cfgCommon.NextPageThreshold = SettingDialog.NextPageThreshold
4925 '_cfgCommon.NextPages = SettingDialog.NextPagesInt
4926 _cfgCommon.TimelinePeriod = SettingDialog.TimelinePeriodInt
4927 _cfgCommon.ReplyPeriod = SettingDialog.ReplyPeriodInt
4928 _cfgCommon.DMPeriod = SettingDialog.DMPeriodInt
4929 _cfgCommon.PubSearchPeriod = SettingDialog.PubSearchPeriodInt
4930 _cfgCommon.MaxPostNum = SettingDialog.MaxPostNum
4931 '_cfgCommon.ReadPages = SettingDialog.ReadPages
4932 '_cfgCommon.ReadPagesReply = SettingDialog.ReadPagesReply
4933 '_cfgCommon.ReadPagesDM = SettingDialog.ReadPagesDM
4934 _cfgCommon.Read = SettingDialog.Readed
4935 _cfgCommon.IconSize = SettingDialog.IconSz
4936 _cfgCommon.UnreadManage = SettingDialog.UnreadManage
4937 _cfgCommon.PlaySound = SettingDialog.PlaySound
4938 _cfgCommon.OneWayLove = SettingDialog.OneWayLove
4940 _cfgCommon.NameBalloon = SettingDialog.NameBalloon
4941 _cfgCommon.PostCtrlEnter = SettingDialog.PostCtrlEnter
4942 '_cfgCommon.UseApi = SettingDialog.UseAPI
4943 _cfgCommon.CountApi = SettingDialog.CountApi
4944 _cfgCommon.CountApiReply = SettingDialog.CountApiReply
4945 '_cfgCommon.UsePostMethod = False
4946 '_cfgCommon.CheckReply = SettingDialog.CheckReply
4947 _cfgCommon.PostAndGet = SettingDialog.PostAndGet
4948 _cfgCommon.DispUsername = SettingDialog.DispUsername
4949 _cfgCommon.MinimizeToTray = SettingDialog.MinimizeToTray
4950 _cfgCommon.CloseToExit = SettingDialog.CloseToExit
4951 _cfgCommon.DispLatestPost = SettingDialog.DispLatestPost
4952 _cfgCommon.SortOrderLock = SettingDialog.SortOrderLock
4953 _cfgCommon.TinyUrlResolve = SettingDialog.TinyUrlResolve
4954 _cfgCommon.PeriodAdjust = SettingDialog.PeriodAdjust
4955 _cfgCommon.StartupVersion = SettingDialog.StartupVersion
4956 '_cfgCommon.StartupKey = SettingDialog.StartupKey
4957 _cfgCommon.StartupFollowers = SettingDialog.StartupFollowers
4958 '_cfgCommon.StartupApiModeNoWarning = SettingDialog.StartupAPImodeNoWarning
4959 _cfgCommon.RestrictFavCheck = SettingDialog.RestrictFavCheck
4960 _cfgCommon.AlwaysTop = SettingDialog.AlwaysTop
4961 _cfgCommon.UrlConvertAuto = SettingDialog.UrlConvertAuto
4962 _cfgCommon.Outputz = SettingDialog.OutputzEnabled
4963 _cfgCommon.OutputzKey = SettingDialog.OutputzKey
4964 _cfgCommon.OutputzUrlMode = SettingDialog.OutputzUrlmode
4965 _cfgCommon.UseUnreadStyle = SettingDialog.UseUnreadStyle
4966 _cfgCommon.DateTimeFormat = SettingDialog.DateTimeFormat
4967 _cfgCommon.DefaultTimeOut = SettingDialog.DefaultTimeOut
4968 _cfgCommon.ProtectNotInclude = SettingDialog.ProtectNotInclude
4969 _cfgCommon.LimitBalloon = SettingDialog.LimitBalloon
4970 _cfgCommon.AutoShortUrlFirst = SettingDialog.AutoShortUrlFirst
4971 _cfgCommon.TabIconDisp = SettingDialog.TabIconDisp
4972 _cfgCommon.ReplyIconState = SettingDialog.ReplyIconState
4973 _cfgCommon.ReadOwnPost = SettingDialog.ReadOwnPost
4974 _cfgCommon.GetFav = SettingDialog.GetFav
4975 _cfgCommon.IsMonospace = SettingDialog.IsMonospace
4976 If IdeographicSpaceToSpaceToolStripMenuItem IsNot Nothing AndAlso _
4977 IdeographicSpaceToSpaceToolStripMenuItem.IsDisposed = False Then
4978 _cfgCommon.WideSpaceConvert = Me.IdeographicSpaceToSpaceToolStripMenuItem.Checked
4980 _cfgCommon.ReadOldPosts = SettingDialog.ReadOldPosts
4981 _cfgCommon.UseSsl = SettingDialog.UseSsl
4982 _cfgCommon.BilyUser = SettingDialog.BitlyUser
4983 _cfgCommon.BitlyPwd = SettingDialog.BitlyPwd
4984 _cfgCommon.ShowGrid = SettingDialog.ShowGrid
4985 _cfgCommon.UseAtIdSupplement = SettingDialog.UseAtIdSupplement
4986 _cfgCommon.UseHashSupplement = SettingDialog.UseHashSupplement
4987 _cfgCommon.Language = SettingDialog.Language
4989 _cfgCommon.SortOrder = _statuses.SortOrder
4990 Select Case _statuses.SortMode
4991 Case IdComparerClass.ComparerMode.Nickname 'ニックネーム
4992 _cfgCommon.SortColumn = 1
4993 Case IdComparerClass.ComparerMode.Data '本文
4994 _cfgCommon.SortColumn = 2
4995 Case IdComparerClass.ComparerMode.Id '時刻=発言Id
4996 _cfgCommon.SortColumn = 3
4997 Case IdComparerClass.ComparerMode.Name '名前
4998 _cfgCommon.SortColumn = 4
4999 Case IdComparerClass.ComparerMode.Source 'Source
5000 _cfgCommon.SortColumn = 7
5003 _cfgCommon.Nicoms = SettingDialog.Nicoms
5004 _cfgCommon.HashTags = HashMgr.HashHistories
5005 If HashMgr.IsPermanent Then
5006 _cfgCommon.HashSelected = HashMgr.UseHash
5008 _cfgCommon.HashSelected = ""
5010 _cfgCommon.HashIsHead = HashMgr.IsHead
5011 _cfgCommon.HashIsPermanent = HashMgr.IsPermanent
5012 _cfgCommon.TwitterUrl = SettingDialog.TwitterApiUrl
5013 _cfgCommon.TwitterSearchUrl = SettingDialog.TwitterSearchApiUrl
5019 Private Sub SaveConfigsLocal()
5020 If _ignoreConfigSave Then Exit Sub
5021 SyncLock _syncObject
5022 modifySettingLocal = False
5023 _cfgLocal.FormSize = _mySize
5024 _cfgLocal.FormLocation = _myLoc
5025 _cfgLocal.SplitterDistance = _mySpDis
5026 _cfgLocal.StatusMultiline = StatusText.Multiline
5027 _cfgLocal.StatusTextHeight = _mySpDis2
5028 _cfgLocal.StatusText = SettingDialog.Status
5030 _cfgLocal.FontUnread = _fntUnread
5031 _cfgLocal.ColorUnread = _clUnread
5032 _cfgLocal.FontRead = _fntReaded
5033 _cfgLocal.ColorRead = _clReaded
5034 _cfgLocal.FontDetail = _fntDetail
5035 _cfgLocal.ColorDetail = _clDetail
5036 _cfgLocal.ColorDetailBackcolor = _clDetailBackcolor
5037 _cfgLocal.ColorDetailLink = _clDetailLink
5038 _cfgLocal.ColorFav = _clFav
5039 _cfgLocal.ColorOWL = _clOWL
5040 _cfgLocal.ColorRetweet = _clRetweet
5041 _cfgLocal.ColorSelf = _clSelf
5042 _cfgLocal.ColorAtSelf = _clAtSelf
5043 _cfgLocal.ColorTarget = _clTarget
5044 _cfgLocal.ColorAtTarget = _clAtTarget
5045 _cfgLocal.ColorAtFromTarget = _clAtFromTarget
5046 _cfgLocal.ColorAtTo = _clAtTo
5047 _cfgLocal.ColorListBackcolor = _clListBackcolor
5048 _cfgLocal.ColorInputBackcolor = _clInputBackcolor
5049 _cfgLocal.ColorInputFont = _clInputFont
5050 _cfgLocal.FontInputFont = _fntInputFont
5052 _cfgLocal.BrowserPath = SettingDialog.BrowserPath
5053 _cfgLocal.UseRecommendStatus = SettingDialog.UseRecommendStatus
5054 _cfgLocal.ProxyType = SettingDialog.SelectedProxyType
5055 _cfgLocal.ProxyAddress = SettingDialog.ProxyAddress
5056 _cfgLocal.ProxyPort = SettingDialog.ProxyPort
5057 _cfgLocal.ProxyUser = SettingDialog.ProxyUser
5058 _cfgLocal.ProxyPassword = SettingDialog.ProxyPassword
5059 If _ignoreConfigSave Then Exit Sub
5064 'Private Sub SaveConfigsTab(ByVal DeleteBefore As Boolean)
5065 ' If _ignoreConfigSave Then Exit Sub
5066 ' Dim cnt As Integer = 0
5067 ' If ListTab IsNot Nothing AndAlso _
5068 ' ListTab.TabPages IsNot Nothing AndAlso _
5069 ' ListTab.TabPages.Count > 0 Then
5070 ' If DeleteBefore Then SettingTab.DeleteConfigFile() '旧設定ファイル削除
5071 ' For cnt = 0 To ListTab.TabPages.Count - 1
5072 ' SaveConfigsTab(ListTab.TabPages(cnt).Text)
5077 'Private Sub SaveConfigsTab(ByVal tabName As String)
5078 ' If _ignoreConfigSave Then Exit Sub
5079 ' SyncLock _syncObject
5080 ' Dim tabSetting As New SettingTab
5081 ' tabSetting.Tab = _statuses.Tabs(tabName)
5086 Private Sub SaveConfigsTabs()
5087 Dim tabSetting As New SettingTabs
5088 For i As Integer = 0 To ListTab.TabPages.Count - 1
5089 tabSetting.Tabs.Add(_statuses.Tabs(ListTab.TabPages(i).Text))
5094 Private Sub SaveLogMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveLogMenuItem.Click, SaveFileMenuItem.Click
5095 Dim rslt As DialogResult = MessageBox.Show(String.Format(My.Resources.SaveLogMenuItem_ClickText1, Environment.NewLine), _
5096 My.Resources.SaveLogMenuItem_ClickText2, _
5097 MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
5098 If rslt = Windows.Forms.DialogResult.Cancel Then Exit Sub
5100 SaveFileDialog1.FileName = "TweenPosts" + Format(Now, "yyMMdd-HHmmss") + ".tsv"
5101 SaveFileDialog1.InitialDirectory = My.Application.Info.DirectoryPath
5102 SaveFileDialog1.Filter = My.Resources.SaveLogMenuItem_ClickText3
5103 SaveFileDialog1.FilterIndex = 0
5104 SaveFileDialog1.Title = My.Resources.SaveLogMenuItem_ClickText4
5105 SaveFileDialog1.RestoreDirectory = True
5107 If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
5108 If Not SaveFileDialog1.ValidateNames Then Exit Sub
5109 Using sw As StreamWriter = New StreamWriter(SaveFileDialog1.FileName, False, Encoding.UTF8)
5110 If rslt = Windows.Forms.DialogResult.Yes Then
5112 For idx As Integer = 0 To _curList.VirtualListSize - 1
5113 Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
5114 Dim protect As String = ""
5115 If post.IsProtect Then protect = "Protect"
5116 sw.WriteLine(post.Nickname & vbTab & _
5117 """" & post.Data.Replace(vbLf, "").Replace("""", """""") + """" & vbTab & _
5118 post.PDate.ToString() & vbTab & _
5119 post.Name & vbTab & _
5120 post.Id.ToString() & vbTab & _
5121 post.ImageUrl & vbTab & _
5122 """" & post.OriginalData.Replace(vbLf, "").Replace("""", """""") + """" & vbTab & _
5126 For Each idx As Integer In _curList.SelectedIndices
5127 Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
5128 Dim protect As String = ""
5129 If post.IsProtect Then protect = "Protect"
5130 sw.WriteLine(post.Nickname & vbTab & _
5131 """" & post.Data.Replace(vbLf, "").Replace("""", """""") + """" & vbTab & _
5132 post.PDate.ToString() & vbTab & _
5133 post.Name & vbTab & _
5134 post.Id.ToString() & vbTab & _
5135 post.ImageUrl & vbTab & _
5136 """" & post.OriginalData.Replace(vbLf, "").Replace("""", """""") + """" & vbTab & _
5144 Me.TopMost = SettingDialog.AlwaysTop
5147 Private Sub PostBrowser_PreviewKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles PostBrowser.PreviewKeyDown
5148 If e.KeyCode = Keys.F5 OrElse e.KeyCode = Keys.R Then
5152 If e.Modifiers = Keys.None AndAlso (e.KeyCode = Keys.Space OrElse e.KeyCode = Keys.ProcessKey) Then
5154 JumpUnreadMenuItem_Click(Nothing, Nothing)
5158 Public Function TabRename(ByRef tabName As String) As Boolean
5160 'If _statuses.IsDefaultTab(tabName) Then Return False
5161 Dim newTabText As String = Nothing
5162 Using inputName As New InputTabName()
5163 inputName.TabName = tabName
5164 inputName.ShowDialog()
5165 newTabText = inputName.TabName
5168 Me.TopMost = SettingDialog.AlwaysTop
5169 If newTabText <> "" Then
5171 For i As Integer = 0 To ListTab.TabCount - 1
5172 If ListTab.TabPages(i).Text = newTabText Then
5173 Dim tmp As String = String.Format(My.Resources.Tabs_DoubleClickText1, newTabText)
5174 MessageBox.Show(tmp, My.Resources.Tabs_DoubleClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
5178 'タブ名のリスト作り直し(デフォルトタブ以外は再作成)
5179 For i As Integer = 0 To ListTab.TabCount - 1
5180 If _statuses.Tabs(ListTab.TabPages(i).Text).TabType = TabUsageType.Mentions OrElse _
5181 (Not _statuses.IsDefaultTab(ListTab.TabPages(i).Text) AndAlso _statuses.Tabs(ListTab.TabPages(i).Text).TabType <> TabUsageType.PublicSearch) Then
5182 TabDialog.RemoveTab(ListTab.TabPages(i).Text)
5184 If ListTab.TabPages(i).Text = tabName Then
5185 ListTab.TabPages(i).Text = newTabText
5188 _statuses.RenameTab(tabName, newTabText)
5190 For i As Integer = 0 To ListTab.TabCount - 1
5191 If _statuses.Tabs(ListTab.TabPages(i).Text).TabType = TabUsageType.Mentions OrElse _
5192 (Not _statuses.IsDefaultTab(ListTab.TabPages(i).Text) AndAlso _statuses.Tabs(ListTab.TabPages(i).Text).TabType <> TabUsageType.PublicSearch) Then
5193 If ListTab.TabPages(i).Text = tabName Then
5194 ListTab.TabPages(i).Text = newTabText
5196 TabDialog.AddTab(ListTab.TabPages(i).Text)
5200 'SaveConfigsTab(newTabText)
5202 _rclickTabName = newTabText
5203 tabName = newTabText
5208 Private Sub Tabs_DoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListTab.MouseDoubleClick
5209 Dim tn As String = ListTab.SelectedTab.Text
5213 Private Sub Tabs_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListTab.MouseDown
5214 Dim cpos As New Point(e.X, e.Y)
5215 If e.Button = Windows.Forms.MouseButtons.Left Then
5216 For i As Integer = 0 To ListTab.TabPages.Count - 1
5217 Dim rect As Rectangle = ListTab.GetTabRect(i)
5218 If rect.Left <= cpos.X AndAlso cpos.X <= rect.Right AndAlso _
5219 rect.Top <= cpos.Y AndAlso cpos.Y <= rect.Bottom Then
5229 Private Sub Tabs_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListTab.DragEnter
5230 If e.Data.GetDataPresent(GetType(TabPage)) Then
5231 e.Effect = DragDropEffects.Move
5233 e.Effect = DragDropEffects.None
5237 Private Sub Tabs_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListTab.DragDrop
5238 If Not e.Data.GetDataPresent(GetType(TabPage)) Then Exit Sub
5241 Dim tn As String = ""
5243 Dim cpos As New Point(e.X, e.Y)
5244 Dim spos As Point = ListTab.PointToClient(cpos)
5246 For i = 0 To ListTab.TabPages.Count - 1
5247 Dim rect As Rectangle = ListTab.GetTabRect(i)
5248 If rect.Left <= spos.X AndAlso spos.X <= rect.Right AndAlso _
5249 rect.Top <= spos.Y AndAlso spos.Y <= rect.Bottom Then
5250 tn = ListTab.TabPages(i).Text
5251 If spos.X <= (rect.Left + rect.Right) / 2 Then
5260 'タブのないところにドロップ->最後尾へ移動
5262 tn = ListTab.TabPages(ListTab.TabPages.Count - 1).Text
5264 i = ListTab.TabPages.Count - 1
5267 Dim tp As TabPage = DirectCast(e.Data.GetData(GetType(TabPage)), TabPage)
5268 If tp.Text = tn Then Exit Sub
5270 ReOrderTab(tp.Text, tn, bef)
5273 Public Sub ReOrderTab(ByVal targetTabText As String, ByVal baseTabText As String, ByVal isBeforeBaseTab As Boolean)
5274 Dim baseIndex As Integer = 0
5275 For baseIndex = 0 To ListTab.TabPages.Count - 1
5276 If ListTab.TabPages(baseIndex).Text = baseTabText Then Exit For
5279 ListTab.SuspendLayout()
5281 Dim mTp As TabPage = Nothing
5282 For j As Integer = 0 To ListTab.TabPages.Count - 1
5283 If ListTab.TabPages(j).Text = targetTabText Then
5284 mTp = ListTab.TabPages(j)
5285 ListTab.TabPages.Remove(mTp)
5286 If j < baseIndex Then baseIndex -= 1
5290 If isBeforeBaseTab Then
5291 ListTab.TabPages.Insert(baseIndex, mTp)
5293 ListTab.TabPages.Insert(baseIndex + 1, mTp)
5296 ListTab.ResumeLayout()
5301 Private Sub MakeReplyOrDirectStatus(Optional ByVal isAuto As Boolean = True, Optional ByVal isReply As Boolean = True, Optional ByVal isAll As Boolean = False)
5302 'isAuto:True=先頭に挿入、False=カーソル位置に挿入
5303 'isReply:True=@,False=DM
5304 If Not StatusText.Enabled Then Exit Sub
5305 If _curList Is Nothing Then Exit Sub
5306 If _curTab Is Nothing Then Exit Sub
5307 If _curPost Is Nothing Then Exit Sub
5309 ' 複数あてリプライはReplyではなく通常ポスト
5310 '↑仕様変更で全部リプライ扱いでOK(先頭ドット付加しない)
5311 '090403暫定でドットを付加しないようにだけ修正。単独と複数の処理は統合できると思われる。
5312 '090513 all @ replies 廃止の仕様変更によりドット付加に戻し(syo68k)
5314 If _curList.SelectedIndices.Count > 0 Then
5316 If _curList.SelectedIndices.Count = 1 AndAlso Not isAll AndAlso _curPost IsNot Nothing Then
5318 If (_statuses.Tabs(ListTab.SelectedTab.Text).TabType = TabUsageType.DirectMessage AndAlso isAuto) OrElse (Not isAuto AndAlso Not isReply) Then
5320 StatusText.Text = "D " + _curPost.Name + " " + StatusText.Text
5321 StatusText.SelectionStart = StatusText.Text.Length
5327 If StatusText.Text = "" Then
5330 ' ステータステキストが入力されていない場合先頭に@ユーザー名を追加する
5331 StatusText.Text = "@" + _curPost.Name + " "
5332 If _curPost.RetweetedId > 0 Then
5333 _reply_to_id = _curPost.RetweetedId
5335 _reply_to_id = _curPost.Id
5337 _reply_to_name = _curPost.Name
5342 '1件選んでEnter or DoubleClick
5343 If StatusText.Text.Contains("@" + _curPost.Name + " ") Then
5344 If _reply_to_id > 0 AndAlso _reply_to_name = _curPost.Name Then
5346 If _curPost.RetweetedId > 0 Then
5347 _reply_to_id = _curPost.RetweetedId
5349 _reply_to_id = _curPost.Id
5351 _reply_to_name = _curPost.Name
5355 If Not StatusText.Text.StartsWith("@") Then
5357 If StatusText.Text.StartsWith(". ") Then
5359 StatusText.Text = StatusText.Text.Insert(2, "@" + _curPost.Name + " ")
5364 StatusText.Text = "@" + _curPost.Name + " " + StatusText.Text
5365 If _curPost.RetweetedId > 0 Then
5366 _reply_to_id = _curPost.RetweetedId
5368 _reply_to_id = _curPost.Id
5370 _reply_to_name = _curPost.Name
5375 StatusText.Text = ". @" + _curPost.Name + " " + StatusText.Text
5376 'StatusText.Text = "@" + _curPost.Name + " " + StatusText.Text
5381 '1件選んでCtrl-Rの場合(返信先操作せず)
5382 Dim sidx As Integer = StatusText.SelectionStart
5383 Dim id As String = "@" + _curPost.Name + " "
5385 If StatusText.Text.Substring(sidx - 1, 1) <> " " Then
5389 StatusText.Text = StatusText.Text.Insert(sidx, id)
5391 'If StatusText.Text.StartsWith("@") Then
5393 ' StatusText.Text = ". " + StatusText.Text.Insert(sidx, " @" + _curPost.Name + " ")
5394 ' sidx += 5 + _curPost.Name.Length
5397 ' StatusText.Text = StatusText.Text.Insert(sidx, " @" + _curPost.Name + " ")
5398 ' sidx += 3 + _curPost.Name.Length
5400 StatusText.SelectionStart = sidx
5403 '_reply_to_name = Nothing
5409 If Not isAuto AndAlso Not isReply Then Exit Sub
5411 'C-S-rか、複数の宛先を選択中にEnter/DoubleClick/C-r/C-S-r
5414 'Enter or DoubleClick
5416 Dim sTxt As String = StatusText.Text
5417 If Not sTxt.StartsWith(". ") Then
5422 For cnt As Integer = 0 To _curList.SelectedIndices.Count - 1
5423 Dim post As PostClass = _statuses.Item(_curTab.Text, _curList.SelectedIndices(cnt))
5424 If Not sTxt.Contains("@" + post.Name + " ") Then
5425 sTxt = sTxt.Insert(2, "@" + post.Name + " ")
5426 'sTxt = "@" + post.Name + " " + sTxt
5429 StatusText.Text = sTxt
5432 If _curList.SelectedIndices.Count > 1 Then
5435 Dim ids As String = ""
5436 Dim sidx As Integer = StatusText.SelectionStart
5437 For cnt As Integer = 0 To _curList.SelectedIndices.Count - 1
5438 Dim post As PostClass = _statuses.Item(_curTab.Text, _curList.SelectedIndices(cnt))
5439 If Not ids.Contains("@" + post.Name + " ") AndAlso _
5440 Not post.Name.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase) Then
5441 ids += "@" + post.Name + " "
5444 For Each nm As String In post.ReplyToList
5445 If Not ids.Contains("@" + nm + " ") AndAlso _
5446 Not nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase) Then
5447 ids += "@" + nm + " "
5452 If ids.Length = 0 Then Exit Sub
5453 If Not StatusText.Text.StartsWith(". ") Then
5454 StatusText.Text = ". " + StatusText.Text
5460 If StatusText.Text.Substring(sidx - 1, 1) <> " " Then
5464 StatusText.Text = StatusText.Text.Insert(sidx, ids)
5466 'If StatusText.Text.StartsWith("@") Then
5467 ' StatusText.Text = ". " + StatusText.Text.Insert(sidx, ids)
5468 ' sidx += 2 + ids.Length
5470 ' StatusText.Text = StatusText.Text.Insert(sidx, ids)
5471 ' sidx += 1 + ids.Length
5473 StatusText.SelectionStart = sidx
5477 '1件のみ選択のC-S-r(返信元付加する可能性あり)
5479 Dim ids As String = ""
5480 Dim sidx As Integer = StatusText.SelectionStart
5481 Dim post As PostClass = _curPost
5482 If Not ids.Contains("@" + post.Name + " ") AndAlso _
5483 Not post.Name.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase) Then
5484 ids += "@" + post.Name + " "
5486 For Each nm As String In post.ReplyToList
5487 If Not ids.Contains("@" + nm + " ") AndAlso _
5488 Not nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase) Then
5489 ids += "@" + nm + " "
5492 If ids.Length = 0 Then Exit Sub
5493 If StatusText.Text = "" Then
5495 StatusText.Text = ids
5496 StatusText.SelectionStart = ids.Length
5498 If post.RetweetedId > 0 Then
5499 _reply_to_id = post.RetweetedId
5501 _reply_to_id = post.Id
5503 _reply_to_name = post.Name
5508 If StatusText.Text.Substring(sidx - 1, 1) <> " " Then
5512 StatusText.Text = StatusText.Text.Insert(sidx, ids)
5514 StatusText.SelectionStart = sidx
5520 StatusText.SelectionStart = StatusText.Text.Length
5525 Private Sub ListTab_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListTab.MouseUp
5529 Private Sub TimerRefreshIcon_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerRefreshIcon.Tick
5530 If Not TimerRefreshIcon.Enabled Then Exit Sub
5531 Static iconCnt As Integer = 0
5532 Static blinkCnt As Integer = 0
5533 Static blink As Boolean = False
5534 Static idle As Boolean = False
5539 Dim busy As Boolean = False
5540 For Each bw As BackgroundWorker In Me._bw
5541 If bw IsNot Nothing AndAlso bw.IsBusy Then
5550 If blinkCnt > 10 Then
5553 SaveConfigsAll(True)
5557 NotifyIcon1.Icon = NIconRefresh(iconCnt)
5559 _myStatusError = False
5563 Dim tb As TabClass = _statuses.GetTabByType(TabUsageType.Mentions)
5564 If SettingDialog.ReplyIconState <> REPLY_ICONSTATE.None AndAlso tb IsNot Nothing AndAlso tb.UnreadCount > 0 Then
5565 If blinkCnt > 0 Then Exit Sub
5567 If blink OrElse SettingDialog.ReplyIconState = REPLY_ICONSTATE.StaticIcon Then
5568 NotifyIcon1.Icon = ReplyIcon
5570 NotifyIcon1.Icon = ReplyIconBlink
5576 If idle Then Exit Sub
5580 If _myStatusError Then
5581 NotifyIcon1.Icon = NIconAtRed
5584 If _myStatusOnline Then
5585 NotifyIcon1.Icon = NIconAt
5587 NotifyIcon1.Icon = NIconAtSmoke
5591 Private Sub ContextMenuTabProperty_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuTabProperty.Opening
5592 '右クリックの場合はタブ名が設定済。アプリケーションキーの場合は現在のタブを対象とする
5593 If _rclickTabName = "" OrElse sender IsNot ContextMenuTabProperty Then _rclickTabName = ListTab.SelectedTab.Text
5594 If _statuses Is Nothing Then Exit Sub
5595 If _statuses.Tabs Is Nothing Then Exit Sub
5597 Dim tb As TabClass = _statuses.Tabs(_rclickTabName)
5598 If tb Is Nothing Then Exit Sub
5600 NotifyDispMenuItem.Checked = tb.Notify
5601 Me.NotifyTbMenuItem.Checked = tb.Notify
5603 soundfileListup = True
5604 SoundFileComboBox.Items.Clear()
5605 Me.SoundFileTbComboBox.Items.Clear()
5606 SoundFileComboBox.Items.Add("")
5607 Me.SoundFileTbComboBox.Items.Add("")
5608 Dim oDir As IO.DirectoryInfo = New IO.DirectoryInfo(My.Application.Info.DirectoryPath)
5609 If IO.Directory.Exists(IO.Path.Combine(My.Application.Info.DirectoryPath, "Sounds")) Then
5610 oDir = oDir.GetDirectories("Sounds")(0)
5612 For Each oFile As IO.FileInfo In oDir.GetFiles("*.wav")
5613 SoundFileComboBox.Items.Add(oFile.Name)
5614 Me.SoundFileTbComboBox.Items.Add(oFile.Name)
5616 Dim idx As Integer = SoundFileComboBox.Items.IndexOf(tb.SoundFile)
5617 If idx = -1 Then idx = 0
5618 SoundFileComboBox.SelectedIndex = idx
5619 Me.SoundFileTbComboBox.SelectedIndex = idx
5620 soundfileListup = False
5621 UreadManageMenuItem.Checked = tb.UnreadManage
5622 Me.UnreadMngTbMenuItem.Checked = tb.UnreadManage
5624 If _statuses.Tabs(_rclickTabName).TabType <> TabUsageType.Mentions AndAlso _statuses.IsDefaultTab(_rclickTabName) Then
5625 FilterEditMenuItem.Enabled = True
5626 Me.EditRuleTbMenuItem.Enabled = True
5627 DeleteTabMenuItem.Enabled = False
5628 Me.DeleteTbMenuItem.Enabled = False
5629 ElseIf _statuses.Tabs(_rclickTabName).TabType = TabUsageType.Mentions Then
5630 FilterEditMenuItem.Enabled = True
5631 Me.EditRuleTbMenuItem.Enabled = True
5632 DeleteTabMenuItem.Enabled = False
5633 Me.DeleteTbMenuItem.Enabled = False
5635 FilterEditMenuItem.Enabled = True
5636 Me.EditRuleTbMenuItem.Enabled = True
5637 DeleteTabMenuItem.Enabled = True
5638 Me.DeleteTbMenuItem.Enabled = True
5642 Private Sub UreadManageMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UreadManageMenuItem.Click, UnreadMngTbMenuItem.Click
5643 UreadManageMenuItem.Checked = DirectCast(sender, ToolStripMenuItem).Checked
5644 Me.UnreadMngTbMenuItem.Checked = UreadManageMenuItem.Checked
5646 If _rclickTabName = "" Then Exit Sub
5647 ChangeTabUnreadManage(_rclickTabName, UreadManageMenuItem.Checked)
5649 'SaveConfigsTab(_rclickTabName)
5653 Public Sub ChangeTabUnreadManage(ByVal tabName As String, ByVal isManage As Boolean)
5656 For idx = 0 To ListTab.TabCount
5657 If ListTab.TabPages(idx).Text = tabName Then Exit For
5660 _statuses.SetTabUnreadManage(tabName, isManage)
5661 If SettingDialog.TabIconDisp Then
5662 If _statuses.Tabs(tabName).UnreadCount > 0 Then
5663 ListTab.TabPages(idx).ImageIndex = 0
5665 ListTab.TabPages(idx).ImageIndex = -1
5669 If _curTab.Text = tabName Then
5670 _itemCache = Nothing
5671 _postCache = Nothing
5675 SetMainWindowTitle()
5677 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
5680 Private Sub NotifyDispMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotifyDispMenuItem.Click, NotifyTbMenuItem.Click
5681 NotifyDispMenuItem.Checked = DirectCast(sender, ToolStripMenuItem).Checked
5682 Me.NotifyTbMenuItem.Checked = NotifyDispMenuItem.Checked
5684 If _rclickTabName = "" Then Exit Sub
5686 _statuses.Tabs(_rclickTabName).Notify = NotifyDispMenuItem.Checked
5688 'SaveConfigsTab(_rclickTabName)
5692 Private Sub SoundFileComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SoundFileComboBox.SelectedIndexChanged, SoundFileTbComboBox.SelectedIndexChanged
5693 If soundfileListup OrElse _rclickTabName = "" Then Exit Sub
5695 _statuses.Tabs(_rclickTabName).SoundFile = DirectCast(DirectCast(sender, ToolStripComboBox).SelectedItem, String)
5697 'SaveConfigsTab(_rclickTabName)
5701 Private Sub DeleteTabMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DeleteTabMenuItem.Click, DeleteTbMenuItem.Click
5702 If _rclickTabName = "" OrElse sender Is Me.DeleteTbMenuItem Then _rclickTabName = ListTab.SelectedTab.Text
5704 RemoveSpecifiedTab(_rclickTabName)
5705 '_rclickTabName = ""
5706 'SaveConfigsCommon()
5707 'SaveConfigsTab(False)
5711 Private Sub FilterEditMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FilterEditMenuItem.Click, EditRuleTbMenuItem.Click
5712 'If _rclickTabName = "" OrElse _rclickTabName = DEFAULTTAB.RECENT OrElse _rclickTabName = DEFAULTTAB.DM _
5713 ' OrElse _rclickTabName = DEFAULTTAB.FAV Then Exit Sub
5715 If _rclickTabName = "" Then _rclickTabName = _statuses.GetTabByType(TabUsageType.Home).TabName
5716 fDialog.SetCurrent(_rclickTabName)
5717 fDialog.ShowDialog()
5718 Me.TopMost = SettingDialog.AlwaysTop
5721 Me.Cursor = Cursors.WaitCursor
5722 _itemCache = Nothing
5723 _postCache = Nothing
5726 _statuses.FilterAll()
5727 For Each tb As TabPage In ListTab.TabPages
5728 DirectCast(tb.Tag, DetailsListView).VirtualListSize = _statuses.Tabs(tb.Text).AllCount
5729 If _statuses.Tabs(tb.Text).UnreadCount > 0 Then
5730 If SettingDialog.TabIconDisp Then
5734 If SettingDialog.TabIconDisp Then
5739 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
5741 Me.Cursor = Cursors.Default
5743 'SaveConfigsTab(False)
5747 Private Sub AddTabMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddTabMenuItem.Click, CreateTbMenuItem.Click
5748 Dim tabName As String = Nothing
5749 Dim tabUsage As TabUsageType
5750 Using inputName As New InputTabName()
5751 inputName.TabName = _statuses.GetUniqueTabName
5752 inputName.IsShowUsage = True
5753 inputName.ShowDialog()
5754 tabName = inputName.TabName
5755 tabUsage = inputName.Usage
5758 Me.TopMost = SettingDialog.AlwaysTop
5759 If tabName <> "" Then
5760 If Not AddNewTab(tabName, False, tabUsage) Then
5761 Dim tmp As String = String.Format(My.Resources.AddTabMenuItem_ClickText1, tabName)
5762 MessageBox.Show(tmp, My.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
5765 _statuses.AddTab(tabName, tabUsage)
5766 'SaveConfigsCommon()
5767 'SaveConfigsTab(False)
5769 If tabUsage = TabUsageType.PublicSearch Then
5770 ListTab.SelectedIndex = ListTab.TabPages.Count - 1
5771 ListTabSelect(ListTab.TabPages(ListTab.TabPages.Count - 1))
5772 ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch").Focus()
5778 Private Sub TabMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabMenuItem.Click, CreateTabRuleOpMenuItem.Click
5780 For Each idx As Integer In _curList.SelectedIndices
5781 Dim tabName As String = ""
5783 If Not SelectTab(tabName) Then Exit For
5785 fDialog.SetCurrent(tabName)
5786 If _statuses.Item(_curTab.Text, idx).RetweetedId = 0 Then
5787 fDialog.AddNewFilter(_statuses.Item(_curTab.Text, idx).Name, _statuses.Item(_curTab.Text, idx).Data)
5789 fDialog.AddNewFilter(_statuses.Item(_curTab.Text, idx).RetweetedBy, _statuses.Item(_curTab.Text, idx).Data)
5791 fDialog.ShowDialog()
5792 Me.TopMost = SettingDialog.AlwaysTop
5796 Me.Cursor = Cursors.WaitCursor
5797 _itemCache = Nothing
5798 _postCache = Nothing
5801 _statuses.FilterAll()
5802 For Each tb As TabPage In ListTab.TabPages
5803 DirectCast(tb.Tag, DetailsListView).VirtualListSize = _statuses.Tabs(tb.Text).AllCount
5804 If _statuses.Tabs(tb.Text).UnreadCount > 0 Then
5805 If SettingDialog.TabIconDisp Then
5809 If SettingDialog.TabIconDisp Then
5814 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
5816 Me.Cursor = Cursors.Default
5818 'SaveConfigsCommon()
5819 'SaveConfigsTab(False)
5823 Protected Overrides Function ProcessDialogKey( _
5824 ByVal keyData As Keys) As Boolean
5825 'TextBox1でEnterを押してもビープ音が鳴らないようにする
5826 If (keyData And Keys.KeyCode) = Keys.Enter Then
5827 If StatusText.Focused Then
5829 If StatusText.Multiline AndAlso _
5830 (keyData And Keys.Shift) = Keys.Shift AndAlso _
5831 (keyData And Keys.Control) <> Keys.Control Then
5832 Dim pos1 As Integer = StatusText.SelectionStart
5833 If StatusText.SelectionLength > 0 Then
5834 StatusText.Text = StatusText.Text.Remove(pos1, StatusText.SelectionLength) '選択状態文字列削除
5836 StatusText.Text = StatusText.Text.Insert(pos1, Environment.NewLine) '改行挿入
5837 StatusText.SelectionStart = pos1 + Environment.NewLine.Length 'カーソルを改行の次の文字へ移動
5841 If (Not StatusText.Multiline AndAlso _
5842 ((keyData And Keys.Control) = Keys.Control AndAlso SettingDialog.PostCtrlEnter) OrElse _
5843 ((keyData And Keys.Control) <> Keys.Control AndAlso Not SettingDialog.PostCtrlEnter)) OrElse _
5844 (StatusText.Multiline AndAlso _
5845 (Not SettingDialog.PostCtrlEnter AndAlso _
5846 ((keyData And Keys.Control) <> Keys.Control AndAlso (keyData And Keys.Shift) <> Keys.Shift) OrElse _
5847 ((keyData And Keys.Control) = Keys.Control AndAlso (keyData And Keys.Shift) = Keys.Shift)) OrElse _
5848 (SettingDialog.PostCtrlEnter AndAlso (keyData And Keys.Control) = Keys.Control)) Then
5849 PostButton_Click(Nothing, Nothing)
5852 ElseIf _statuses.Tabs(ListTab.SelectedTab.Text).TabType = TabUsageType.PublicSearch AndAlso _
5853 (ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch").Focused OrElse _
5854 ListTab.SelectedTab.Controls("panelSearch").Controls("comboLang").Focused) Then
5855 Me.SearchButton_Click(ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch"), Nothing)
5860 Return MyBase.ProcessDialogKey(keyData)
5863 Private Sub InfoTwitterMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InfoTwitterMenuItem.Click
5864 If tw.InfoTwitter.Trim() = "" Then
5865 MessageBox.Show(My.Resources.InfoTwitterMenuItem_ClickText1, My.Resources.InfoTwitterMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Information)
5867 Dim inf As String = tw.InfoTwitter.Trim()
5868 inf = "<html><head></head><body>" + inf + "</body></html>"
5869 PostBrowser.Visible = False
5870 PostBrowser.DocumentText = inf
5871 PostBrowser.Visible = True
5875 Private Sub ReplyAllStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReplyAllStripMenuItem.Click, ReplyAllOpMenuItem.Click
5876 MakeReplyOrDirectStatus(False, True, True)
5879 Private Sub IDRuleMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IDRuleMenuItem.Click, CreateIdRuleOpMenuItem.Click
5880 Dim tabName As String = ""
5883 If _curList.SelectedIndices.Count = 0 Then Exit Sub
5886 If Not SelectTab(tabName) Then Exit Sub
5888 Dim mv As Boolean = False
5889 Dim mk As Boolean = False
5892 Dim ids As New List(Of String)
5893 For Each idx As Integer In _curList.SelectedIndices
5894 Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
5895 If Not ids.Contains(post.Name) Then
5896 Dim fc As New FiltersClass
5898 If post.RetweetedId = 0 Then
5899 fc.NameFilter = post.Name
5901 fc.NameFilter = post.RetweetedBy
5903 fc.SearchBoth = True
5907 fc.SearchUrl = False
5908 _statuses.Tabs(tabName).AddFilter(fc)
5913 Me.Cursor = Cursors.WaitCursor
5914 _itemCache = Nothing
5915 _postCache = Nothing
5918 _statuses.FilterAll()
5919 For Each tb As TabPage In ListTab.TabPages
5920 DirectCast(tb.Tag, DetailsListView).VirtualListSize = _statuses.Tabs(tb.Text).AllCount
5921 If _statuses.ContainsTab(tb.Text) Then
5922 If _statuses.Tabs(tb.Text).UnreadCount > 0 Then
5923 If SettingDialog.TabIconDisp Then
5927 If SettingDialog.TabIconDisp Then
5933 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
5935 Me.Cursor = Cursors.Default
5937 'SaveConfigsCommon()
5938 'SaveConfigsTab(False)
5942 Private Function SelectTab(ByRef tabName As String) As Boolean
5945 If TabDialog.ShowDialog = Windows.Forms.DialogResult.Cancel Then
5946 Me.TopMost = SettingDialog.AlwaysTop
5949 Me.TopMost = SettingDialog.AlwaysTop
5950 tabName = TabDialog.SelectedTabName
5952 ListTab.SelectedTab.Focus()
5954 If tabName = My.Resources.IDRuleMenuItem_ClickText1 Then
5955 Using inputName As New InputTabName()
5956 inputName.TabName = _statuses.GetUniqueTabName
5957 inputName.ShowDialog()
5958 tabName = inputName.TabName
5961 Me.TopMost = SettingDialog.AlwaysTop
5962 If tabName <> "" Then
5963 If Not AddNewTab(tabName, False, TabUsageType.UserDefined) Then
5964 Dim tmp As String = String.Format(My.Resources.IDRuleMenuItem_ClickText2, tabName)
5965 MessageBox.Show(tmp, My.Resources.IDRuleMenuItem_ClickText3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
5968 _statuses.AddTab(tabName, TabUsageType.UserDefined)
5980 Private Sub MoveOrCopy(ByRef move As Boolean, ByRef mark As Boolean)
5983 Dim _tmp As String = String.Format(My.Resources.IDRuleMenuItem_ClickText4, Environment.NewLine)
5984 If MessageBox.Show(_tmp, My.Resources.IDRuleMenuItem_ClickText5, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
5992 Dim _tmp As String = String.Format(My.Resources.IDRuleMenuItem_ClickText6, vbCrLf)
5993 If MessageBox.Show(_tmp, My.Resources.IDRuleMenuItem_ClickText7, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
6000 Private Sub CopySTOTMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopySTOTMenuItem.Click
6004 Private Sub CopyURLMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyURLMenuItem.Click
6008 Private Sub SelectAllMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllMenuItem.Click, SelAllOpMenuItem.Click
6009 If StatusText.Focused Then
6011 StatusText.SelectAll()
6014 For i As Integer = 0 To _curList.VirtualListSize - 1
6015 _curList.SelectedIndices.Add(i)
6020 Private Sub MoveMiddle()
6021 Dim _item As ListViewItem
6025 If _curList.SelectedIndices.Count = 0 Then Exit Sub
6027 Dim idx As Integer = _curList.SelectedIndices(0)
6029 _item = _curList.GetItemAt(0, 25)
6030 If _item Is Nothing Then
6035 _item = _curList.GetItemAt(0, _curList.ClientSize.Height - 1)
6036 If _item Is Nothing Then
6037 idx2 = _curList.VirtualListSize - 1
6042 idx -= Math.Abs(idx1 - idx2) \ 2
6043 If idx < 0 Then idx = 0
6045 _curList.EnsureVisible(_curList.VirtualListSize - 1)
6046 _curList.EnsureVisible(idx)
6049 'Private Sub WedataMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WedataMenuItem.Click
6050 ' Twitter.GetWedata()
6053 Private Sub OpenURLMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenURLMenuItem.Click, OpenUrlOpMenuItem.Click
6054 If PostBrowser.Document.Links.Count > 0 Then
6055 UrlDialog.ClearUrl()
6057 Dim openUrlStr As String = ""
6059 If PostBrowser.Document.Links.Count = 1 Then
6060 Dim urlStr As String = ""
6062 urlStr = IDNDecode(PostBrowser.Document.Links(0).GetAttribute("href"))
6063 Catch ex As ArgumentException
6067 If String.IsNullOrEmpty(urlStr) Then Exit Sub
6068 openUrlStr = urlEncodeMultibyteChar(urlStr)
6070 For Each linkElm As HtmlElement In PostBrowser.Document.Links
6071 Dim urlStr As String = ""
6073 urlStr = IDNDecode(linkElm.GetAttribute("href"))
6074 Catch ex As ArgumentException
6078 If String.IsNullOrEmpty(urlStr) Then Continue For
6079 UrlDialog.AddUrl(urlEncodeMultibyteChar(urlStr))
6082 If UrlDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
6083 openUrlStr = UrlDialog.SelectedUrl
6085 Catch ex As Exception
6088 Me.TopMost = SettingDialog.AlwaysTop
6090 If String.IsNullOrEmpty(openUrlStr) Then Exit Sub
6092 If openUrlStr.StartsWith("http://twitter.com/search?q=%23") OrElse _
6093 openUrlStr.StartsWith("https://twitter.com/search?q=%23") Then
6095 Dim urlStr As String = HttpUtility.UrlDecode(openUrlStr)
6096 Dim hash As String = urlStr.Substring(urlStr.IndexOf("#"))
6097 AddNewTabForSearch(hash)
6101 openUrlStr = openUrlStr.Replace("://twitter.com/search?q=#", "://twitter.com/search?q=%23")
6102 OpenUriAsync(openUrlStr)
6106 Private Sub ClearTabMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearTabMenuItem.Click, ClearTbMenuItem.Click
6107 If _rclickTabName = "" Then Exit Sub
6108 Dim tmp As String = String.Format(My.Resources.ClearTabMenuItem_ClickText1, Environment.NewLine)
6109 If MessageBox.Show(tmp, My.Resources.ClearTabMenuItem_ClickText2, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then
6113 _statuses.ClearTabIds(_rclickTabName)
6114 If ListTab.SelectedTab.Text = _rclickTabName Then
6115 _anchorPost = Nothing
6117 _itemCache = Nothing
6118 _postCache = Nothing
6119 _itemCacheIndex = -1
6123 For Each tb As TabPage In ListTab.TabPages
6124 If tb.Text = _rclickTabName Then
6126 DirectCast(tb.Tag, DetailsListView).VirtualListSize = 0
6130 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
6132 SetMainWindowTitle()
6136 Private Sub SetMainWindowTitle()
6138 Dim ttl As New StringBuilder(256)
6139 Dim ur As Integer = 0
6140 Dim al As Integer = 0
6141 Static myVer As String = fileVersion
6142 If SettingDialog.DispLatestPost <> DispTitleEnum.None AndAlso _
6143 SettingDialog.DispLatestPost <> DispTitleEnum.Post AndAlso _
6144 SettingDialog.DispLatestPost <> DispTitleEnum.Ver Then
6145 For Each key As String In _statuses.Tabs.Keys
6146 ur += _statuses.Tabs(key).UnreadCount
6147 al += _statuses.Tabs(key).AllCount
6151 If SettingDialog.DispUsername Then ttl.Append(tw.Username).Append(" - ")
6152 ttl.Append("Tween ")
6153 Select Case SettingDialog.DispLatestPost
6154 Case DispTitleEnum.Ver
6155 ttl.Append("Ver:").Append(myVer)
6156 Case DispTitleEnum.Post
6157 If _history IsNot Nothing AndAlso _history.Count > 1 Then
6158 ttl.Append(_history(_history.Count - 2).Replace(vbCrLf, ""))
6160 Case DispTitleEnum.UnreadRepCount
6161 ttl.AppendFormat(My.Resources.SetMainWindowTitleText1, _statuses.GetTabByType(TabUsageType.Mentions).UnreadCount + _statuses.GetTabByType(TabUsageType.DirectMessage).UnreadCount)
6162 Case DispTitleEnum.UnreadAllCount
6163 ttl.AppendFormat(My.Resources.SetMainWindowTitleText2, ur)
6164 Case DispTitleEnum.UnreadAllRepCount
6165 ttl.AppendFormat(My.Resources.SetMainWindowTitleText3, ur, _statuses.GetTabByType(TabUsageType.Mentions).UnreadCount + _statuses.GetTabByType(TabUsageType.DirectMessage).UnreadCount)
6166 Case DispTitleEnum.UnreadCountAllCount
6167 ttl.AppendFormat(My.Resources.SetMainWindowTitleText4, ur, al)
6171 Me.Text = ttl.ToString()
6172 Catch ex As AccessViolationException
6173 '原因不明。ポスト内容に依存か?たまーに発生するが再現せず。
6177 Private Sub SetStatusLabel()
6179 'タブ未読数/タブ発言数 全未読数/総発言数 (未読@+未読DM数)
6180 If _statuses Is Nothing Then Exit Sub
6181 Dim tbRep As TabClass = _statuses.GetTabByType(TabUsageType.Mentions)
6182 Dim tbDm As TabClass = _statuses.GetTabByType(TabUsageType.DirectMessage)
6183 If tbRep Is Nothing OrElse tbDm Is Nothing Then Exit Sub
6184 Dim urat As Integer = tbRep.UnreadCount + tbDm.UnreadCount
6185 Dim ur As Integer = 0
6186 Dim al As Integer = 0
6187 Dim tur As Integer = 0
6188 Dim tal As Integer = 0
6189 Dim slbl As StringBuilder = New StringBuilder(256)
6191 For Each key As String In _statuses.Tabs.Keys
6192 ur += _statuses.Tabs(key).UnreadCount
6193 al += _statuses.Tabs(key).AllCount
6194 If key.Equals(_curTab.Text) Then
6195 tur = _statuses.Tabs(key).UnreadCount
6196 tal = _statuses.Tabs(key).AllCount
6199 Catch ex As Exception
6203 If tw.RemainCountApi > -1 Then
6204 slbl.Append("[API: " + tw.RemainCountApi.ToString + "] ")
6206 slbl.AppendFormat(My.Resources.SetStatusLabelText1, tur, tal, ur, al, urat, _postTimestamps.Count, _favTimestamps.Count, _tlCount)
6207 If SettingDialog.TimelinePeriodInt = 0 Then
6208 slbl.Append(My.Resources.SetStatusLabelText2)
6210 slbl.Append((SettingDialog.TimelinePeriodInt - _homeCounterAdjuster).ToString() + My.Resources.SetStatusLabelText3)
6213 StatusLabelUrl.Text = slbl.ToString()
6216 Private Sub SetNotifyIconText()
6217 ' タスクトレイアイコンのツールチップテキスト書き換え
6218 If SettingDialog.DispUsername Then
6219 NotifyIcon1.Text = tw.Username + " - Tween"
6221 NotifyIcon1.Text = "Tween"
6225 Friend Sub CheckReplyTo(ByVal StatusText As String)
6226 Dim m As MatchCollection
6228 Dim hash As New Regex("(^|[^a-zA-Z0-9_/])[#|#](?<hash>[a-zA-Z0-9_]+)")
6229 m = hash.Matches(StatusText)
6230 Dim hstr As String = ""
6231 For Each hm As Match In m
6232 If Not IsNumeric(hm.Result("${hash}")) Then
6233 If Not hstr.Contains("#" + hm.Result("${hash}") + " ") Then
6234 hstr += "#" + hm.Result("${hash}") + " "
6235 HashSupl.AddItem("#" + hm.Result("${hash}"))
6239 If HashMgr.UseHash <> "" AndAlso Not hstr.Contains(HashMgr.UseHash + " ") Then
6240 hstr += HashMgr.UseHash
6242 If hstr <> "" Then HashMgr.AddHashToHistory(hstr.Trim, False)
6244 ' 本当にリプライ先指定すべきかどうかの判定
6245 Dim id As New Regex("(^|[ -/:-@[-^`{-~])(?<id>@[a-zA-Z0-9_]+)")
6247 m = id.Matches(StatusText)
6249 If SettingDialog.UseAtIdSupplement Then
6250 Dim bCnt As Integer = AtIdSupl.ItemCount
6251 For Each mid As Match In m
6252 AtIdSupl.AddItem(mid.Result("${id}"))
6254 If bCnt <> AtIdSupl.ItemCount Then modifySettingAtId = True
6257 ' リプライ先ステータスIDの指定がない場合は指定しない
6258 If _reply_to_id = 0 Then Exit Sub
6260 ' リプライ先ユーザー名がない場合も指定しない
6261 If _reply_to_name = "" Then
6267 ' 次の条件を満たす場合に in_reply_to_status_id 指定
6268 ' 1. Twitterによりリンクと判定される @idが文中に1つ含まれる (2009/5/28 リンク化される@IDのみカウントするように修正)
6269 ' 2. リプライ先ステータスIDが設定されている(リストをダブルクリックで返信している)
6270 ' 3. 文中に含まれた@idがリプライ先のポスト者のIDと一致する
6272 If m IsNot Nothing AndAlso Not StatusText.StartsWith(". ") Then
6273 For Each mid As Match In m
6274 If mid.Result("${id}") = "@" + _reply_to_name Then
6279 'If m IsNot Nothing AndAlso m.Count = 1 AndAlso m.Item(0).Value = "@" + _reply_to_name AndAlso Not StatusText.StartsWith(". ") Then
6288 Private Sub TweenMain_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
6289 If Not _initialLayout AndAlso SettingDialog.MinimizeToTray AndAlso WindowState = FormWindowState.Minimized Then
6292 If _initialLayout AndAlso _cfgLocal IsNot Nothing AndAlso Me.WindowState = FormWindowState.Normal AndAlso Me.Visible = True Then
6293 Me.ClientSize = _cfgLocal.FormSize
6294 '_mySize = Me.ClientSize 'サイズ保持(最小化・最大化されたまま終了した場合の対応用)
6295 Me.DesktopLocation = _cfgLocal.FormLocation
6296 '_myLoc = Me.DesktopLocation '位置保持(最小化・最大化されたまま終了した場合の対応用)
6297 Me.SplitContainer1.SplitterDistance = _cfgLocal.SplitterDistance 'Splitterの位置設定
6299 StatusText.Multiline = _cfgLocal.StatusMultiline
6300 If StatusText.Multiline Then
6301 SplitContainer2.SplitterDistance = SplitContainer2.Height - _cfgLocal.StatusTextHeight - SplitContainer2.SplitterWidth
6303 SplitContainer2.SplitterDistance = SplitContainer2.Height - SplitContainer2.Panel2MinSize - SplitContainer2.SplitterWidth
6305 _initialLayout = False
6309 Private Sub PlaySoundMenuItem_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlaySoundMenuItem.CheckedChanged, PlaySoundFileMenuItem.CheckStateChanged
6310 PlaySoundMenuItem.Checked = DirectCast(sender, ToolStripMenuItem).Checked
6311 Me.PlaySoundFileMenuItem.Checked = PlaySoundMenuItem.Checked
6312 If PlaySoundMenuItem.Checked Then
6313 SettingDialog.PlaySound = True
6315 SettingDialog.PlaySound = False
6317 modifySettingCommon = True
6318 'SaveConfigsCommon()
6321 Private Sub SplitContainer1_SplitterMoved(ByVal sender As Object, ByVal e As System.Windows.Forms.SplitterEventArgs) Handles SplitContainer1.SplitterMoved
6322 If Me.WindowState = FormWindowState.Normal AndAlso Not _initialLayout Then
6323 _mySpDis = SplitContainer1.SplitterDistance
6324 If StatusText.Multiline Then _mySpDis2 = StatusText.Height
6325 modifySettingLocal = True
6329 Private Sub RepliedStatusOpenMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RepliedStatusOpenMenuItem.Click, OpenRepSourceOpMenuItem.Click
6330 If _curPost IsNot Nothing AndAlso _curPost.InReplyToUser IsNot Nothing AndAlso _curPost.InReplyToId > 0 Then
6331 If _statuses.ContainsKey(_curPost.InReplyToId) AndAlso Not My.Computer.Keyboard.ShiftKeyDown Then
6332 Dim repPost As PostClass = _statuses.Item(_curPost.InReplyToId)
6333 MessageBox.Show(repPost.Name + " / " + repPost.Nickname + " (" + repPost.PDate.ToString() + ")" + Environment.NewLine + repPost.Data)
6335 OpenUriAsync("http://twitter.com/" + _curPost.InReplyToUser + "/status/" + _curPost.InReplyToId.ToString())
6340 Private Sub ContextMenuStrip3_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip3.Opening
6341 '発言詳細のアイコン右クリック時のメニュー制御
6342 If _curList.SelectedIndices.Count > 0 AndAlso _curPost IsNot Nothing Then
6343 Dim name As String = _curPost.ImageUrl
6344 If name.Length > 0 Then
6345 name = IO.Path.GetFileNameWithoutExtension(name.Substring(name.LastIndexOf("/"c)))
6346 name = name.Substring(0, name.Length - 7) ' "_normal".Length
6347 Me.IconNameToolStripMenuItem.Enabled = True
6348 If Me.TIconDic.ContainsKey(_curPost.ImageUrl) AndAlso Me.TIconDic(_curPost.ImageUrl) IsNot Nothing Then
6349 Me.SaveIconPictureToolStripMenuItem.Enabled = True
6351 Me.SaveIconPictureToolStripMenuItem.Enabled = False
6353 Me.IconNameToolStripMenuItem.Text = name
6355 Me.IconNameToolStripMenuItem.Enabled = False
6356 Me.SaveIconPictureToolStripMenuItem.Enabled = False
6357 Me.IconNameToolStripMenuItem.Text = My.Resources.ContextMenuStrip3_OpeningText1
6360 Me.IconNameToolStripMenuItem.Enabled = False
6361 Me.SaveIconPictureToolStripMenuItem.Enabled = False
6362 Me.IconNameToolStripMenuItem.Text = My.Resources.ContextMenuStrip3_OpeningText2
6366 Private Sub IconNameToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IconNameToolStripMenuItem.Click
6367 If _curPost Is Nothing Then Exit Sub
6368 Dim name As String = _curPost.ImageUrl
6369 OpenUriAsync(name.Remove(name.LastIndexOf("_normal"), 7)) ' "_normal".Length
6372 Private Sub SaveOriginalSizeIconPictureToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
6373 If _curPost Is Nothing Then Exit Sub
6374 Dim name As String = _curPost.ImageUrl
6375 name = IO.Path.GetFileNameWithoutExtension(name.Substring(name.LastIndexOf("/"c)))
6377 Me.SaveFileDialog1.FileName = name.Substring(0, name.Length - 8) ' "_normal".Length + 1
6379 If Me.SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
6384 Private Sub SaveIconPictureToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveIconPictureToolStripMenuItem.Click
6385 If _curPost Is Nothing Then Exit Sub
6386 Dim name As String = _curPost.ImageUrl
6388 Me.SaveFileDialog1.FileName = name.Substring(name.LastIndexOf("/"c) + 1)
6390 If Me.SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
6391 Using bmp2 As New Bitmap(TIconDic(name).Size.Width, TIconDic(name).Size.Height)
6392 Using g As Graphics = Graphics.FromImage(bmp2)
6393 g.InterpolationMode = Drawing2D.InterpolationMode.High
6394 g.DrawImage(TIconDic(name), 0, 0, TIconDic(name).Size.Width, TIconDic(name).Size.Height)
6397 bmp2.Save(Me.SaveFileDialog1.FileName)
6403 Private Sub SplitContainer2_Panel2_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SplitContainer2.Panel2.Resize
6404 Me.StatusText.Multiline = Me.SplitContainer2.Panel2.Height > Me.SplitContainer2.Panel2MinSize + 2
6405 MultiLineMenuItem.Checked = Me.StatusText.Multiline
6406 modifySettingLocal = True
6409 Private Sub StatusText_MultilineChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusText.MultilineChanged
6410 If Me.StatusText.Multiline Then
6411 Me.StatusText.ScrollBars = ScrollBars.Vertical
6413 Me.StatusText.ScrollBars = ScrollBars.None
6415 modifySettingLocal = True
6418 Private Sub MultiLineMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MultiLineMenuItem.Click
6420 StatusText.Multiline = MultiLineMenuItem.Checked
6421 _cfgLocal.StatusMultiline = MultiLineMenuItem.Checked
6422 If MultiLineMenuItem.Checked Then
6423 If SplitContainer2.Height - _mySpDis2 - SplitContainer2.SplitterWidth < 0 Then
6424 SplitContainer2.SplitterDistance = 0
6426 SplitContainer2.SplitterDistance = SplitContainer2.Height - _mySpDis2 - SplitContainer2.SplitterWidth
6429 SplitContainer2.SplitterDistance = SplitContainer2.Height - SplitContainer2.Panel2MinSize - SplitContainer2.SplitterWidth
6431 modifySettingLocal = True
6434 Private Function UrlConvert(ByVal Converter_Type As UrlConverter) As Boolean
6435 'Converter_Type=Nicomsの場合は、nicovideoのみ短縮する
6436 Dim result As String = ""
6437 Dim url As Regex = New Regex("(?<before>(?:[^\/""':!=]|^|\:))" + _
6438 "(?<url>(?<protocol>https?://|www\.)" + _
6439 "(?<domain>(?:[\.-]|[^\p{P}])+\.[a-z]{2,}(?::[0-9]+)?)" + _
6440 "(?<path>/[a-z0-9!*'();:&=+$/%#\[\]\-_.,~]*[a-z0-9)=#/]?)?" + _
6441 "(?<query>\?[a-z0-9!*'();:&=+$/%#\[\]\-_.,~]*[a-z0-9_&=#])?)", RegexOptions.IgnoreCase Or RegexOptions.Compiled)
6442 'Dim url As Regex = New Regex("(?<![0-9A-Za-z])(?:https?|shttp)://(?:(?:[-_.!~*'()a-zA-Z0-9;:&=+$,]|%[0-9A-Fa-f" + _
6443 ' "][0-9A-Fa-f])*@)?(?:(?:[a-zA-Z0-9](?:[-a-zA-Z0-9]*[a-zA-Z0-9])?\.)" + _
6444 ' "*[a-zA-Z](?:[-a-zA-Z0-9]*[a-zA-Z0-9])?\.?|[0-9]+\.[0-9]+\.[0-9]+\." + _
6445 ' "[0-9]+)(?::[0-9]*)?(?:/(?:[-_.!~*'()a-zA-Z0-9:@&=+$,]|%[0-9A-Fa-f]" + _
6446 ' "[0-9A-Fa-f])*(?:;(?:[-_.!~*'()a-zA-Z0-9:@&=+$,]|%[0-9A-Fa-f][0-9A-" + _
6447 ' "Fa-f])*)*(?:/(?:[-_.!~*'()a-zA-Z0-9:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f" + _
6448 ' "])*(?:;(?:[-_.!~*'()a-zA-Z0-9:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*)*)" + _
6449 ' "*)?(?:\?(?:[-_.!~*'()a-zA-Z0-9;/?:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])" + _
6450 ' "*)?(?:#(?:[-_.!~*'()a-zA-Z0-9;/?:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*)?")
6451 Dim nico As Regex = New Regex("^https?://[a-z]+\.(nicovideo|niconicommons)\.jp/[a-z]+/[a-z0-9]+$")
6453 If StatusText.SelectionLength > 0 Then
6454 Dim tmp As String = StatusText.SelectedText
6455 ' httpから始まらない場合、ExcludeStringで指定された文字列で始まる場合は対象としない
6456 If tmp.StartsWith("http") Then
6457 ' 文字列が選択されている場合はその文字列について処理
6459 'nico.ms使用、nicovideoにマッチしたら変換
6460 If SettingDialog.Nicoms AndAlso nico.IsMatch(tmp) Then
6461 result = tw.MakeShortNicoms(tmp)
6462 If result.Equals("Can't convert") Then
6463 StatusLabel.Text = result.Insert(0, "nico.ms:")
6466 ElseIf Converter_Type <> UrlConverter.Nicoms Then
6467 '短縮URL変換 日本語を含むかもしれないのでURLエンコードする
6468 result = tw.MakeShortUrl(Converter_Type, tmp)
6469 If result.Equals("Can't convert") Then
6470 StatusLabel.Text = result.Insert(0, Converter_Type.ToString() + ":")
6477 If Not result = "" Then
6478 Dim undotmp As New urlUndo
6480 StatusText.Select(StatusText.Text.IndexOf(tmp, StringComparison.Ordinal), tmp.Length)
6481 StatusText.SelectedText = result
6484 undotmp.Before = tmp
6485 undotmp.After = result
6487 If urlUndoBuffer Is Nothing Then
6488 urlUndoBuffer = New List(Of urlUndo)
6489 UrlUndoToolStripMenuItem.Enabled = True
6492 urlUndoBuffer.Add(undotmp)
6496 ' 正規表現にマッチしたURL文字列をtinyurl化
6497 For Each mt As Match In url.Matches(StatusText.Text)
6498 If StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal) = -1 Then Continue For
6499 Dim tmp As String = mt.Result("${url}")
6500 If tmp.StartsWith("w", StringComparison.OrdinalIgnoreCase) Then tmp = "http://" + tmp
6501 Dim undotmp As New urlUndo
6504 StatusText.Select(StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal), mt.Result("${url}").Length)
6506 'nico.ms使用、nicovideoにマッチしたら変換
6507 If SettingDialog.Nicoms AndAlso nico.IsMatch(tmp) Then
6508 result = tw.MakeShortNicoms(tmp)
6509 If result.Equals("Can't convert") Then
6510 StatusLabel.Text = result.Insert(0, "nico.ms:")
6513 ElseIf Converter_Type <> UrlConverter.Nicoms Then
6514 '短縮URL変換 日本語を含むかもしれないのでURLエンコードする
6515 result = tw.MakeShortUrl(Converter_Type, tmp)
6516 If result.Equals("Can't convert") Then
6517 StatusLabel.Text = result.Insert(0, Converter_Type.ToString() + ":")
6524 If Not result = "" Then
6525 StatusText.Select(StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal), mt.Result("${url}").Length)
6526 StatusText.SelectedText = result
6528 undotmp.Before = mt.Result("${url}")
6529 undotmp.After = result
6531 If urlUndoBuffer Is Nothing Then
6532 urlUndoBuffer = New List(Of urlUndo)
6533 UrlUndoToolStripMenuItem.Enabled = True
6536 urlUndoBuffer.Add(undotmp)
6545 Private Sub doUrlUndo()
6546 If urlUndoBuffer IsNot Nothing Then
6547 Dim tmp As String = StatusText.Text
6548 For Each data As urlUndo In urlUndoBuffer
6549 tmp = tmp.Replace(data.After, data.Before)
6551 StatusText.Text = tmp
6552 urlUndoBuffer = Nothing
6553 UrlUndoToolStripMenuItem.Enabled = False
6557 Private Sub TinyURLToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TinyURLToolStripMenuItem.Click
6558 UrlConvert(UrlConverter.TinyUrl)
6561 Private Sub IsgdToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IsgdToolStripMenuItem.Click
6562 UrlConvert(UrlConverter.Isgd)
6565 Private Sub TwurlnlToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TwurlnlToolStripMenuItem.Click
6566 UrlConvert(UrlConverter.Twurl)
6569 Private Sub UrlConvertAutoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UrlConvertAutoToolStripMenuItem.Click
6570 If Not UrlConvert(SettingDialog.AutoShortUrlFirst) Then
6571 Dim svc As UrlConverter = SettingDialog.AutoShortUrlFirst
6572 Dim rnd As New Random()
6573 ' 前回使用した短縮URLサービス以外を選択する
6575 svc = CType(rnd.Next(System.Enum.GetNames(GetType(UrlConverter)).Length), UrlConverter)
6576 Loop Until svc <> SettingDialog.AutoShortUrlFirst
6581 Private Sub UrlUndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UrlUndoToolStripMenuItem.Click
6585 Private Sub NewPostPopMenuItem_CheckStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles NewPostPopMenuItem.CheckStateChanged, NotifyFileMenuItem.CheckStateChanged
6586 Me.NotifyFileMenuItem.Checked = DirectCast(sender, ToolStripMenuItem).Checked
6587 Me.NewPostPopMenuItem.Checked = Me.NotifyFileMenuItem.Checked
6588 _cfgCommon.NewAllPop = NewPostPopMenuItem.Checked
6589 modifySettingCommon = True
6592 Private Sub ListLockMenuItem_CheckStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListLockMenuItem.CheckStateChanged, LockListFileMenuItem.CheckStateChanged
6593 ListLockMenuItem.Checked = DirectCast(sender, ToolStripMenuItem).Checked
6594 Me.LockListFileMenuItem.Checked = ListLockMenuItem.Checked
6595 _cfgCommon.ListLock = ListLockMenuItem.Checked
6596 modifySettingCommon = True
6599 Private Sub MenuStrip1_MenuActivate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuStrip1.MenuActivate
6600 ' フォーカスがメニューに移る (MenuStrip1.Tag フラグを立てる)
6601 MenuStrip1.Tag = New Object()
6602 MenuStrip1.Select() ' StatusText がフォーカスを持っている場合 Leave が発生
6605 Private Sub MenuStrip1_MenuDeactivate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuStrip1.MenuDeactivate
6606 If Me.Tag IsNot Nothing Then ' 設定された戻り先へ遷移
6607 DirectCast(Me.Tag, Control).Select()
6608 Else ' 戻り先が指定されていない (初期状態) 場合はタブに遷移
6609 If ListTab.SelectedIndex > -1 AndAlso ListTab.SelectedTab.HasChildren Then
6610 Me.Tag = ListTab.SelectedTab.Tag
6611 DirectCast(Me.Tag, Control).Select()
6614 ' フォーカスがメニューに遷移したかどうかを表すフラグを降ろす
6615 MenuStrip1.Tag = Nothing
6618 Private Sub MyList_ColumnReordered(ByVal sender As System.Object, ByVal e As ColumnReorderedEventArgs)
6619 Dim lst As DetailsListView = DirectCast(sender, DetailsListView)
6620 If _cfgLocal Is Nothing Then Exit Sub
6623 _cfgLocal.Width1 = lst.Columns(0).Width
6624 _cfgLocal.Width3 = lst.Columns(1).Width
6626 Dim darr(lst.Columns.Count - 1) As Integer
6627 For i As Integer = 0 To lst.Columns.Count - 1
6628 darr(lst.Columns(i).DisplayIndex) = i
6630 MoveArrayItem(darr, e.OldDisplayIndex, e.NewDisplayIndex)
6632 For i As Integer = 0 To lst.Columns.Count - 1
6635 _cfgLocal.DisplayIndex1 = i
6637 _cfgLocal.DisplayIndex2 = i
6639 _cfgLocal.DisplayIndex3 = i
6641 _cfgLocal.DisplayIndex4 = i
6643 _cfgLocal.DisplayIndex5 = i
6645 _cfgLocal.DisplayIndex6 = i
6647 _cfgLocal.DisplayIndex7 = i
6649 _cfgLocal.DisplayIndex8 = i
6652 _cfgLocal.Width1 = lst.Columns(0).Width
6653 _cfgLocal.Width2 = lst.Columns(1).Width
6654 _cfgLocal.Width3 = lst.Columns(2).Width
6655 _cfgLocal.Width4 = lst.Columns(3).Width
6656 _cfgLocal.Width5 = lst.Columns(4).Width
6657 _cfgLocal.Width6 = lst.Columns(5).Width
6658 _cfgLocal.Width7 = lst.Columns(6).Width
6659 _cfgLocal.Width8 = lst.Columns(7).Width
6661 modifySettingLocal = True
6662 _isColumnChanged = True
6665 Private Sub MyList_ColumnWidthChanged(ByVal sender As System.Object, ByVal e As ColumnWidthChangedEventArgs)
6666 Dim lst As DetailsListView = DirectCast(sender, DetailsListView)
6667 'Dim changed As Boolean = False
6668 If _cfgLocal Is Nothing Then Exit Sub
6670 If _cfgLocal.Width1 <> lst.Columns(0).Width Then
6671 _cfgLocal.Width1 = lst.Columns(0).Width
6672 modifySettingLocal = True
6673 _isColumnChanged = True
6675 If _cfgLocal.Width3 <> lst.Columns(1).Width Then
6676 _cfgLocal.Width3 = lst.Columns(1).Width
6677 modifySettingLocal = True
6678 _isColumnChanged = True
6681 If _cfgLocal.Width1 <> lst.Columns(0).Width Then
6682 _cfgLocal.Width1 = lst.Columns(0).Width
6683 modifySettingLocal = True
6684 _isColumnChanged = True
6686 If _cfgLocal.Width2 <> lst.Columns(1).Width Then
6687 _cfgLocal.Width2 = lst.Columns(1).Width
6688 modifySettingLocal = True
6689 _isColumnChanged = True
6691 If _cfgLocal.Width3 <> lst.Columns(2).Width Then
6692 _cfgLocal.Width3 = lst.Columns(2).Width
6693 modifySettingLocal = True
6694 _isColumnChanged = True
6696 If _cfgLocal.Width4 <> lst.Columns(3).Width Then
6697 _cfgLocal.Width4 = lst.Columns(3).Width
6698 modifySettingLocal = True
6699 _isColumnChanged = True
6701 If _cfgLocal.Width5 <> lst.Columns(4).Width Then
6702 _cfgLocal.Width5 = lst.Columns(4).Width
6703 modifySettingLocal = True
6704 _isColumnChanged = True
6706 If _cfgLocal.Width6 <> lst.Columns(5).Width Then
6707 _cfgLocal.Width6 = lst.Columns(5).Width
6708 modifySettingLocal = True
6709 _isColumnChanged = True
6711 If _cfgLocal.Width7 <> lst.Columns(6).Width Then
6712 _cfgLocal.Width7 = lst.Columns(6).Width
6713 modifySettingLocal = True
6714 _isColumnChanged = True
6716 If _cfgLocal.Width8 <> lst.Columns(7).Width Then
6717 _cfgLocal.Width8 = lst.Columns(7).Width
6718 modifySettingLocal = True
6719 _isColumnChanged = True
6722 ' 非表示の時にColumnChangedが呼ばれた場合はForm初期化処理中なので保存しない
6724 ' SaveConfigsLocal()
6728 Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
6730 'PostBrowser.Document.ExecCommand("Copy", False, Nothing)
6731 'SendKeys.Send("^c")
6732 Dim typ As Type = PostBrowser.ActiveXInstance.GetType()
6733 Dim _SelObj As Object = typ.InvokeMember("selection", BindingFlags.GetProperty, Nothing, PostBrowser.Document.DomDocument, Nothing)
6734 Dim _objRange As Object = _SelObj.GetType().InvokeMember("createRange", BindingFlags.InvokeMethod, Nothing, _SelObj, Nothing)
6735 Dim _selText As String = DirectCast(_objRange.GetType().InvokeMember("text", BindingFlags.GetProperty, Nothing, _objRange, Nothing), String)
6737 Clipboard.SetDataObject(_selText, False, 5, 100)
6738 Catch ex As Exception
6739 MessageBox.Show(ex.Message)
6743 Private Sub doSearchToolStrip(ByVal url As String)
6744 '発言詳細で「選択文字列で検索」(選択文字列取得)
6745 Dim typ As Type = PostBrowser.ActiveXInstance.GetType()
6746 Dim _SelObj As Object = typ.InvokeMember("selection", BindingFlags.GetProperty, Nothing, PostBrowser.Document.DomDocument, Nothing)
6747 Dim _objRange As Object = _SelObj.GetType().InvokeMember("createRange", BindingFlags.InvokeMethod, Nothing, _SelObj, Nothing)
6748 Dim _selText As String = DirectCast(_objRange.GetType().InvokeMember("text", BindingFlags.GetProperty, Nothing, _objRange, Nothing), String)
6750 If _selText IsNot Nothing Then
6751 If url = My.Resources.SearchItem4Url Then
6753 AddNewTabForSearch(_selText)
6757 Dim tmp As String = String.Format(url, HttpUtility.UrlEncode(_selText))
6762 Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
6764 PostBrowser.Document.ExecCommand("SelectAll", False, Nothing)
6767 Private Sub SearchItem1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchItem1ToolStripMenuItem.Click
6768 doSearchToolStrip(My.Resources.SearchItem1Url)
6771 Private Sub SearchItem2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchItem2ToolStripMenuItem.Click
6772 doSearchToolStrip(My.Resources.SearchItem2Url)
6775 Private Sub SearchItem3ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchItem3ToolStripMenuItem.Click
6776 doSearchToolStrip(My.Resources.SearchItem3Url)
6779 Private Sub SearchItem4ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchItem4ToolStripMenuItem.Click
6780 doSearchToolStrip(My.Resources.SearchItem4Url)
6783 Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
6785 'If PostBrowser.StatusText.StartsWith("http") Then '念のため
6787 Clipboard.SetDataObject(PostBrowser.StatusText, False, 5, 100)
6788 Catch ex As Exception
6789 MessageBox.Show(ex.Message)
6794 Private Sub ContextMenuStrip4_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip4.Opening
6796 If PostBrowser.StatusText.StartsWith("http") Then
6797 ToolStripMenuItem4.Enabled = True
6798 If Regex.IsMatch(PostBrowser.StatusText, "^https?://twitter.com/[a-zA-Z0-9_]+$") Then
6799 FollowContextMenuItem.Enabled = True
6800 RemoveContextMenuItem.Enabled = True
6801 FriendshipContextMenuItem.Enabled = True
6803 FollowContextMenuItem.Enabled = False
6804 RemoveContextMenuItem.Enabled = False
6805 FriendshipContextMenuItem.Enabled = False
6807 If Regex.IsMatch(PostBrowser.StatusText, "^https?://twitter.com/search\?q=%23") Then
6808 UseHashtagMenuItem.Enabled = True
6810 UseHashtagMenuItem.Enabled = False
6813 ToolStripMenuItem4.Enabled = False
6814 FollowContextMenuItem.Enabled = False
6815 RemoveContextMenuItem.Enabled = False
6816 FriendshipContextMenuItem.Enabled = False
6817 UseHashtagMenuItem.Enabled = False
6819 ' 文字列選択されていないときは選択文字列関係の項目を非表示に
6820 Dim _selText As String = PostBrowser_GetSelectionText()
6821 If _selText Is Nothing Then
6822 ToolStripMenuItem2.Enabled = False
6823 ToolStripMenuItem3.Enabled = False
6825 ToolStripMenuItem2.Enabled = True
6826 ToolStripMenuItem3.Enabled = True
6831 Private Function PostBrowser_GetSelectionText() As String
6832 Dim typ As Type = PostBrowser.ActiveXInstance.GetType()
6833 Dim _SelObj As Object = typ.InvokeMember("selection", BindingFlags.GetProperty, Nothing, PostBrowser.Document.DomDocument, Nothing)
6834 Dim _objRange As Object = _SelObj.GetType().InvokeMember("createRange", BindingFlags.InvokeMethod, Nothing, _SelObj, Nothing)
6835 Return DirectCast(_objRange.GetType().InvokeMember("text", BindingFlags.GetProperty, Nothing, _objRange, Nothing), String)
6838 Private Sub CurrentTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CurrentTabToolStripMenuItem.Click
6839 '発言詳細の選択文字列で現在のタブを検索
6840 Dim _selText As String = PostBrowser_GetSelectionText()
6842 If _selText IsNot Nothing Then
6843 SearchDialog.SWord = _selText
6844 SearchDialog.CheckCaseSensitive = False
6845 SearchDialog.CheckRegex = False
6847 DoTabSearch(SearchDialog.SWord, _
6848 SearchDialog.CheckCaseSensitive, _
6849 SearchDialog.CheckRegex, _
6850 SEARCHTYPE.NextSearch)
6854 Private Sub SplitContainer2_SplitterMoved(ByVal sender As Object, ByVal e As System.Windows.Forms.SplitterEventArgs) Handles SplitContainer2.SplitterMoved
6855 If StatusText.Multiline Then _mySpDis2 = StatusText.Height
6856 modifySettingLocal = True
6859 Private Sub TweenMain_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop
6860 Dim data As String = TryCast(e.Data.GetData(DataFormats.StringFormat, True), String)
6861 If data IsNot Nothing Then
6862 StatusText.Text += data
6866 Private Sub TweenMain_DragOver(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragOver
6867 Dim data As String = TryCast(e.Data.GetData(DataFormats.StringFormat, True), String)
6868 If data IsNot Nothing Then
6869 e.Effect = DragDropEffects.Copy
6871 e.Effect = DragDropEffects.None
6875 Private Function IsNetworkAvailable() As Boolean
6876 Dim nw As Boolean = True
6878 nw = My.Computer.Network.IsAvailable
6879 Catch ex As Exception
6882 _myStatusOnline = nw
6886 Private Sub OpenUriAsync(ByVal UriString As String)
6887 Dim args As New GetWorkerArg
6888 args.type = WORKERTYPE.OpenUri
6889 args.status = UriString
6894 Private Sub ListTabSelect(ByVal _tab As TabPage)
6897 _itemCache = Nothing
6898 _itemCacheIndex = -1
6899 _postCache = Nothing
6902 _curList = DirectCast(_tab.Tag, DetailsListView)
6903 If _curList.SelectedIndices.Count > 0 Then
6904 _curItemIndex = _curList.SelectedIndices(0)
6905 _curPost = GetCurTabPost(_curItemIndex)
6911 _anchorPost = Nothing
6915 Private Sub ListTab_Selecting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TabControlCancelEventArgs) Handles ListTab.Selecting
6916 ListTabSelect(e.TabPage)
6919 Private Sub SelectListItem(ByVal LView As DetailsListView, ByVal Index As Integer)
6921 Dim bnd As Rectangle
6922 Dim flg As Boolean = False
6923 If LView.FocusedItem IsNot Nothing Then
6924 bnd = LView.FocusedItem.Bounds
6928 LView.SelectedIndices.Clear()
6929 LView.Items(Index).Selected = True
6930 LView.Items(Index).Focused = True
6932 If flg Then LView.Invalidate(bnd)
6935 Private Sub SelectListItem(ByVal LView As DetailsListView, ByVal Index() As Integer, ByVal FocusedIndex As Integer)
6937 Dim bnd As Rectangle
6938 Dim flg As Boolean = False
6939 If LView.FocusedItem IsNot Nothing Then
6940 bnd = LView.FocusedItem.Bounds
6944 If Index IsNot Nothing AndAlso Index(0) > -1 Then
6945 LView.SelectedIndices.Clear()
6946 For Each idx As Integer In Index
6947 LView.SelectedIndices.Add(idx)
6950 If FocusedIndex > -1 Then
6951 LView.Items(FocusedIndex).Focused = True
6953 If flg Then LView.Invalidate(bnd)
6956 Private Sub RunAsync(ByVal args As GetWorkerArg)
6957 Dim bw As BackgroundWorker = Nothing
6958 If args.type <> WORKERTYPE.Follower Then
6959 For i As Integer = 0 To _bw.Length - 1
6960 If _bw(i) IsNot Nothing AndAlso Not _bw(i).IsBusy Then
6965 If bw Is Nothing Then
6966 For i As Integer = 0 To _bw.Length - 1
6967 If _bw(i) Is Nothing Then
6968 _bw(i) = New BackgroundWorker
6970 bw.WorkerReportsProgress = True
6971 bw.WorkerSupportsCancellation = True
6972 AddHandler bw.DoWork, AddressOf GetTimelineWorker_DoWork
6973 AddHandler bw.ProgressChanged, AddressOf GetTimelineWorker_ProgressChanged
6974 AddHandler bw.RunWorkerCompleted, AddressOf GetTimelineWorker_RunWorkerCompleted
6980 If _bwFollower Is Nothing Then
6981 _bwFollower = New BackgroundWorker
6983 bw.WorkerReportsProgress = True
6984 bw.WorkerSupportsCancellation = True
6985 AddHandler bw.DoWork, AddressOf GetTimelineWorker_DoWork
6986 AddHandler bw.ProgressChanged, AddressOf GetTimelineWorker_ProgressChanged
6987 AddHandler bw.RunWorkerCompleted, AddressOf GetTimelineWorker_RunWorkerCompleted
6989 If _bwFollower.IsBusy = False Then
6994 If bw Is Nothing Then Exit Sub
6996 bw.RunWorkerAsync(args)
6999 Private Sub TweenMain_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
7000 'If Me.WindowState = FormWindowState.Minimized AndAlso SettingDialog.MinimizeToTray Then
7001 ' Me.Visible = False
7004 PostBrowser.Url = New Uri("about:blank")
7005 PostBrowser.DocumentText = "" '発言詳細部初期化
7006 Catch ex As Exception
7010 If IsNetworkAvailable() Then
7011 If SettingDialog.StartupFollowers Then
7012 '_waitFollower = True
7013 GetTimeline(WORKERTYPE.Follower, 0, 0, "")
7015 _waitTimeline = True
7016 GetTimeline(WORKERTYPE.Timeline, 1, 1, "")
7017 'If SettingDialog.ReadPages > 0 Then
7018 ' _waitTimeline = True
7019 ' GetTimeline(WORKERTYPE.Timeline, 1, SettingDialog.ReadPages, "")
7022 GetTimeline(WORKERTYPE.Reply, 1, 1, "")
7023 'If SettingDialog.ReadPagesReply > 0 Then
7025 ' GetTimeline(WORKERTYPE.Reply, 1, SettingDialog.ReadPagesReply, "")
7028 GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, 1, "")
7029 'If SettingDialog.ReadPagesDM > 0 Then
7031 ' GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, SettingDialog.ReadPagesDM, "")
7034 GetTimeline(WORKERTYPE.Favorites, 1, 1, "")
7035 'If SettingDialog.GetFav Then
7037 ' GetTimeline(WORKERTYPE.Favorites, 1, 1, "")
7039 _waitPubSearch = True
7040 GetTimeline(WORKERTYPE.PublicSearch, 1, 0, "") 'tabname="":全タブ
7041 Dim i As Integer = 0
7042 Do While (_waitTimeline OrElse _waitReply OrElse _waitDm OrElse _waitFav OrElse _waitPubSearch) AndAlso Not _endingFlag
7043 System.Threading.Thread.Sleep(100)
7044 My.Application.DoEvents()
7047 If Not _endingFlag Then
7048 _statuses.DistributePosts()
7057 If _endingFlag Then Exit Sub
7059 _statuses.DistributePosts()
7062 'バージョンチェック(引数:起動時チェックの場合はTrue・・・チェック結果のメッセージを表示しない)
7063 If SettingDialog.StartupVersion Then
7064 CheckNewVersion(True)
7067 '' Webモードで起動した場合に警告する
7068 'If Not SettingDialog.StartupAPImodeNoWarning AndAlso Not SettingDialog.UseAPI Then
7069 ' If MessageBox.Show(My.Resources.WebModeWarning1 + Environment.NewLine + My.Resources.WebModeWarning2 + Environment.NewLine + My.Resources.WebModeWarning3 + Environment.NewLine + My.Resources.WebModeWarning4, My.Resources.WebModeWarning5, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.OK Then
7070 ' SettingDialog.UseAPI = True
7071 ' 'SaveConfigsCommon()
7072 ' MessageBox.Show(My.Resources.WebModeWarning6)
7074 ' MessageBox.Show(My.Resources.WebModeWarning7)
7075 ' 'MessageBox.Show("取得間隔に注意してください。タイムライン取得系APIはRecent,Reply,DMの合計で1時間に" + GetMaxCountApi.ToString() + "回までしか使えません。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning)
7080 PostButton.Enabled = False
7081 FavAddToolStripMenuItem.Enabled = False
7082 FavRemoveToolStripMenuItem.Enabled = False
7083 MoveToHomeToolStripMenuItem.Enabled = False
7084 MoveToFavToolStripMenuItem.Enabled = False
7085 DeleteStripMenuItem.Enabled = False
7086 RefreshStripMenuItem.Enabled = False
7089 TimerTimeline.Enabled = True
7092 Private Sub doGetFollowersMenu(ByVal CacheInvalidate As Boolean)
7093 GetTimeline(WORKERTYPE.Follower, 1, 0, "")
7095 ' StatusLabel.Text = My.Resources.UpdateFollowersMenuItem1_ClickText1
7096 ' My.Application.DoEvents()
7097 ' Me.Cursor = Cursors.WaitCursor
7099 ' If SettingDialog.UseAPI Then
7100 ' ret = Twitter.GetFollowersApi()
7102 ' ret = Twitter.GetFollowers(CacheInvalidate)
7105 ' StatusLabel.Text = My.Resources.UpdateFollowersMenuItem1_ClickText2 & ret
7108 ' StatusLabel.Text = My.Resources.UpdateFollowersMenuItem1_ClickText3
7110 ' Me.Cursor = Cursors.Default
7114 Private Sub GetFollowersDiffToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetFollowersDiffToolStripMenuItem.Click
7115 doGetFollowersMenu(False) ' Followersリストキャッシュ有効
7118 Private Sub GetFollowersAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetFollowersAllToolStripMenuItem.Click
7119 doGetFollowersMenu(True) ' Followersリストキャッシュ無効
7122 Private Sub ReTweetStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReTweetStripMenuItem.Click, RtUnOpMenuItem.Click
7124 If _curPost IsNot Nothing Then
7125 If _curPost.IsDm OrElse _
7126 Not StatusText.Enabled Then Exit Sub
7128 If SettingDialog.ProtectNotInclude AndAlso _curPost.IsProtect Then
7129 MessageBox.Show("Protected.")
7132 Dim rtdata As String = _curPost.OriginalData
7133 rtdata = CreateRetweet(rtdata)
7135 StatusText.Text = "RT @" + _curPost.Name + ": " + HttpUtility.HtmlDecode(rtdata)
7137 StatusText.SelectionStart = 0
7142 Private Sub ReTweetOriginalStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReTweetOriginalStripMenuItem.Click, RtOpMenuItem.Click
7144 If _curPost IsNot Nothing AndAlso Not _curPost.IsDm Then
7145 If SettingDialog.ProtectNotInclude AndAlso _curPost.IsProtect Then
7146 MessageBox.Show("Protected.")
7149 If MessageBox.Show(My.Resources.RetweetQuestion1, "Retweet", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then
7152 Dim args As New GetWorkerArg
7153 args.ids = New List(Of Long)
7154 args.sIds = New List(Of Long)
7155 args.tName = _curTab.Text
7156 args.type = WORKERTYPE.Retweet
7157 args.ids.Add(_curPost.Id)
7164 'If _curPost IsNot Nothing Then
7165 ' If _curPost.IsDm OrElse _
7166 ' Not StatusText.Enabled Then Exit Sub
7168 ' If SettingDialog.ProtectNotInclude AndAlso _curPost.IsProtect Then
7169 ' MessageBox.Show("Protected.")
7173 ' Dim rtdata As String = _curPost.OriginalData
7174 ' rtdata = CreateRetweet(rtdata)
7176 ' Dim rx As New Regex("^(?<multi>(RT @[0-9a-zA-Z_]+\s?:\s?)*)(?<org>RT @[0-9a-zA-Z_]+\s?:)")
7177 ' If rx.IsMatch(rtdata) Then
7178 ' StatusText.Text = HttpUtility.HtmlDecode(rx.Replace(rtdata, "${org}"))
7180 ' StatusText.Text = "RT @" + _curPost.Name + ": " + HttpUtility.HtmlDecode(rtdata)
7183 ' StatusText.SelectionStart = 0
7184 ' StatusText.Focus()
7188 Private Function CreateRetweet(ByVal status As String) As String
7190 ' Twitterにより省略されているURLを含むaタグをキャプチャしてリンク先URLへ置き換える
7193 Dim isUrl As Boolean = False
7194 Dim rx As Regex = New Regex("<a target=""_self"" href=""(?<url>[^""]+)""[^>]*>(?<link>(https?|shttp|ftps?)://[^<]+)</a>")
7195 Dim ms As MatchCollection = rx.Matches(status)
7196 For Each m As Match In ms
7197 If m.Result("${link}").EndsWith("...") Then
7203 status = rx.Replace(status, "${url}")
7205 status = rx.Replace(status, "${link}")
7208 'その他のリンク(@IDなど)を置き換える
7209 rx = New Regex("@<a target=""_self"" href=""https?://twitter.com/(?<url>[^""]+)""[^>]*>(?<link>[^<]+)</a>")
7210 status = rx.Replace(status, "@${url}")
7212 rx = New Regex("<a target=""_self"" href=""(?<url>[^""]+)""[^>]*>(?<link>[^<]+)</a>")
7213 status = rx.Replace(status, "${link}")
7215 If StatusText.Multiline Then
7216 status = Regex.Replace(status, "(\r\n|\n|\r)?<br>", vbCrLf, RegexOptions.IgnoreCase Or RegexOptions.Multiline)
7218 status = Regex.Replace(status, "(\r\n|\n|\r)?<br>", "", RegexOptions.IgnoreCase Or RegexOptions.Multiline)
7223 status = status.Replace(" ", " ")
7228 Private Sub DumpPostClassToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DumpPostClassToolStripMenuItem.Click
7229 If _curPost IsNot Nothing Then
7234 Private Sub MenuItemHelp_DropDownOpening(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItemHelp.DropDownOpening
7235 If DebugBuild OrElse My.Computer.Keyboard.CapsLock AndAlso My.Computer.Keyboard.CtrlKeyDown AndAlso My.Computer.Keyboard.ShiftKeyDown Then
7236 DebugModeToolStripMenuItem.Visible = True
7238 DebugModeToolStripMenuItem.Visible = False
7242 Private Sub ToolStripMenuItemUrlAutoShorten_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemUrlAutoShorten.CheckedChanged
7243 SettingDialog.UrlConvertAuto = ToolStripMenuItemUrlAutoShorten.Checked
7244 'SaveConfigsCommon()
7247 Private Sub ContextMenuStripPostMode_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStripPostMode.Opening
7248 ToolStripMenuItemUrlAutoShorten.Checked = SettingDialog.UrlConvertAuto
7251 Private Sub TraceOutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TraceOutToolStripMenuItem.Click
7252 If TraceOutToolStripMenuItem.Checked Then
7259 Private Sub TweenMain_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Deactivate
7260 '画面が非アクティブになったら、発言欄の背景色をデフォルトへ
7261 Me.StatusText_Leave(StatusText, System.EventArgs.Empty)
7264 Private Sub TabRenameMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabRenameMenuItem.Click, RenameTbMenuItem.Click
7265 If _rclickTabName = "" Then Exit Sub
7266 TabRename(_rclickTabName)
7269 Private Sub UnuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnuToolStripMenuItem.Click
7270 UrlConvert(UrlConverter.Unu)
7273 Private Sub BitlyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BitlyToolStripMenuItem.Click
7274 UrlConvert(UrlConverter.Bitly)
7277 Private Sub JmpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JmpStripMenuItem.Click
7278 UrlConvert(UrlConverter.Jmp)
7281 Private Sub ApiInfoMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApiInfoMenuItem.Click
7282 Dim info As New ApiInfo
7285 If tw.GetInfoApi(info) Then
7286 tmp = My.Resources.ApiInfo1 + info.MaxCount.ToString() + Environment.NewLine + _
7287 My.Resources.ApiInfo2 + info.RemainCount.ToString + Environment.NewLine + _
7288 My.Resources.ApiInfo3 + info.ResetTime.ToString()
7290 tmp = My.Resources.ApiInfo5
7292 MessageBox.Show(tmp, My.Resources.ApiInfo4, MessageBoxButtons.OK, MessageBoxIcon.Information)
7295 Private Sub FollowCommandMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FollowCommandMenuItem.Click
7296 Dim id As String = ""
7297 If _curPost IsNot Nothing Then id = _curPost.Name
7301 Private Sub FollowCommand(ByVal id As String)
7302 Using inputName As New InputTabName()
7303 inputName.FormTitle = "Follow"
7304 inputName.FormDescription = My.Resources.FRMessage1
7305 inputName.TabName = id
7306 If inputName.ShowDialog() = Windows.Forms.DialogResult.OK AndAlso _
7307 Not String.IsNullOrEmpty(inputName.TabName.Trim()) Then
7308 Dim ret As String = tw.PostFollowCommand(inputName.TabName.Trim())
7309 If Not String.IsNullOrEmpty(ret) Then
7310 MessageBox.Show(My.Resources.FRMessage2 + ret)
7312 MessageBox.Show(My.Resources.FRMessage3)
7319 Private Sub RemoveCommandMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveCommandMenuItem.Click
7320 Dim id As String = ""
7321 If _curPost IsNot Nothing Then id = _curPost.Name
7325 Private Sub RemoveCommand(ByVal id As String)
7326 Using inputName As New InputTabName()
7327 inputName.FormTitle = "Unfollow"
7328 inputName.FormDescription = My.Resources.FRMessage1
7329 inputName.TabName = id
7330 If inputName.ShowDialog() = Windows.Forms.DialogResult.OK AndAlso _
7331 Not String.IsNullOrEmpty(inputName.TabName.Trim()) Then
7332 Dim ret As String = tw.PostRemoveCommand(inputName.TabName.Trim())
7333 If Not String.IsNullOrEmpty(ret) Then
7334 MessageBox.Show(My.Resources.FRMessage2 + ret)
7336 MessageBox.Show(My.Resources.FRMessage3)
7343 Private Sub FriendshipMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FriendshipMenuItem.Click
7344 Dim id As String = ""
7345 If _curPost IsNot Nothing Then
7351 Private Sub ShowFriendship(ByVal id As String)
7352 Using inputName As New InputTabName()
7353 inputName.FormTitle = "Show Friendships"
7354 inputName.FormDescription = My.Resources.FRMessage1
7355 inputName.TabName = id
7356 If inputName.ShowDialog() = Windows.Forms.DialogResult.OK AndAlso _
7357 Not String.IsNullOrEmpty(inputName.TabName.Trim()) Then
7358 Dim isFollowing As Boolean = False
7359 Dim isFollowed As Boolean = False
7360 Dim result As String = ""
7361 id = inputName.TabName.Trim
7362 Dim ret As String = tw.GetFriendshipInfo(id, isFollowing, isFollowed)
7365 result = My.Resources.GetFriendshipInfo1 + System.Environment.NewLine
7367 result = My.Resources.GetFriendshipInfo2 + System.Environment.NewLine
7370 result += My.Resources.GetFriendshipInfo3
7372 result += My.Resources.GetFriendshipInfo4
7374 result = id + My.Resources.GetFriendshipInfo5 + System.Environment.NewLine + result
7378 MessageBox.Show(result)
7384 Private Sub OwnStatusMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OwnStatusMenuItem.Click
7385 Dim loc As String = ""
7386 Dim bio As String = ""
7387 If Not String.IsNullOrEmpty(tw.Location) Then
7390 If Not String.IsNullOrEmpty(tw.Bio) Then
7393 If tw.FriendsCount = 0 AndAlso tw.FollowersCount = 0 AndAlso tw.StatusesCount = 0 AndAlso loc = "" AndAlso bio = "" Then
7394 MessageBox.Show(My.Resources.ShowYourProfileText1, "Your status", MessageBoxButtons.OK, MessageBoxIcon.Information)
7397 MessageBox.Show("Following : " + tw.FriendsCount.ToString() + Environment.NewLine + _
7398 "Followers : " + tw.FollowersCount.ToString() + Environment.NewLine + _
7399 "Statuses count : " + tw.StatusesCount.ToString() + Environment.NewLine + _
7400 "Location : " + loc + Environment.NewLine + _
7401 "Bio : " + bio, "Your status")
7404 Private Sub FollowContextMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FollowContextMenuItem.Click
7405 Dim m As Match = Regex.Match(PostBrowser.StatusText, "^https?://twitter.com/(?<name>[a-zA-Z0-9_]+)$")
7407 FollowCommand(m.Result("${name}"))
7411 Private Sub RemoveContextMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveContextMenuItem.Click
7412 Dim m As Match = Regex.Match(PostBrowser.StatusText, "^https?://twitter.com/(?<name>[a-zA-Z0-9_]+)$")
7414 RemoveCommand(m.Result("${name}"))
7418 Private Sub FriendshipContextMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FriendshipContextMenuItem.Click
7419 Dim m As Match = Regex.Match(PostBrowser.StatusText, "^https?://twitter.com/(?<name>[a-zA-Z0-9_]+)$")
7421 ShowFriendship(m.Result("${name}"))
7425 Private Sub IdeographicSpaceToSpaceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IdeographicSpaceToSpaceToolStripMenuItem.Click
7426 modifySettingCommon = True
7429 'Private Sub UserPicture_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles UserPicture.Paint
7430 ' If e.Graphics.InterpolationMode <> Drawing2D.InterpolationMode.HighQualityBicubic Then
7431 ' e.Graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
7432 ' UserPicture.GetType().GetMethod("OnPaint", BindingFlags.NonPublic Or BindingFlags.Instance).Invoke(UserPicture, New Object() {e})
7436 Private Sub QuoteStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles QuoteStripMenuItem.Click, QtOpMenuItem.Click
7439 If _curPost IsNot Nothing Then
7440 If _curPost.IsDm OrElse _
7441 Not StatusText.Enabled Then Exit Sub
7443 If SettingDialog.ProtectNotInclude AndAlso _curPost.IsProtect Then
7444 MessageBox.Show("Protected.")
7447 Dim rtdata As String = _curPost.OriginalData
7448 rtdata = CreateRetweet(rtdata)
7450 StatusText.Text = " QT @" + _curPost.Name + ": " + HttpUtility.HtmlDecode(rtdata)
7451 If _curPost.RetweetedId = 0 Then
7452 _reply_to_id = _curPost.Id
7454 _reply_to_id = _curPost.RetweetedId
7456 _reply_to_name = _curPost.Name
7458 StatusText.SelectionStart = 0
7463 Private Sub SearchButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
7465 Dim pnl As Control = DirectCast(sender, Control).Parent
7466 If pnl Is Nothing Then Exit Sub
7467 Dim tbName As String = pnl.Parent.Text
7468 Dim tb As TabClass = _statuses.Tabs(tbName)
7469 Dim cmb As ComboBox = DirectCast(pnl.Controls("comboSearch"), ComboBox)
7470 Dim cmbLang As ComboBox = DirectCast(pnl.Controls("comboLang"), ComboBox)
7471 cmb.Text = cmb.Text.Trim
7472 tb.SearchWords = cmb.Text
7473 tb.SearchLang = cmbLang.Text
7474 If cmb.Text = "" Then
7475 DirectCast(ListTab.SelectedTab.Tag, DetailsListView).Focus()
7479 If tb.IsQueryChanged Then
7480 Dim idx As Integer = DirectCast(pnl.Controls("comboSearch"), ComboBox).Items.IndexOf(tb.SearchWords)
7481 If idx > -1 Then DirectCast(pnl.Controls("comboSearch"), ComboBox).Items.RemoveAt(idx)
7482 DirectCast(pnl.Controls("comboSearch"), ComboBox).Items.Insert(0, tb.SearchWords)
7483 Dim lst As DetailsListView = DirectCast(pnl.Parent.Tag, DetailsListView)
7484 lst.VirtualListSize = 0
7486 _statuses.ClearTabIds(tbName)
7487 SaveConfigsTabs() '検索条件の保存
7490 GetTimeline(WORKERTYPE.PublicSearch, 1, 0, tbName)
7491 DirectCast(ListTab.SelectedTab.Tag, DetailsListView).Focus()
7494 Private Sub RefreshMoreStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshMoreStripMenuItem.Click, RefreshPrevOpMenuItem.Click
7499 Private Sub UndoRemoveTabMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoRemoveTabMenuItem.Click
7500 If _statuses.RemovedTab Is Nothing Then
7501 MessageBox.Show("There isn't removed tab.", "Undo", MessageBoxButtons.OK, MessageBoxIcon.Information)
7504 Dim tb As TabClass = _statuses.RemovedTab
7505 _statuses.RemovedTab = Nothing
7506 Dim renamed As String = tb.TabName
7507 For i As Integer = 1 To Integer.MaxValue
7508 If Not _statuses.ContainsTab(renamed) Then Exit For
7509 renamed = tb.TabName + "(" + i.ToString + ")"
7511 tb.TabName = renamed
7512 _statuses.Tabs.Add(renamed, tb)
7513 AddNewTab(renamed, False, tb.TabType)
7514 ListTab.SelectedIndex = ListTab.TabPages.Count - 1
7519 Private Sub MoveToRTHomeMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MoveToRTHomeMenuItem.Click, OpenRterHomeMenuItem.Click
7520 If _curList.SelectedIndices.Count > 0 Then
7521 Dim post As PostClass = GetCurTabPost(_curList.SelectedIndices(0))
7522 If post.RetweetedId > 0 Then
7523 OpenUriAsync("http://twitter.com/" + GetCurTabPost(_curList.SelectedIndices(0)).RetweetedBy)
7528 Private Sub IdFilterAddMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IdFilterAddMenuItem.Click
7529 Dim m As Match = Regex.Match(PostBrowser.StatusText, "^https?://twitter.com/(?<name>[a-zA-Z0-9_]+)$")
7531 Dim tabName As String = ""
7534 If _curList.SelectedIndices.Count = 0 Then Exit Sub
7537 If Not SelectTab(tabName) Then Exit Sub
7539 Dim mv As Boolean = False
7540 Dim mk As Boolean = False
7543 Dim fc As New FiltersClass
7544 fc.NameFilter = m.Result("${name}")
7545 fc.SearchBoth = True
7549 fc.SearchUrl = False
7550 _statuses.Tabs(tabName).AddFilter(fc)
7553 Me.Cursor = Cursors.WaitCursor
7554 _itemCache = Nothing
7555 _postCache = Nothing
7558 _statuses.FilterAll()
7559 For Each tb As TabPage In ListTab.TabPages
7560 DirectCast(tb.Tag, DetailsListView).VirtualListSize = _statuses.Tabs(tb.Text).AllCount
7561 If _statuses.Tabs(tb.Text).UnreadCount > 0 Then
7562 If SettingDialog.TabIconDisp Then
7566 If SettingDialog.TabIconDisp Then
7571 If Not SettingDialog.TabIconDisp Then ListTab.Refresh()
7573 Me.Cursor = Cursors.Default
7579 Private Sub SearchControls_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs)
7580 Dim pnl As Control = DirectCast(sender, Control)
7581 For Each ctl As Control In pnl.Controls
7586 Private Sub SearchControls_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs)
7587 Dim pnl As Control = DirectCast(sender, Control)
7588 For Each ctl As Control In pnl.Controls
7593 Private Sub PublicSearchQueryMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PublicSearchQueryMenuItem.Click
7594 If ListTab.SelectedTab IsNot Nothing Then
7595 If _statuses.Tabs(ListTab.SelectedTab.Text).TabType <> TabUsageType.PublicSearch Then Exit Sub
7596 ListTab.SelectedTab.Controls("panelSearch").Controls("comboSearch").Focus()
7600 Private Sub UseHashtagMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UseHashtagMenuItem.Click
7601 Dim m As Match = Regex.Match(PostBrowser.StatusText, "^https?://twitter.com/search\?q=%23(?<hash>[a-zA-Z0-9_]+)$")
7603 HashMgr.SetPermanentHash("#" + m.Result("${hash}"))
7604 HashStripSplitButton.Text = HashMgr.UseHash
7606 modifySettingCommon = True
7610 Private Sub StatusLabel_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusLabel.DoubleClick
7611 MessageBox.Show(StatusLabel.TextHistory, "Logs", MessageBoxButtons.OK, MessageBoxIcon.None)
7614 Private Sub HashManageMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HashManageMenuItem.Click
7615 Dim rslt As DialogResult
7617 rslt = HashMgr.ShowDialog()
7618 Catch ex As Exception
7621 Me.TopMost = SettingDialog.AlwaysTop
7622 If rslt = Windows.Forms.DialogResult.Cancel Then Exit Sub
7623 If HashMgr.UseHash <> "" Then
7624 HashStripSplitButton.Text = HashMgr.UseHash
7626 HashStripSplitButton.Text = "#[-]"
7628 'If HashMgr.IsInsert AndAlso HashMgr.UseHash <> "" Then
7629 ' Dim sidx As Integer = StatusText.SelectionStart
7630 ' Dim hash As String = HashMgr.UseHash + " "
7632 ' If StatusText.Text.Substring(sidx - 1, 1) <> " " Then
7636 ' StatusText.Text = StatusText.Text.Insert(sidx, hash)
7637 ' sidx += hash.Length
7638 ' StatusText.SelectionStart = sidx
7639 ' StatusText.Focus()
7641 modifySettingCommon = True
7644 Private Sub HashToggleMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles HashToggleMenuItem.Click
7645 HashMgr.ToggleHash()
7646 If HashMgr.UseHash <> "" Then
7647 HashStripSplitButton.Text = HashMgr.UseHash
7649 HashStripSplitButton.Text = "#[-]"
7651 modifySettingCommon = True
7654 Private Sub HashStripSplitButton_ButtonClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles HashStripSplitButton.ButtonClick
7655 HashToggleMenuItem_Click(Nothing, Nothing)
7658 Private Sub MenuItemOperate_DropDownOpening(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemOperate.DropDownOpening
7659 If ListTab.SelectedTab Is Nothing Then Exit Sub
7660 If _statuses Is Nothing OrElse _statuses.Tabs Is Nothing OrElse Not _statuses.Tabs.ContainsKey(ListTab.SelectedTab.Text) Then Exit Sub
7661 If _statuses.Tabs(ListTab.SelectedTab.Text).TabType = TabUsageType.DirectMessage Then
7662 Me.FavOpMenuItem.Enabled = False
7663 Me.UnFavOpMenuItem.Enabled = False
7664 Me.OpenStatusOpMenuItem.Enabled = False
7665 Me.OpenFavotterOpMenuItem.Enabled = False
7667 Me.FavOpMenuItem.Enabled = True
7668 Me.UnFavOpMenuItem.Enabled = True
7669 Me.OpenStatusOpMenuItem.Enabled = True
7670 Me.OpenFavotterOpMenuItem.Enabled = True
7672 If _curPost Is Nothing OrElse _curPost.IsDm Then
7673 Me.RtOpMenuItem.Enabled = False
7674 Me.RtUnOpMenuItem.Enabled = False
7675 Me.QtOpMenuItem.Enabled = False
7677 Me.RtOpMenuItem.Enabled = True
7678 Me.RtUnOpMenuItem.Enabled = True
7679 Me.QtOpMenuItem.Enabled = True
7681 If _statuses.Tabs(ListTab.SelectedTab.Text).TabType <> TabUsageType.Favorites Then
7682 Me.RefreshPrevOpMenuItem.Enabled = True
7684 Me.RefreshPrevOpMenuItem.Enabled = False
7688 Private Sub MenuItemTab_DropDownOpening(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemTab.DropDownOpening
7689 ContextMenuTabProperty_Opening(sender, Nothing)
7692 Public ReadOnly Property TwitterInstance() As Twitter