OSDN Git Service

未読ジャンプで中途半端な位置にジャンプする問題に対処したつもり
[opentween/open-tween.git] / Tween / AppendSettingDialog.vb
1 ' Tween - Client of Twitter
2 ' Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3 '           (c) 2008-2011 Moz (@syo68k)
4 '           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5 '           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6 '           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7 ' All rights reserved.
8
9 ' This file is part of Tween.
10
11 ' This program is free software; you can redistribute it and/or modify it
12 ' under the terms of the GNU General Public License as published by the Free
13 ' Software Foundation; either version 3 of the License, or (at your option)
14 ' any later version.
15
16 ' This program is distributed in the hope that it will be useful, but
17 ' WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 ' or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 ' for more details. 
20
21 ' You should have received a copy of the GNU General Public License along
22 ' with this program. If not, see <http://www.gnu.org/licenses/>, or write to
23 ' the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
24 ' Boston, MA 02110-1301, USA.
25
26 Imports System.Threading
27
28 Public Class AppendSettingDialog
29
30     Private Shared _instance As New AppendSettingDialog
31     Private tw As Twitter
32     Private _MytimelinePeriod As Integer
33     Private _MyDMPeriod As Integer
34     Private _MyPubSearchPeriod As Integer
35     Private _MyListsPeriod As Integer
36     Private _MyUserTimelinePeriod As Integer
37     Private _MyLogDays As Integer
38     Private _MyLogUnit As LogUnitEnum
39     Private _MyReaded As Boolean
40     Private _MyIconSize As IconSizes
41     Private _MyStatusText As String
42     Private _MyRecommendStatusText As String
43     Private _MyUnreadManage As Boolean
44     Private _MyPlaySound As Boolean
45     Private _MyOneWayLove As Boolean
46     Private _fntUnread As Font
47     Private _clUnread As Color
48     Private _fntReaded As Font
49     Private _clReaded As Color
50     Private _clFav As Color
51     Private _clOWL As Color
52     Private _clRetweet As Color
53     Private _fntDetail As Font
54     Private _clSelf As Color
55     Private _clAtSelf As Color
56     Private _clTarget As Color
57     Private _clAtTarget As Color
58     Private _clAtFromTarget As Color
59     Private _clAtTo As Color
60     Private _clInputBackcolor As Color
61     Private _clInputFont As Color
62     Private _fntInputFont As Font
63     Private _clListBackcolor As Color
64     Private _clDetailBackcolor As Color
65     Private _clDetail As Color
66     Private _clDetailLink As Color
67     Private _MyNameBalloon As NameBalloonEnum
68     Private _MyPostCtrlEnter As Boolean
69     Private _MyPostShiftEnter As Boolean
70     Private _usePostMethod As Boolean
71     Private _countApi As Integer
72     Private _countApiReply As Integer
73     Private _browserpath As String
74     Private _MyUseRecommendStatus As Boolean
75     Private _MyDispUsername As Boolean
76     Private _MyDispLatestPost As DispTitleEnum
77     Private _MySortOrderLock As Boolean
78     Private _MyMinimizeToTray As Boolean
79     Private _MyCloseToExit As Boolean
80     Private _MyTinyUrlResolve As Boolean
81     Private _MyProxyType As HttpConnection.ProxyType
82     Private _MyProxyAddress As String
83     Private _MyProxyPort As Integer
84     Private _MyProxyUser As String
85     Private _MyProxyPassword As String
86     Private _MyPeriodAdjust As Boolean
87     Private _MyStartupVersion As Boolean
88     Private _MyStartupFollowers As Boolean
89     Private _MyRestrictFavCheck As Boolean
90     Private _MyAlwaysTop As Boolean
91     Private _MyUrlConvertAuto As Boolean
92     Private _MyOutputz As Boolean
93     Private _MyOutputzKey As String
94     Private _MyOutputzUrlmode As OutputzUrlmode
95     Private _MyNicoms As Boolean
96     Private _MyUnreadStyle As Boolean
97     Private _MyDateTimeFormat As String
98     Private _MyDefaultTimeOut As Integer
99     Private _MyLimitBalloon As Boolean
100     Private _MyPostAndGet As Boolean
101     Private _MyReplyPeriod As Integer
102     Private _MyAutoShortUrlFirst As UrlConverter
103     Private _MyTabIconDisp As Boolean
104     Private _MyReplyIconState As REPLY_ICONSTATE
105     Private _MyReadOwnPost As Boolean
106     Private _MyGetFav As Boolean
107     Private _MyMonoSpace As Boolean
108     Private _MyReadOldPosts As Boolean
109     Private _MyUseSsl As Boolean
110     Private _MyBitlyId As String
111     Private _MyBitlyPw As String
112     Private _MyShowGrid As Boolean
113     Private _MyUseAtIdSupplement As Boolean
114     Private _MyUseHashSupplement As Boolean
115     Private _MyLanguage As String
116     Private _MyIsOAuth As Boolean
117     Private _MyTwitterApiUrl As String
118     Private _MyTwitterSearchApiUrl As String
119     Private _MyPreviewEnable As Boolean
120     Private _MoreCountApi As Integer
121     Private _FirstCountApi As Integer
122     Private _MyUseAdditonalCount As Boolean
123     Private _SearchCountApi As Integer
124     Private _FavoritesCountApi As Integer
125     Private _UserTimelineCountApi As Integer
126     Private _ListCountApi As Integer
127     Private _MyRetweetNoConfirm As Boolean
128     Private _MyUserstreamStartup As Boolean
129     Private _MyUserstreamPeriod As Integer
130     Private _MyOpenUserTimeline As Boolean
131
132     Private _ValidationError As Boolean = False
133     Private _MyEventNotifyEnabled As Boolean
134     Private _MyEventNotifyFlag As EVENTTYPE
135     Private _isMyEventNotifyFlag As EVENTTYPE
136     Private _MyForceEventNotify As Boolean
137     Private _MyFavEventUnread As Boolean
138     Private _MyTranslateLanguage As String
139     Private _soundfileListup As Boolean = False
140     Private _MyEventSoundFile As String
141
142     Private Sub TreeViewSetting_BeforeSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeViewSetting.BeforeSelect
143         If Me.TreeViewSetting.SelectedNode Is Nothing Then Exit Sub
144         Dim pnl = DirectCast(Me.TreeViewSetting.SelectedNode.Tag, Panel)
145         If pnl Is Nothing Then Exit Sub
146         pnl.Enabled = False
147         pnl.Visible = False
148     End Sub
149
150     Private Sub TreeViewSetting_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeViewSetting.AfterSelect
151         If e.Node Is Nothing Then Exit Sub
152         Dim pnl = DirectCast(e.Node.Tag, Panel)
153         If pnl Is Nothing Then Exit Sub
154         pnl.Enabled = True
155         pnl.Visible = True
156     End Sub
157
158     'Private Sub ToggleNodeChange(ByVal node As TreeNode)
159     '    If node Is Nothing Then Exit Sub
160     '    TreeViewSetting.BeginUpdate()
161     '    If node.IsExpanded Then
162     '        node.Collapse()
163     '    Else
164     '        node.Expand()
165     '    End If
166     '    TreeViewSetting.EndUpdate()
167     'End Sub
168
169     'Private Sub TreeViewSetting_DrawNode(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawTreeNodeEventArgs) Handles TreeViewSetting.DrawNode
170     '    e.DrawDefault = True
171     '    If (e.State And TreeNodeStates.Selected) = TreeNodeStates.Selected Then
172     '        Dim pnl = DirectCast(e.Node.Tag, Panel)
173     '        If pnl Is Nothing Then Exit Sub
174     '        If _curPanel IsNot Nothing Then
175     '            If pnl.Name <> _curPanel.Name Then
176     '                _curPanel.Enabled = False
177     '                _curPanel.Visible = False
178
179     '                _curPanel = pnl
180     '                pnl.Enabled = True
181     '                pnl.Visible = True
182     '            End If
183     '        End If
184     '    End If
185     'End Sub
186
187     'Private Sub TreeViewSetting_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeViewSetting.MouseDown
188     '    Dim info As TreeViewHitTestInfo = TreeViewSetting.HitTest(e.X, e.Y)
189     '    If CBool((info.Location And TreeViewHitTestLocations.Label)) Then
190     '        ToggleNodeChange(info.Node)
191     '    End If
192     'End Sub
193
194     Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click
195         If TweenMain.IsNetworkAvailable() AndAlso _
196             (ComboBoxAutoShortUrlFirst.SelectedIndex = UrlConverter.Bitly OrElse ComboBoxAutoShortUrlFirst.SelectedIndex = UrlConverter.Jmp) AndAlso _
197              (Not String.IsNullOrEmpty(TextBitlyId.Text) OrElse Not String.IsNullOrEmpty(TextBitlyPw.Text)) Then
198             If Not BitlyValidation(TextBitlyId.Text, TextBitlyPw.Text) Then
199                 MessageBox.Show(My.Resources.SettingSave_ClickText1)
200                 _ValidationError = True
201                 TreeViewSetting.SelectedNode.Name = "TweetActNode" ' 動作タブを選択
202                 TextBitlyId.Focus()
203                 Exit Sub
204             Else
205                 _ValidationError = False
206             End If
207         Else
208             _ValidationError = False
209         End If
210         If Me.Username.Focused OrElse Me.Password.Focused Then
211             If Not Authorize() Then
212                 _ValidationError = True
213                 Exit Sub
214             End If
215         End If
216         Try
217             _MyUserstreamPeriod = CType(Me.UserstreamPeriod.Text, Integer)
218             _MyUserstreamStartup = Me.StartupUserstreamCheck.Checked
219             _MyIsOAuth = AuthOAuthRadio.Checked
220             _MytimelinePeriod = CType(TimelinePeriod.Text, Integer)
221             _MyDMPeriod = CType(DMPeriod.Text, Integer)
222             _MyPubSearchPeriod = CType(PubSearchPeriod.Text, Integer)
223             _MyListsPeriod = CType(ListsPeriod.Text, Integer)
224             _MyReplyPeriod = CType(ReplyPeriod.Text, Integer)
225             _MyUserTimelinePeriod = CType(UserTimelinePeriod.Text, Integer)
226
227             _MyReaded = StartupReaded.Checked
228             Select Case IconSize.SelectedIndex
229                 Case 0
230                     _MyIconSize = IconSizes.IconNone
231                 Case 1
232                     _MyIconSize = IconSizes.Icon16
233                 Case 2
234                     _MyIconSize = IconSizes.Icon24
235                 Case 3
236                     _MyIconSize = IconSizes.Icon48
237                 Case 4
238                     _MyIconSize = IconSizes.Icon48_2
239             End Select
240             _MyStatusText = StatusText.Text
241             _MyPlaySound = PlaySnd.Checked
242             _MyUnreadManage = UReadMng.Checked
243             _MyOneWayLove = OneWayLv.Checked
244
245             _fntUnread = lblUnread.Font     '未使用
246             _clUnread = lblUnread.ForeColor
247             _fntReaded = lblListFont.Font     'リストフォントとして使用
248             _clReaded = lblListFont.ForeColor
249             _clFav = lblFav.ForeColor
250             _clOWL = lblOWL.ForeColor
251             _clRetweet = lblRetweet.ForeColor
252             _fntDetail = lblDetail.Font
253             _clSelf = lblSelf.BackColor
254             _clAtSelf = lblAtSelf.BackColor
255             _clTarget = lblTarget.BackColor
256             _clAtTarget = lblAtTarget.BackColor
257             _clAtFromTarget = lblAtFromTarget.BackColor
258             _clAtTo = lblAtTo.BackColor
259             _clInputBackcolor = lblInputBackcolor.BackColor
260             _clInputFont = lblInputFont.ForeColor
261             _clListBackcolor = lblListBackcolor.BackColor
262             _clDetailBackcolor = lblDetailBackcolor.BackColor
263             _clDetail = lblDetail.ForeColor
264             _clDetailLink = lblDetailLink.ForeColor
265             _fntInputFont = lblInputFont.Font
266             Select Case cmbNameBalloon.SelectedIndex
267                 Case 0
268                     _MyNameBalloon = NameBalloonEnum.None
269                 Case 1
270                     _MyNameBalloon = NameBalloonEnum.UserID
271                 Case 2
272                     _MyNameBalloon = NameBalloonEnum.NickName
273             End Select
274
275             Select Case ComboBoxPostKeySelect.SelectedIndex
276                 Case 2
277                     _MyPostShiftEnter = True
278                     _MyPostCtrlEnter = False
279                 Case 1
280                     _MyPostCtrlEnter = True
281                     _MyPostShiftEnter = False
282                 Case 0
283                     _MyPostCtrlEnter = False
284                     _MyPostShiftEnter = False
285             End Select
286             _usePostMethod = False
287             _countApi = CType(TextCountApi.Text, Integer)
288             _countApiReply = CType(TextCountApiReply.Text, Integer)
289             _browserpath = BrowserPathText.Text.Trim
290             _MyPostAndGet = CheckPostAndGet.Checked
291             _MyUseRecommendStatus = CheckUseRecommendStatus.Checked
292             _MyDispUsername = CheckDispUsername.Checked
293             _MyCloseToExit = CheckCloseToExit.Checked
294             _MyMinimizeToTray = CheckMinimizeToTray.Checked
295             Select Case ComboDispTitle.SelectedIndex
296                 Case 0  'None
297                     _MyDispLatestPost = DispTitleEnum.None
298                 Case 1  'Ver
299                     _MyDispLatestPost = DispTitleEnum.Ver
300                 Case 2  'Post
301                     _MyDispLatestPost = DispTitleEnum.Post
302                 Case 3  'RepCount
303                     _MyDispLatestPost = DispTitleEnum.UnreadRepCount
304                 Case 4  'AllCount
305                     _MyDispLatestPost = DispTitleEnum.UnreadAllCount
306                 Case 5  'Rep+All
307                     _MyDispLatestPost = DispTitleEnum.UnreadAllRepCount
308                 Case 6  'Unread/All
309                     _MyDispLatestPost = DispTitleEnum.UnreadCountAllCount
310                 Case 7 'Count of Status/Follow/Follower
311                     _MyDispLatestPost = DispTitleEnum.OwnStatus
312             End Select
313             _MySortOrderLock = CheckSortOrderLock.Checked
314             _MyTinyUrlResolve = CheckTinyURL.Checked
315             ShortUrl.IsResolve = _MyTinyUrlResolve
316             If RadioProxyNone.Checked Then
317                 _MyProxyType = HttpConnection.ProxyType.None
318             ElseIf RadioProxyIE.Checked Then
319                 _MyProxyType = HttpConnection.ProxyType.IE
320             Else
321                 _MyProxyType = HttpConnection.ProxyType.Specified
322             End If
323             _MyProxyAddress = TextProxyAddress.Text.Trim()
324             _MyProxyPort = Integer.Parse(TextProxyPort.Text.Trim())
325             _MyProxyUser = TextProxyUser.Text.Trim()
326             _MyProxyPassword = TextProxyPassword.Text.Trim()
327             _MyPeriodAdjust = CheckPeriodAdjust.Checked
328             _MyStartupVersion = CheckStartupVersion.Checked
329             _MyStartupFollowers = CheckStartupFollowers.Checked
330             _MyRestrictFavCheck = CheckFavRestrict.Checked
331             _MyAlwaysTop = CheckAlwaysTop.Checked
332             _MyUrlConvertAuto = CheckAutoConvertUrl.Checked
333             _MyOutputz = CheckOutputz.Checked
334             _MyOutputzKey = TextBoxOutputzKey.Text.Trim()
335
336             Select Case ComboBoxOutputzUrlmode.SelectedIndex
337                 Case 0
338                     _MyOutputzUrlmode = OutputzUrlmode.twittercom
339                 Case 1
340                     _MyOutputzUrlmode = OutputzUrlmode.twittercomWithUsername
341             End Select
342
343             _MyNicoms = CheckNicoms.Checked
344             _MyUnreadStyle = chkUnreadStyle.Checked
345             _MyDateTimeFormat = CmbDateTimeFormat.Text
346             _MyDefaultTimeOut = CType(ConnectionTimeOut.Text, Integer)
347             _MyRetweetNoConfirm = CheckRetweetNoConfirm.Checked
348             _MyLimitBalloon = CheckBalloonLimit.Checked
349             _MyEventNotifyEnabled = CheckEventNotify.Checked
350             GetEventNotifyFlag(_MyEventNotifyFlag, _isMyEventNotifyFlag)
351             _MyForceEventNotify = CheckForceEventNotify.Checked
352             _MyFavEventUnread = CheckFavEventUnread.Checked
353             _MyTranslateLanguage = (New Google).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex)
354             _MyEventSoundFile = CStr(ComboBoxEventNotifySound.SelectedItem)
355             _MyAutoShortUrlFirst = CType(ComboBoxAutoShortUrlFirst.SelectedIndex, UrlConverter)
356             _MyTabIconDisp = chkTabIconDisp.Checked
357             _MyReadOwnPost = chkReadOwnPost.Checked
358             _MyGetFav = chkGetFav.Checked
359             _MyMonoSpace = CheckMonospace.Checked
360             _MyReadOldPosts = CheckReadOldPosts.Checked
361             _MyUseSsl = CheckUseSsl.Checked
362             _MyBitlyId = TextBitlyId.Text
363             _MyBitlyPw = TextBitlyPw.Text
364             _MyShowGrid = CheckShowGrid.Checked
365             _MyUseAtIdSupplement = CheckAtIdSupple.Checked
366             _MyUseHashSupplement = CheckHashSupple.Checked
367             _MyPreviewEnable = CheckPreviewEnable.Checked
368             _MyTwitterApiUrl = TwitterAPIText.Text.Trim
369             _MyTwitterSearchApiUrl = TwitterSearchAPIText.Text.Trim
370             Select Case ReplyIconStateCombo.SelectedIndex
371                 Case 0
372                     _MyReplyIconState = REPLY_ICONSTATE.None
373                 Case 1
374                     _MyReplyIconState = REPLY_ICONSTATE.StaticIcon
375                 Case 2
376                     _MyReplyIconState = REPLY_ICONSTATE.BlinkIcon
377             End Select
378             Select Case LanguageCombo.SelectedIndex
379                 Case 0
380                     _MyLanguage = "OS"
381                 Case 1
382                     _MyLanguage = "ja"
383                 Case 2
384                     _MyLanguage = "en"
385                 Case 3
386                     _MyLanguage = "zh-CN"
387                 Case Else
388                     _MyLanguage = "en"
389             End Select
390             _HotkeyEnabled = Me.HotkeyCheck.Checked
391             _HotkeyMod = Keys.None
392             If Me.HotkeyAlt.Checked Then _HotkeyMod = _HotkeyMod Or Keys.Alt
393             If Me.HotkeyShift.Checked Then _HotkeyMod = _HotkeyMod Or Keys.Shift
394             If Me.HotkeyCtrl.Checked Then _HotkeyMod = _HotkeyMod Or Keys.Control
395             If Me.HotkeyWin.Checked Then _HotkeyMod = _HotkeyMod Or Keys.LWin
396             If IsNumeric(HotkeyCode.Text) Then _HotkeyValue = CInt(HotkeyCode.Text)
397             _HotkeyKey = DirectCast(HotkeyText.Tag, Keys)
398             _BlinkNewMentions = ChkNewMentionsBlink.Checked
399             _MyUseAdditonalCount = UseChangeGetCount.Checked
400             _MoreCountApi = CType(GetMoreTextCountApi.Text, Integer)
401             _FirstCountApi = CType(FirstTextCountApi.Text, Integer)
402             _SearchCountApi = CType(SearchTextCountApi.Text, Integer)
403             _FavoritesCountApi = CType(FavoritesTextCountApi.Text, Integer)
404             _UserTimelineCountApi = CType(UserTimelineTextCountApi.Text, Integer)
405             _ListCountApi = CType(ListTextCountApi.Text, Integer)
406             _MyOpenUserTimeline = CheckOpenUserTimeline.Checked
407         Catch ex As Exception
408             MessageBox.Show(My.Resources.Save_ClickText3)
409             Me.DialogResult = Windows.Forms.DialogResult.Cancel
410             Exit Sub
411         End Try
412     End Sub
413
414     Private Sub Setting_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
415         If tw IsNot Nothing AndAlso tw.Username = "" AndAlso e.CloseReason = CloseReason.None Then
416             If MessageBox.Show(My.Resources.Setting_FormClosing1, "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Cancel Then
417                 e.Cancel = True
418             End If
419         End If
420         If _ValidationError Then
421             e.Cancel = True
422         End If
423         If e.Cancel = False AndAlso TreeViewSetting.SelectedNode IsNot Nothing Then
424             Dim curPanel As Panel = CType(TreeViewSetting.SelectedNode.Tag, Panel)
425             curPanel.Visible = False
426             curPanel.Enabled = False
427         End If
428     End Sub
429
430     Private Sub Setting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
431         tw = DirectCast(Me.Owner, TweenMain).TwitterInstance
432         Dim uname As String = tw.Username
433         Dim pw As String = tw.Password
434         Dim tk As String = tw.AccessToken
435         Dim tks As String = tw.AccessTokenSecret
436         If Not Me._MyIsOAuth Then
437             'BASIC認証時のみ表示
438             Me.AuthStateLabel.Enabled = False
439             Me.AuthUserLabel.Enabled = False
440             Me.AuthClearButton.Enabled = False
441             Me.AuthOAuthRadio.Checked = False
442             Me.AuthBasicRadio.Checked = True
443             Me.CheckEnableBasicAuth.Checked = True
444             Me.AuthBasicRadio.Enabled = True
445             tw.Initialize(uname, pw)
446         Else
447             Me.AuthStateLabel.Enabled = True
448             Me.AuthUserLabel.Enabled = True
449             Me.AuthClearButton.Enabled = True
450             Me.AuthOAuthRadio.Checked = True
451             Me.AuthBasicRadio.Checked = False
452             tw.Initialize(tk, tks, uname)
453         End If
454
455         Username.Text = uname
456         Password.Text = pw
457         If tw.Username = "" Then
458             Me.AuthStateLabel.Text = My.Resources.AuthorizeButton_Click4
459             Me.AuthUserLabel.Text = ""
460         Else
461             Me.AuthStateLabel.Text = My.Resources.AuthorizeButton_Click3
462             Me.AuthUserLabel.Text = tw.Username
463         End If
464
465         Me.StartupUserstreamCheck.Checked = _MyUserstreamStartup
466         Me.UserstreamPeriod.Text = _MyUserstreamPeriod.ToString()
467         TimelinePeriod.Text = _MytimelinePeriod.ToString()
468         ReplyPeriod.Text = _MyReplyPeriod.ToString()
469         DMPeriod.Text = _MyDMPeriod.ToString()
470         PubSearchPeriod.Text = _MyPubSearchPeriod.ToString()
471         ListsPeriod.Text = _MyListsPeriod.ToString()
472         UserTimelinePeriod.Text = _MyUserTimelinePeriod.ToString
473
474         StartupReaded.Checked = _MyReaded
475         Select Case _MyIconSize
476             Case IconSizes.IconNone
477                 IconSize.SelectedIndex = 0
478             Case IconSizes.Icon16
479                 IconSize.SelectedIndex = 1
480             Case IconSizes.Icon24
481                 IconSize.SelectedIndex = 2
482             Case IconSizes.Icon48
483                 IconSize.SelectedIndex = 3
484             Case IconSizes.Icon48_2
485                 IconSize.SelectedIndex = 4
486         End Select
487         StatusText.Text = _MyStatusText
488         UReadMng.Checked = _MyUnreadManage
489         If _MyUnreadManage = False Then
490             StartupReaded.Enabled = False
491         Else
492             StartupReaded.Enabled = True
493         End If
494         PlaySnd.Checked = _MyPlaySound
495         OneWayLv.Checked = _MyOneWayLove
496
497         lblListFont.Font = _fntReaded
498         lblUnread.Font = _fntUnread
499         lblUnread.ForeColor = _clUnread
500         lblListFont.ForeColor = _clReaded
501         lblFav.ForeColor = _clFav
502         lblOWL.ForeColor = _clOWL
503         lblRetweet.ForeColor = _clRetweet
504         lblDetail.Font = _fntDetail
505         lblSelf.BackColor = _clSelf
506         lblAtSelf.BackColor = _clAtSelf
507         lblTarget.BackColor = _clTarget
508         lblAtTarget.BackColor = _clAtTarget
509         lblAtFromTarget.BackColor = _clAtFromTarget
510         lblAtTo.BackColor = _clAtTo
511         lblInputBackcolor.BackColor = _clInputBackcolor
512         lblInputFont.ForeColor = _clInputFont
513         lblInputFont.Font = _fntInputFont
514         lblListBackcolor.BackColor = _clListBackcolor
515         lblDetailBackcolor.BackColor = _clDetailBackcolor
516         lblDetail.ForeColor = _clDetail
517         lblDetailLink.ForeColor = _clDetailLink
518
519         Select Case _MyNameBalloon
520             Case NameBalloonEnum.None
521                 cmbNameBalloon.SelectedIndex = 0
522             Case NameBalloonEnum.UserID
523                 cmbNameBalloon.SelectedIndex = 1
524             Case NameBalloonEnum.NickName
525                 cmbNameBalloon.SelectedIndex = 2
526         End Select
527
528         If _MyPostCtrlEnter Then
529             ComboBoxPostKeySelect.SelectedIndex = 1
530         ElseIf _MyPostShiftEnter Then
531             ComboBoxPostKeySelect.SelectedIndex = 2
532         Else
533             ComboBoxPostKeySelect.SelectedIndex = 0
534         End If
535
536         TextCountApi.Text = _countApi.ToString
537         TextCountApiReply.Text = _countApiReply.ToString
538         BrowserPathText.Text = _browserpath
539         CheckPostAndGet.Checked = _MyPostAndGet
540         CheckUseRecommendStatus.Checked = _MyUseRecommendStatus
541         CheckDispUsername.Checked = _MyDispUsername
542         CheckCloseToExit.Checked = _MyCloseToExit
543         CheckMinimizeToTray.Checked = _MyMinimizeToTray
544         Select Case _MyDispLatestPost
545             Case DispTitleEnum.None
546                 ComboDispTitle.SelectedIndex = 0
547             Case DispTitleEnum.Ver
548                 ComboDispTitle.SelectedIndex = 1
549             Case DispTitleEnum.Post
550                 ComboDispTitle.SelectedIndex = 2
551             Case DispTitleEnum.UnreadRepCount
552                 ComboDispTitle.SelectedIndex = 3
553             Case DispTitleEnum.UnreadAllCount
554                 ComboDispTitle.SelectedIndex = 4
555             Case DispTitleEnum.UnreadAllRepCount
556                 ComboDispTitle.SelectedIndex = 5
557             Case DispTitleEnum.UnreadCountAllCount
558                 ComboDispTitle.SelectedIndex = 6
559             Case DispTitleEnum.OwnStatus
560                 ComboDispTitle.SelectedIndex = 7
561         End Select
562         CheckSortOrderLock.Checked = _MySortOrderLock
563         CheckTinyURL.Checked = _MyTinyUrlResolve
564         Select Case _MyProxyType
565             Case HttpConnection.ProxyType.None
566                 RadioProxyNone.Checked = True
567             Case HttpConnection.ProxyType.IE
568                 RadioProxyIE.Checked = True
569             Case Else
570                 RadioProxySpecified.Checked = True
571         End Select
572         Dim chk As Boolean = RadioProxySpecified.Checked
573         LabelProxyAddress.Enabled = chk
574         TextProxyAddress.Enabled = chk
575         LabelProxyPort.Enabled = chk
576         TextProxyPort.Enabled = chk
577         LabelProxyUser.Enabled = chk
578         TextProxyUser.Enabled = chk
579         LabelProxyPassword.Enabled = chk
580         TextProxyPassword.Enabled = chk
581
582         TextProxyAddress.Text = _MyProxyAddress
583         TextProxyPort.Text = _MyProxyPort.ToString
584         TextProxyUser.Text = _MyProxyUser
585         TextProxyPassword.Text = _MyProxyPassword
586
587         CheckPeriodAdjust.Checked = _MyPeriodAdjust
588         CheckStartupVersion.Checked = _MyStartupVersion
589         CheckStartupFollowers.Checked = _MyStartupFollowers
590         CheckFavRestrict.Checked = _MyRestrictFavCheck
591         CheckAlwaysTop.Checked = _MyAlwaysTop
592         CheckAutoConvertUrl.Checked = _MyUrlConvertAuto
593         CheckOutputz.Checked = _MyOutputz
594         TextBoxOutputzKey.Text = _MyOutputzKey
595
596         Select Case _MyOutputzUrlmode
597             Case OutputzUrlmode.twittercom
598                 ComboBoxOutputzUrlmode.SelectedIndex = 0
599             Case OutputzUrlmode.twittercomWithUsername
600                 ComboBoxOutputzUrlmode.SelectedIndex = 1
601         End Select
602
603         CheckNicoms.Checked = _MyNicoms
604         chkUnreadStyle.Checked = _MyUnreadStyle
605         CmbDateTimeFormat.Text = _MyDateTimeFormat
606         ConnectionTimeOut.Text = _MyDefaultTimeOut.ToString
607         CheckRetweetNoConfirm.Checked = _MyRetweetNoConfirm
608         CheckBalloonLimit.Checked = _MyLimitBalloon
609
610         ApplyEventNotifyFlag(_MyEventNotifyEnabled, _MyEventNotifyFlag, _isMyEventNotifyFlag)
611         CheckForceEventNotify.Checked = _MyForceEventNotify
612         CheckFavEventUnread.Checked = _MyFavEventUnread
613         ComboBoxTranslateLanguage.SelectedIndex = (New Google).GetIndexFromLanguageEnum(_MyTranslateLanguage)
614         SoundFileListup()
615         ComboBoxAutoShortUrlFirst.SelectedIndex = _MyAutoShortUrlFirst
616         chkTabIconDisp.Checked = _MyTabIconDisp
617         chkReadOwnPost.Checked = _MyReadOwnPost
618         chkGetFav.Checked = _MyGetFav
619         CheckMonospace.Checked = _MyMonoSpace
620         CheckReadOldPosts.Checked = _MyReadOldPosts
621         CheckUseSsl.Checked = _MyUseSsl
622         TextBitlyId.Text = _MyBitlyId
623         TextBitlyPw.Text = _MyBitlyPw
624         TextBitlyId.Modified = False
625         TextBitlyPw.Modified = False
626         CheckShowGrid.Checked = _MyShowGrid
627         CheckAtIdSupple.Checked = _MyUseAtIdSupplement
628         CheckHashSupple.Checked = _MyUseHashSupplement
629         CheckPreviewEnable.Checked = _MyPreviewEnable
630         TwitterAPIText.Text = _MyTwitterApiUrl
631         TwitterSearchAPIText.Text = _MyTwitterSearchApiUrl
632         Select Case _MyReplyIconState
633             Case REPLY_ICONSTATE.None
634                 ReplyIconStateCombo.SelectedIndex = 0
635             Case REPLY_ICONSTATE.StaticIcon
636                 ReplyIconStateCombo.SelectedIndex = 1
637             Case REPLY_ICONSTATE.BlinkIcon
638                 ReplyIconStateCombo.SelectedIndex = 2
639         End Select
640         Select Case _MyLanguage
641             Case "OS"
642                 LanguageCombo.SelectedIndex = 0
643             Case "ja"
644                 LanguageCombo.SelectedIndex = 1
645             Case "en"
646                 LanguageCombo.SelectedIndex = 2
647             Case "zh-CN"
648                 LanguageCombo.SelectedIndex = 3
649             Case Else
650                 LanguageCombo.SelectedIndex = 0
651         End Select
652         HotkeyCheck.Checked = _HotkeyEnabled
653         HotkeyAlt.Checked = ((_HotkeyMod And Keys.Alt) = Keys.Alt)
654         HotkeyCtrl.Checked = ((_HotkeyMod And Keys.Control) = Keys.Control)
655         HotkeyShift.Checked = ((_HotkeyMod And Keys.Shift) = Keys.Shift)
656         HotkeyWin.Checked = ((_HotkeyMod And Keys.LWin) = Keys.LWin)
657         HotkeyCode.Text = _HotkeyValue.ToString
658         HotkeyText.Text = _HotkeyKey.ToString
659         HotkeyText.Tag = _HotkeyKey
660         HotkeyAlt.Enabled = HotkeyEnabled
661         HotkeyShift.Enabled = HotkeyEnabled
662         HotkeyCtrl.Enabled = HotkeyEnabled
663         HotkeyWin.Enabled = HotkeyEnabled
664         HotkeyText.Enabled = HotkeyEnabled
665         HotkeyCode.Enabled = HotkeyEnabled
666         ChkNewMentionsBlink.Checked = _BlinkNewMentions
667
668         CheckOutputz_CheckedChanged(sender, e)
669
670         GetMoreTextCountApi.Text = _MoreCountApi.ToString
671         FirstTextCountApi.Text = _FirstCountApi.ToString
672         SearchTextCountApi.Text = _SearchCountApi.ToString
673         FavoritesTextCountApi.Text = _FavoritesCountApi.ToString
674         UserTimelineTextCountApi.Text = _UserTimelineCountApi.ToString
675         ListTextCountApi.Text = _ListCountApi.ToString
676         UseChangeGetCount.Checked = _MyUseAdditonalCount
677         Label28.Enabled = UseChangeGetCount.Checked
678         Label30.Enabled = UseChangeGetCount.Checked
679         Label53.Enabled = UseChangeGetCount.Checked
680         Label66.Enabled = UseChangeGetCount.Checked
681         Label17.Enabled = UseChangeGetCount.Checked
682         Label25.Enabled = UseChangeGetCount.Checked
683         GetMoreTextCountApi.Enabled = UseChangeGetCount.Checked
684         FirstTextCountApi.Enabled = UseChangeGetCount.Checked
685         SearchTextCountApi.Enabled = UseChangeGetCount.Checked
686         FavoritesTextCountApi.Enabled = UseChangeGetCount.Checked
687         UserTimelineTextCountApi.Enabled = UseChangeGetCount.Checked
688         ListTextCountApi.Enabled = UseChangeGetCount.Checked
689         CheckOpenUserTimeline.Checked = _MyOpenUserTimeline
690
691         With Me.TreeViewSetting
692             .Nodes("BasedNode").Tag = BasedPanel
693             .Nodes("BasedNode").Nodes("PeriodNode").Tag = GetPeriodPanel
694             .Nodes("BasedNode").Nodes("StartUpNode").Tag = StartupPanel
695             .Nodes("BasedNode").Nodes("GetCountNode").Tag = GetCountPanel
696             '.Nodes("BasedNode").Nodes("UserStreamNode").Tag = UserStreamPanel
697             .Nodes("ActionNode").Tag = ActionPanel
698             .Nodes("ActionNode").Nodes("TweetActNode").Tag = TweetActPanel
699             .Nodes("PreviewNode").Tag = PreviewPanel
700             .Nodes("PreviewNode").Nodes("TweetPrvNode").Tag = TweetPrvPanel
701             .Nodes("PreviewNode").Nodes("NotifyNode").Tag = NotifyPanel
702             .Nodes("FontNode").Tag = FontPanel
703             .Nodes("FontNode").Nodes("FontNode2").Tag = FontPanel2
704             .Nodes("ConnectionNode").Tag = ConnectionPanel
705             .Nodes("ConnectionNode").Nodes("ProxyNode").Tag = ProxyPanel
706             .Nodes("ConnectionNode").Nodes("CooperateNode").Tag = CooperatePanel
707             .Nodes("ConnectionNode").Nodes("ShortUrlNode").Tag = ShortUrlPanel
708
709             .SelectedNode = .Nodes(0)
710             .ExpandAll()
711         End With
712         'TreeViewSetting.SelectedNode = TreeViewSetting.TopNode
713         ActiveControl = Username
714     End Sub
715
716     Private Sub UserstreamPeriod_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles UserstreamPeriod.Validating
717         Dim prd As Integer
718         Try
719             prd = CType(UserstreamPeriod.Text, Integer)
720         Catch ex As Exception
721             MessageBox.Show(My.Resources.UserstreamPeriod_ValidatingText1)
722             e.Cancel = True
723             Exit Sub
724         End Try
725
726         If prd < 0 OrElse prd > 60 Then
727             MessageBox.Show(My.Resources.UserstreamPeriod_ValidatingText1)
728             e.Cancel = True
729             Exit Sub
730         End If
731         CalcApiUsing()
732     End Sub
733
734     Private Sub TimelinePeriod_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TimelinePeriod.Validating
735         Dim prd As Integer
736         Try
737             prd = CType(TimelinePeriod.Text, Integer)
738         Catch ex As Exception
739             MessageBox.Show(My.Resources.TimelinePeriod_ValidatingText1)
740             e.Cancel = True
741             Exit Sub
742         End Try
743
744         If prd <> 0 AndAlso (prd < 15 OrElse prd > 6000) Then
745             MessageBox.Show(My.Resources.TimelinePeriod_ValidatingText2)
746             e.Cancel = True
747             Exit Sub
748         End If
749         CalcApiUsing()
750     End Sub
751
752     Private Sub ReplyPeriod_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ReplyPeriod.Validating
753         Dim prd As Integer
754         Try
755             prd = CType(ReplyPeriod.Text, Integer)
756         Catch ex As Exception
757             MessageBox.Show(My.Resources.TimelinePeriod_ValidatingText1)
758             e.Cancel = True
759             Exit Sub
760         End Try
761
762         If prd <> 0 AndAlso (prd < 15 OrElse prd > 6000) Then
763             MessageBox.Show(My.Resources.TimelinePeriod_ValidatingText2)
764             e.Cancel = True
765             Exit Sub
766         End If
767         CalcApiUsing()
768     End Sub
769
770     Private Sub DMPeriod_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles DMPeriod.Validating
771         Dim prd As Integer
772         Try
773             prd = CType(DMPeriod.Text, Integer)
774         Catch ex As Exception
775             MessageBox.Show(My.Resources.DMPeriod_ValidatingText1)
776             e.Cancel = True
777             Exit Sub
778         End Try
779
780         If prd <> 0 AndAlso (prd < 15 OrElse prd > 6000) Then
781             MessageBox.Show(My.Resources.DMPeriod_ValidatingText2)
782             e.Cancel = True
783             Exit Sub
784         End If
785         CalcApiUsing()
786     End Sub
787
788     Private Sub PubSearchPeriod_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles PubSearchPeriod.Validating
789         Dim prd As Integer
790         Try
791             prd = CType(PubSearchPeriod.Text, Integer)
792         Catch ex As Exception
793             MessageBox.Show(My.Resources.PubSearchPeriod_ValidatingText1)
794             e.Cancel = True
795             Exit Sub
796         End Try
797
798         If prd <> 0 AndAlso (prd < 30 OrElse prd > 6000) Then
799             MessageBox.Show(My.Resources.PubSearchPeriod_ValidatingText2)
800             e.Cancel = True
801         End If
802     End Sub
803
804     Private Sub ListsPeriod_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ListsPeriod.Validating
805         Dim prd As Integer
806         Try
807             prd = CType(ListsPeriod.Text, Integer)
808         Catch ex As Exception
809             MessageBox.Show(My.Resources.DMPeriod_ValidatingText1)
810             e.Cancel = True
811             Exit Sub
812         End Try
813
814         If prd <> 0 AndAlso (prd < 15 OrElse prd > 6000) Then
815             MessageBox.Show(My.Resources.DMPeriod_ValidatingText2)
816             e.Cancel = True
817             Exit Sub
818         End If
819         CalcApiUsing()
820     End Sub
821
822     Private Sub UserTimeline_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles UserTimelinePeriod.Validating
823         Dim prd As Integer
824         Try
825             prd = CType(UserTimelinePeriod.Text, Integer)
826         Catch ex As Exception
827             MessageBox.Show(My.Resources.DMPeriod_ValidatingText1)
828             e.Cancel = True
829             Exit Sub
830         End Try
831
832         If prd <> 0 AndAlso (prd < 15 OrElse prd > 6000) Then
833             MessageBox.Show(My.Resources.DMPeriod_ValidatingText2)
834             e.Cancel = True
835             Exit Sub
836         End If
837         CalcApiUsing()
838     End Sub
839
840     Private Sub UReadMng_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UReadMng.CheckedChanged
841         If UReadMng.Checked = True Then
842             StartupReaded.Enabled = True
843         Else
844             StartupReaded.Enabled = False
845         End If
846     End Sub
847
848     Private Sub btnFontAndColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUnread.Click, btnDetail.Click, btnListFont.Click, btnInputFont.Click
849         Dim Btn As Button = CType(sender, Button)
850         Dim rtn As DialogResult
851
852         FontDialog1.AllowVerticalFonts = False
853         FontDialog1.AllowScriptChange = True
854         FontDialog1.AllowSimulations = True
855         FontDialog1.AllowVectorFonts = True
856         FontDialog1.FixedPitchOnly = False
857         FontDialog1.FontMustExist = True
858         FontDialog1.ScriptsOnly = False
859         FontDialog1.ShowApply = False
860         FontDialog1.ShowEffects = True
861         FontDialog1.ShowColor = True
862
863         Select Case Btn.Name
864             Case "btnUnread"
865                 FontDialog1.Color = lblUnread.ForeColor
866                 FontDialog1.Font = lblUnread.Font
867             Case "btnDetail"
868                 FontDialog1.Color = lblDetail.ForeColor
869                 FontDialog1.Font = lblDetail.Font
870             Case "btnListFont"
871                 FontDialog1.Color = lblListFont.ForeColor
872                 FontDialog1.Font = lblListFont.Font
873             Case "btnInputFont"
874                 FontDialog1.Color = lblInputFont.ForeColor
875                 FontDialog1.Font = lblInputFont.Font
876         End Select
877
878         Try
879             rtn = FontDialog1.ShowDialog
880         Catch ex As ArgumentException
881             MessageBox.Show(ex.Message)
882             Exit Sub
883         End Try
884
885         If rtn = Windows.Forms.DialogResult.Cancel Then Exit Sub
886
887         Select Case Btn.Name
888             Case "btnUnread"
889                 lblUnread.ForeColor = FontDialog1.Color
890                 lblUnread.Font = FontDialog1.Font
891             Case "btnDetail"
892                 lblDetail.ForeColor = FontDialog1.Color
893                 lblDetail.Font = FontDialog1.Font
894             Case "btnListFont"
895                 lblListFont.ForeColor = FontDialog1.Color
896                 lblListFont.Font = FontDialog1.Font
897             Case "btnInputFont"
898                 lblInputFont.ForeColor = FontDialog1.Color
899                 lblInputFont.Font = FontDialog1.Font
900         End Select
901
902     End Sub
903
904     Private Sub btnColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelf.Click, btnAtSelf.Click, btnTarget.Click, btnAtTarget.Click, btnAtFromTarget.Click, btnFav.Click, btnOWL.Click, btnInputBackcolor.Click, btnAtTo.Click, btnListBack.Click, btnDetailBack.Click, btnDetailLink.Click, btnRetweet.Click
905         Dim Btn As Button = CType(sender, Button)
906         Dim rtn As DialogResult
907
908         ColorDialog1.AllowFullOpen = True
909         ColorDialog1.AnyColor = True
910         ColorDialog1.FullOpen = False
911         ColorDialog1.SolidColorOnly = False
912
913         Select Case Btn.Name
914             Case "btnSelf"
915                 ColorDialog1.Color = lblSelf.BackColor
916             Case "btnAtSelf"
917                 ColorDialog1.Color = lblAtSelf.BackColor
918             Case "btnTarget"
919                 ColorDialog1.Color = lblTarget.BackColor
920             Case "btnAtTarget"
921                 ColorDialog1.Color = lblAtTarget.BackColor
922             Case "btnAtFromTarget"
923                 ColorDialog1.Color = lblAtFromTarget.BackColor
924             Case "btnFav"
925                 ColorDialog1.Color = lblFav.ForeColor
926             Case "btnOWL"
927                 ColorDialog1.Color = lblOWL.ForeColor
928             Case "btnRetweet"
929                 ColorDialog1.Color = lblRetweet.ForeColor
930             Case "btnInputBackcolor"
931                 ColorDialog1.Color = lblInputBackcolor.BackColor
932             Case "btnAtTo"
933                 ColorDialog1.Color = lblAtTo.BackColor
934             Case "btnListBack"
935                 ColorDialog1.Color = lblListBackcolor.BackColor
936             Case "btnDetailBack"
937                 ColorDialog1.Color = lblDetailBackcolor.BackColor
938             Case "btnDetailLink"
939                 ColorDialog1.Color = lblDetailLink.ForeColor
940         End Select
941
942         rtn = ColorDialog1.ShowDialog
943
944         If rtn = Windows.Forms.DialogResult.Cancel Then Exit Sub
945
946         Select Case Btn.Name
947             Case "btnSelf"
948                 lblSelf.BackColor = ColorDialog1.Color
949             Case "btnAtSelf"
950                 lblAtSelf.BackColor = ColorDialog1.Color
951             Case "btnTarget"
952                 lblTarget.BackColor = ColorDialog1.Color
953             Case "btnAtTarget"
954                 lblAtTarget.BackColor = ColorDialog1.Color
955             Case "btnAtFromTarget"
956                 lblAtFromTarget.BackColor = ColorDialog1.Color
957             Case "btnFav"
958                 lblFav.ForeColor = ColorDialog1.Color
959             Case "btnOWL"
960                 lblOWL.ForeColor = ColorDialog1.Color
961             Case "btnRetweet"
962                 lblRetweet.ForeColor = ColorDialog1.Color
963             Case "btnInputBackcolor"
964                 lblInputBackcolor.BackColor = ColorDialog1.Color
965             Case "btnAtTo"
966                 lblAtTo.BackColor = ColorDialog1.Color
967             Case "btnListBack"
968                 lblListBackcolor.BackColor = ColorDialog1.Color
969             Case "btnDetailBack"
970                 lblDetailBackcolor.BackColor = ColorDialog1.Color
971             Case "btnDetailLink"
972                 lblDetailLink.ForeColor = ColorDialog1.Color
973         End Select
974     End Sub
975
976     Public Property UserstreamPeriodInt() As Integer
977         Get
978             Return _MyUserstreamPeriod
979         End Get
980         Set(ByVal value As Integer)
981             _MyUserstreamPeriod = value
982         End Set
983     End Property
984
985     Public Property UserstreamStartup() As Boolean
986         Get
987             Return Me._MyUserstreamStartup
988         End Get
989         Set(ByVal value As Boolean)
990             Me._MyUserstreamStartup = value
991         End Set
992     End Property
993
994     Public Property TimelinePeriodInt() As Integer
995         Get
996             Return _MytimelinePeriod
997         End Get
998         Set(ByVal value As Integer)
999             _MytimelinePeriod = value
1000         End Set
1001     End Property
1002
1003     Public Property ReplyPeriodInt() As Integer
1004         Get
1005             Return _MyReplyPeriod
1006         End Get
1007         Set(ByVal value As Integer)
1008             _MyReplyPeriod = value
1009         End Set
1010     End Property
1011
1012     Public Property DMPeriodInt() As Integer
1013         Get
1014             Return _MyDMPeriod
1015         End Get
1016         Set(ByVal value As Integer)
1017             _MyDMPeriod = value
1018         End Set
1019     End Property
1020
1021     Public Property PubSearchPeriodInt() As Integer
1022         Get
1023             Return _MyPubSearchPeriod
1024         End Get
1025         Set(ByVal value As Integer)
1026             _MyPubSearchPeriod = value
1027         End Set
1028     End Property
1029
1030     Public Property ListsPeriodInt() As Integer
1031         Get
1032             Return _MyListsPeriod
1033         End Get
1034         Set(ByVal value As Integer)
1035             _MyListsPeriod = value
1036         End Set
1037     End Property
1038
1039     Public Property UserTimelinePeriodInt() As Integer
1040         Get
1041             Return _MyUserTimelinePeriod
1042         End Get
1043         Set(ByVal value As Integer)
1044             _MyUserTimelinePeriod = value
1045         End Set
1046     End Property
1047
1048     Public Property Readed() As Boolean
1049         Get
1050             Return _MyReaded
1051         End Get
1052         Set(ByVal value As Boolean)
1053             _MyReaded = value
1054         End Set
1055     End Property
1056
1057     Public Property IconSz() As IconSizes
1058         Get
1059             Return _MyIconSize
1060         End Get
1061         Set(ByVal value As IconSizes)
1062             _MyIconSize = value
1063         End Set
1064     End Property
1065
1066     Public Property Status() As String
1067         Get
1068             Return _MyStatusText
1069         End Get
1070         Set(ByVal value As String)
1071             _MyStatusText = value
1072         End Set
1073     End Property
1074
1075     Public Property UnreadManage() As Boolean
1076         Get
1077             Return _MyUnreadManage
1078         End Get
1079         Set(ByVal value As Boolean)
1080             _MyUnreadManage = value
1081         End Set
1082     End Property
1083
1084     Public Property PlaySound() As Boolean
1085         Get
1086             Return _MyPlaySound
1087         End Get
1088         Set(ByVal value As Boolean)
1089             _MyPlaySound = value
1090         End Set
1091     End Property
1092
1093     Public Property OneWayLove() As Boolean
1094         Get
1095             Return _MyOneWayLove
1096         End Get
1097         Set(ByVal value As Boolean)
1098             _MyOneWayLove = value
1099         End Set
1100     End Property
1101
1102     '''''未使用
1103     Public Property FontUnread() As Font
1104         Get
1105             Return _fntUnread
1106         End Get
1107         Set(ByVal value As Font)
1108             _fntUnread = value
1109             '無視
1110         End Set
1111     End Property
1112
1113     Public Property ColorUnread() As Color
1114         Get
1115             Return _clUnread
1116         End Get
1117         Set(ByVal value As Color)
1118             _clUnread = value
1119         End Set
1120     End Property
1121
1122     '''''リストフォントとして使用
1123     Public Property FontReaded() As Font
1124         Get
1125             Return _fntReaded
1126         End Get
1127         Set(ByVal value As Font)
1128             _fntReaded = value
1129         End Set
1130     End Property
1131
1132     Public Property ColorReaded() As Color
1133         Get
1134             Return _clReaded
1135         End Get
1136         Set(ByVal value As Color)
1137             _clReaded = value
1138         End Set
1139     End Property
1140
1141     Public Property ColorFav() As Color
1142         Get
1143             Return _clFav
1144         End Get
1145         Set(ByVal value As Color)
1146             _clFav = value
1147         End Set
1148     End Property
1149
1150     Public Property ColorOWL() As Color
1151         Get
1152             Return _clOWL
1153         End Get
1154         Set(ByVal value As Color)
1155             _clOWL = value
1156         End Set
1157     End Property
1158
1159     Public Property ColorRetweet() As Color
1160         Get
1161             Return _clRetweet
1162         End Get
1163         Set(ByVal value As Color)
1164             _clRetweet = value
1165         End Set
1166     End Property
1167
1168     Public Property FontDetail() As Font
1169         Get
1170             Return _fntDetail
1171         End Get
1172         Set(ByVal value As Font)
1173             _fntDetail = value
1174         End Set
1175     End Property
1176
1177     Public Property ColorDetail() As Color
1178         Get
1179             Return _clDetail
1180         End Get
1181         Set(ByVal value As Color)
1182             _clDetail = value
1183         End Set
1184     End Property
1185
1186     Public Property ColorDetailLink() As Color
1187         Get
1188             Return _clDetailLink
1189         End Get
1190         Set(ByVal value As Color)
1191             _clDetailLink = value
1192         End Set
1193     End Property
1194
1195     Public Property ColorSelf() As Color
1196         Get
1197             Return _clSelf
1198         End Get
1199         Set(ByVal value As Color)
1200             _clSelf = value
1201         End Set
1202     End Property
1203
1204     Public Property ColorAtSelf() As Color
1205         Get
1206             Return _clAtSelf
1207         End Get
1208         Set(ByVal value As Color)
1209             _clAtSelf = value
1210         End Set
1211     End Property
1212
1213     Public Property ColorTarget() As Color
1214         Get
1215             Return _clTarget
1216         End Get
1217         Set(ByVal value As Color)
1218             _clTarget = value
1219         End Set
1220     End Property
1221
1222     Public Property ColorAtTarget() As Color
1223         Get
1224             Return _clAtTarget
1225         End Get
1226         Set(ByVal value As Color)
1227             _clAtTarget = value
1228         End Set
1229     End Property
1230
1231     Public Property ColorAtFromTarget() As Color
1232         Get
1233             Return _clAtFromTarget
1234         End Get
1235         Set(ByVal value As Color)
1236             _clAtFromTarget = value
1237         End Set
1238     End Property
1239
1240     Public Property ColorAtTo() As Color
1241         Get
1242             Return _clAtTo
1243         End Get
1244         Set(ByVal value As Color)
1245             _clAtTo = value
1246         End Set
1247     End Property
1248
1249     Public Property ColorInputBackcolor() As Color
1250         Get
1251             Return _clInputBackcolor
1252         End Get
1253         Set(ByVal value As Color)
1254             _clInputBackcolor = value
1255         End Set
1256     End Property
1257
1258     Public Property ColorInputFont() As Color
1259         Get
1260             Return _clInputFont
1261         End Get
1262         Set(ByVal value As Color)
1263             _clInputFont = value
1264         End Set
1265     End Property
1266
1267     Public Property FontInputFont() As Font
1268         Get
1269             Return _fntInputFont
1270         End Get
1271         Set(ByVal value As Font)
1272             _fntInputFont = value
1273         End Set
1274     End Property
1275
1276     Public Property ColorListBackcolor() As Color
1277         Get
1278             Return _clListBackcolor
1279         End Get
1280         Set(ByVal value As Color)
1281             _clListBackcolor = value
1282         End Set
1283     End Property
1284
1285     Public Property ColorDetailBackcolor() As Color
1286         Get
1287             Return _clDetailBackcolor
1288         End Get
1289         Set(ByVal value As Color)
1290             _clDetailBackcolor = value
1291         End Set
1292     End Property
1293
1294     Public Property NameBalloon() As NameBalloonEnum
1295         Get
1296             Return _MyNameBalloon
1297         End Get
1298         Set(ByVal value As NameBalloonEnum)
1299             _MyNameBalloon = value
1300         End Set
1301     End Property
1302
1303     Public Property PostCtrlEnter() As Boolean
1304         Get
1305             Return _MyPostCtrlEnter
1306         End Get
1307         Set(ByVal value As Boolean)
1308             _MyPostCtrlEnter = value
1309         End Set
1310     End Property
1311
1312     Public Property PostShiftEnter() As Boolean
1313         Get
1314             Return _MyPostShiftEnter
1315         End Get
1316         Set(ByVal value As Boolean)
1317             _MyPostShiftEnter = value
1318         End Set
1319     End Property
1320
1321     Public Property CountApi() As Integer
1322         Get
1323             Return _countApi
1324         End Get
1325         Set(ByVal value As Integer)
1326             _countApi = value
1327         End Set
1328     End Property
1329
1330     Public Property CountApiReply() As Integer
1331         Get
1332             Return _countApiReply
1333         End Get
1334         Set(ByVal value As Integer)
1335             _countApiReply = value
1336         End Set
1337     End Property
1338
1339     Public Property MoreCountApi() As Integer
1340         Get
1341             Return _MoreCountApi
1342         End Get
1343         Set(ByVal value As Integer)
1344             _MoreCountApi = value
1345         End Set
1346     End Property
1347
1348     Public Property FirstCountApi() As Integer
1349         Get
1350             Return _FirstCountApi
1351         End Get
1352         Set(ByVal value As Integer)
1353             _FirstCountApi = value
1354         End Set
1355     End Property
1356
1357     Public Property SearchCountApi() As Integer
1358         Get
1359             Return _SearchCountApi
1360         End Get
1361         Set(ByVal value As Integer)
1362             _SearchCountApi = value
1363         End Set
1364     End Property
1365
1366     Public Property FavoritesCountApi() As Integer
1367         Get
1368             Return _FavoritesCountApi
1369         End Get
1370         Set(ByVal value As Integer)
1371             _FavoritesCountApi = value
1372         End Set
1373     End Property
1374
1375     Public Property UserTimelineCountApi() As Integer
1376         Get
1377             Return _UserTimelineCountApi
1378         End Get
1379         Set(ByVal value As Integer)
1380             _UserTimelineCountApi = value
1381         End Set
1382     End Property
1383
1384     Public Property ListCountApi() As Integer
1385         Get
1386             Return _ListCountApi
1387         End Get
1388         Set(ByVal value As Integer)
1389             _ListCountApi = value
1390         End Set
1391     End Property
1392
1393     Public Property PostAndGet() As Boolean
1394         Get
1395             Return _MyPostAndGet
1396         End Get
1397         Set(ByVal value As Boolean)
1398             _MyPostAndGet = value
1399         End Set
1400     End Property
1401
1402     Public Property UseRecommendStatus() As Boolean
1403         Get
1404             Return _MyUseRecommendStatus
1405         End Get
1406         Set(ByVal value As Boolean)
1407             _MyUseRecommendStatus = value
1408         End Set
1409     End Property
1410
1411     Public Property RecommendStatusText() As String
1412         Get
1413             Return _MyRecommendStatusText
1414         End Get
1415         Set(ByVal value As String)
1416             _MyRecommendStatusText = value
1417         End Set
1418     End Property
1419
1420     Public Property DispUsername() As Boolean
1421         Get
1422             Return _MyDispUsername
1423         End Get
1424         Set(ByVal value As Boolean)
1425             _MyDispUsername = value
1426         End Set
1427     End Property
1428
1429     Public Property CloseToExit() As Boolean
1430         Get
1431             Return _MyCloseToExit
1432         End Get
1433         Set(ByVal value As Boolean)
1434             _MyCloseToExit = value
1435         End Set
1436     End Property
1437
1438     Public Property MinimizeToTray() As Boolean
1439         Get
1440             Return _MyMinimizeToTray
1441         End Get
1442         Set(ByVal value As Boolean)
1443             _MyMinimizeToTray = value
1444         End Set
1445     End Property
1446
1447     Public Property DispLatestPost() As DispTitleEnum
1448         Get
1449             Return _MyDispLatestPost
1450         End Get
1451         Set(ByVal value As DispTitleEnum)
1452             _MyDispLatestPost = value
1453         End Set
1454     End Property
1455
1456     Public Property BrowserPath() As String
1457         Get
1458             Return _browserpath
1459         End Get
1460         Set(ByVal value As String)
1461             _browserpath = value
1462         End Set
1463     End Property
1464
1465     Public Property TinyUrlResolve() As Boolean
1466         Get
1467             Return _MyTinyUrlResolve
1468         End Get
1469         Set(ByVal value As Boolean)
1470             _MyTinyUrlResolve = value
1471         End Set
1472     End Property
1473
1474     Private Sub CheckUseRecommendStatus_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckUseRecommendStatus.CheckedChanged
1475         If CheckUseRecommendStatus.Checked = True Then
1476             StatusText.Enabled = False
1477         Else
1478             StatusText.Enabled = True
1479         End If
1480     End Sub
1481
1482     Public Property SortOrderLock() As Boolean
1483         Get
1484             Return _MySortOrderLock
1485         End Get
1486         Set(ByVal value As Boolean)
1487             _MySortOrderLock = value
1488         End Set
1489     End Property
1490
1491     Public Property SelectedProxyType() As HttpConnection.ProxyType
1492         Get
1493             Return _MyProxyType
1494         End Get
1495         Set(ByVal value As HttpConnection.ProxyType)
1496             _MyProxyType = value
1497         End Set
1498     End Property
1499
1500     Public Property ProxyAddress() As String
1501         Get
1502             Return _MyProxyAddress
1503         End Get
1504         Set(ByVal value As String)
1505             _MyProxyAddress = value
1506         End Set
1507     End Property
1508
1509     Public Property ProxyPort() As Integer
1510         Get
1511             Return _MyProxyPort
1512         End Get
1513         Set(ByVal value As Integer)
1514             _MyProxyPort = value
1515         End Set
1516     End Property
1517
1518     Public Property ProxyUser() As String
1519         Get
1520             Return _MyProxyUser
1521         End Get
1522         Set(ByVal value As String)
1523             _MyProxyUser = value
1524         End Set
1525     End Property
1526
1527     Public Property ProxyPassword() As String
1528         Get
1529             Return _MyProxyPassword
1530         End Get
1531         Set(ByVal value As String)
1532             _MyProxyPassword = value
1533         End Set
1534     End Property
1535
1536     Public Property PeriodAdjust() As Boolean
1537         Get
1538             Return _MyPeriodAdjust
1539         End Get
1540         Set(ByVal value As Boolean)
1541             _MyPeriodAdjust = value
1542         End Set
1543     End Property
1544
1545     Public Property StartupVersion() As Boolean
1546         Get
1547             Return _MyStartupVersion
1548         End Get
1549         Set(ByVal value As Boolean)
1550             _MyStartupVersion = value
1551         End Set
1552     End Property
1553
1554     Public Property StartupFollowers() As Boolean
1555         Get
1556             Return _MyStartupFollowers
1557         End Get
1558         Set(ByVal value As Boolean)
1559             _MyStartupFollowers = value
1560         End Set
1561     End Property
1562
1563     Public Property RestrictFavCheck() As Boolean
1564         Get
1565             Return _MyRestrictFavCheck
1566         End Get
1567         Set(ByVal value As Boolean)
1568             _MyRestrictFavCheck = value
1569         End Set
1570     End Property
1571
1572     Public Property AlwaysTop() As Boolean
1573         Get
1574             Return _MyAlwaysTop
1575         End Get
1576         Set(ByVal value As Boolean)
1577             _MyAlwaysTop = value
1578         End Set
1579     End Property
1580
1581     Public Property UrlConvertAuto() As Boolean
1582         Get
1583             Return _MyUrlConvertAuto
1584         End Get
1585         Set(ByVal value As Boolean)
1586             _MyUrlConvertAuto = value
1587         End Set
1588     End Property
1589     Public Property OutputzEnabled() As Boolean
1590         Get
1591             Return _MyOutputz
1592         End Get
1593         Set(ByVal value As Boolean)
1594             _MyOutputz = value
1595         End Set
1596     End Property
1597     Public Property OutputzKey() As String
1598         Get
1599             Return _MyOutputzKey
1600         End Get
1601         Set(ByVal value As String)
1602             _MyOutputzKey = value
1603         End Set
1604     End Property
1605     Public Property OutputzUrlmode() As OutputzUrlmode
1606         Get
1607             Return _MyOutputzUrlmode
1608         End Get
1609         Set(ByVal value As OutputzUrlmode)
1610             _MyOutputzUrlmode = value
1611         End Set
1612     End Property
1613
1614     Public Property Nicoms() As Boolean
1615         Get
1616             Return _MyNicoms
1617         End Get
1618         Set(ByVal value As Boolean)
1619             _MyNicoms = value
1620         End Set
1621     End Property
1622     Public Property AutoShortUrlFirst() As UrlConverter
1623         Get
1624             Return _MyAutoShortUrlFirst
1625         End Get
1626         Set(ByVal value As UrlConverter)
1627             _MyAutoShortUrlFirst = value
1628         End Set
1629     End Property
1630
1631     Public Property UseUnreadStyle() As Boolean
1632         Get
1633             Return _MyUnreadStyle
1634         End Get
1635         Set(ByVal value As Boolean)
1636             _MyUnreadStyle = value
1637         End Set
1638     End Property
1639
1640     Public Property DateTimeFormat() As String
1641         Get
1642             Return _MyDateTimeFormat
1643         End Get
1644         Set(ByVal value As String)
1645             _MyDateTimeFormat = value
1646         End Set
1647     End Property
1648
1649     Public Property DefaultTimeOut() As Integer
1650         Get
1651             Return _MyDefaultTimeOut
1652         End Get
1653         Set(ByVal value As Integer)
1654             _MyDefaultTimeOut = value
1655         End Set
1656     End Property
1657
1658     Public Property RetweetNoConfirm() As Boolean
1659         Get
1660             Return _MyRetweetNoConfirm
1661         End Get
1662         Set(ByVal value As Boolean)
1663             _MyRetweetNoConfirm = value
1664         End Set
1665     End Property
1666
1667     Public Property TabIconDisp() As Boolean
1668         Get
1669             Return _MyTabIconDisp
1670         End Get
1671         Set(ByVal value As Boolean)
1672             _MyTabIconDisp = value
1673         End Set
1674     End Property
1675
1676     Public Property ReplyIconState() As REPLY_ICONSTATE
1677         Get
1678             Return _MyReplyIconState
1679         End Get
1680         Set(ByVal value As REPLY_ICONSTATE)
1681             _MyReplyIconState = value
1682         End Set
1683     End Property
1684
1685     Public Property ReadOwnPost() As Boolean
1686         Get
1687             Return _MyReadOwnPost
1688         End Get
1689         Set(ByVal value As Boolean)
1690             _MyReadOwnPost = value
1691         End Set
1692     End Property
1693
1694     Public Property GetFav() As Boolean
1695         Get
1696             Return _MyGetFav
1697         End Get
1698         Set(ByVal value As Boolean)
1699             _MyGetFav = value
1700         End Set
1701     End Property
1702
1703     Public Property IsMonospace() As Boolean
1704         Get
1705             Return _MyMonoSpace
1706         End Get
1707         Set(ByVal value As Boolean)
1708             _MyMonoSpace = value
1709         End Set
1710     End Property
1711
1712     Public Property ReadOldPosts() As Boolean
1713         Get
1714             Return _MyReadOldPosts
1715         End Get
1716         Set(ByVal value As Boolean)
1717             _MyReadOldPosts = value
1718         End Set
1719     End Property
1720
1721     Public Property UseSsl() As Boolean
1722         Get
1723             Return _MyUseSsl
1724         End Get
1725         Set(ByVal value As Boolean)
1726             _MyUseSsl = value
1727         End Set
1728     End Property
1729
1730     Public Property BitlyUser() As String
1731         Get
1732             Return _MyBitlyId
1733         End Get
1734         Set(ByVal value As String)
1735             _MyBitlyId = value
1736         End Set
1737     End Property
1738
1739     Public Property BitlyPwd() As String
1740         Get
1741             Return _MyBitlyPw
1742         End Get
1743         Set(ByVal value As String)
1744             _MyBitlyPw = value
1745         End Set
1746     End Property
1747
1748     Public Property ShowGrid() As Boolean
1749         Get
1750             Return _MyShowGrid
1751         End Get
1752         Set(ByVal value As Boolean)
1753             _MyShowGrid = value
1754         End Set
1755     End Property
1756
1757     Public Property UseAtIdSupplement() As Boolean
1758         Get
1759             Return _MyUseAtIdSupplement
1760         End Get
1761         Set(ByVal value As Boolean)
1762             _MyUseAtIdSupplement = value
1763         End Set
1764     End Property
1765
1766     Public Property UseHashSupplement() As Boolean
1767         Get
1768             Return _MyUseHashSupplement
1769         End Get
1770         Set(ByVal value As Boolean)
1771             _MyUseHashSupplement = value
1772         End Set
1773     End Property
1774
1775     Public Property PreviewEnable() As Boolean
1776         Get
1777             Return _MyPreviewEnable
1778         End Get
1779         Set(ByVal value As Boolean)
1780             _MyPreviewEnable = value
1781         End Set
1782     End Property
1783
1784     Public Property UseAdditionalCount() As Boolean
1785         Get
1786             Return _MyUseAdditonalCount
1787         End Get
1788         Set(ByVal value As Boolean)
1789             _MyUseAdditonalCount = value
1790         End Set
1791     End Property
1792
1793     Public Property OpenUserTimeline() As Boolean
1794         Set(ByVal value As Boolean)
1795             _MyOpenUserTimeline = value
1796         End Set
1797         Get
1798             Return _MyOpenUserTimeline
1799         End Get
1800     End Property
1801
1802     Public Property TwitterApiUrl() As String
1803         Get
1804             Return _MyTwitterApiUrl
1805         End Get
1806         Set(ByVal value As String)
1807             _MyTwitterApiUrl = value
1808         End Set
1809     End Property
1810
1811     Public Property TwitterSearchApiUrl() As String
1812         Get
1813             Return _MyTwitterSearchApiUrl
1814         End Get
1815         Set(ByVal value As String)
1816             _MyTwitterSearchApiUrl = value
1817         End Set
1818     End Property
1819
1820     Public Property Language() As String
1821         Get
1822             Return _MyLanguage
1823         End Get
1824         Set(ByVal value As String)
1825             _MyLanguage = value
1826         End Set
1827     End Property
1828
1829     Public Property IsOAuth() As Boolean
1830         Get
1831             Return _MyIsOAuth
1832         End Get
1833         Set(ByVal value As Boolean)
1834             _MyIsOAuth = value
1835         End Set
1836     End Property
1837
1838     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
1839         Using filedlg As New OpenFileDialog()
1840
1841             filedlg.Filter = My.Resources.Button3_ClickText1
1842             filedlg.FilterIndex = 1
1843             filedlg.Title = My.Resources.Button3_ClickText2
1844             filedlg.RestoreDirectory = True
1845
1846             If filedlg.ShowDialog() = Windows.Forms.DialogResult.OK Then
1847                 BrowserPathText.Text = filedlg.FileName
1848             End If
1849         End Using
1850     End Sub
1851
1852     Private Sub RadioProxySpecified_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioProxySpecified.CheckedChanged
1853         Dim chk As Boolean = RadioProxySpecified.Checked
1854         LabelProxyAddress.Enabled = chk
1855         TextProxyAddress.Enabled = chk
1856         LabelProxyPort.Enabled = chk
1857         TextProxyPort.Enabled = chk
1858         LabelProxyUser.Enabled = chk
1859         TextProxyUser.Enabled = chk
1860         LabelProxyPassword.Enabled = chk
1861         TextProxyPassword.Enabled = chk
1862     End Sub
1863
1864     Private Sub TextProxyPort_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextProxyPort.Validating
1865         Dim port As Integer
1866         If TextProxyPort.Text.Trim() = "" Then TextProxyPort.Text = "0"
1867         If Integer.TryParse(TextProxyPort.Text.Trim(), port) = False Then
1868             MessageBox.Show(My.Resources.TextProxyPort_ValidatingText1)
1869             e.Cancel = True
1870             Exit Sub
1871         End If
1872         If port < 0 Or port > 65535 Then
1873             MessageBox.Show(My.Resources.TextProxyPort_ValidatingText2)
1874             e.Cancel = True
1875             Exit Sub
1876         End If
1877     End Sub
1878
1879     Private Sub CheckOutputz_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckOutputz.CheckedChanged
1880         If CheckOutputz.Checked = True Then
1881             Label59.Enabled = True
1882             Label60.Enabled = True
1883             TextBoxOutputzKey.Enabled = True
1884             ComboBoxOutputzUrlmode.Enabled = True
1885         Else
1886             Label59.Enabled = False
1887             Label60.Enabled = False
1888             TextBoxOutputzKey.Enabled = False
1889             ComboBoxOutputzUrlmode.Enabled = False
1890         End If
1891     End Sub
1892
1893     Private Sub TextBoxOutputzKey_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBoxOutputzKey.Validating
1894         If CheckOutputz.Checked Then
1895             TextBoxOutputzKey.Text = Trim(TextBoxOutputzKey.Text)
1896             If TextBoxOutputzKey.Text.Length = 0 Then
1897                 MessageBox.Show(My.Resources.TextBoxOutputzKey_Validating)
1898                 e.Cancel = True
1899                 Exit Sub
1900             End If
1901         End If
1902     End Sub
1903
1904     Private Function CreateDateTimeFormatSample() As Boolean
1905         Try
1906             LabelDateTimeFormatApplied.Text = DateTime.Now.ToString(CmbDateTimeFormat.Text)
1907         Catch ex As FormatException
1908             LabelDateTimeFormatApplied.Text = My.Resources.CreateDateTimeFormatSampleText1
1909             Return False
1910         End Try
1911         Return True
1912     End Function
1913
1914     Private Sub CmbDateTimeFormat_TextUpdate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbDateTimeFormat.TextUpdate
1915         CreateDateTimeFormatSample()
1916     End Sub
1917
1918     Private Sub CmbDateTimeFormat_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbDateTimeFormat.SelectedIndexChanged
1919         CreateDateTimeFormatSample()
1920     End Sub
1921
1922     Private Sub CmbDateTimeFormat_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CmbDateTimeFormat.Validating
1923         If Not CreateDateTimeFormatSample() Then
1924             MessageBox.Show(My.Resources.CmbDateTimeFormat_Validating)
1925             e.Cancel = True
1926         End If
1927     End Sub
1928
1929     Private Sub ConnectionTimeOut_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ConnectionTimeOut.Validating
1930         Dim tm As Integer
1931         Try
1932             tm = CInt(ConnectionTimeOut.Text)
1933         Catch ex As Exception
1934             MessageBox.Show(My.Resources.ConnectionTimeOut_ValidatingText1)
1935             e.Cancel = True
1936             Exit Sub
1937         End Try
1938
1939         If tm < HttpTimeOut.MinValue OrElse tm > HttpTimeOut.MaxValue Then
1940             MessageBox.Show(My.Resources.ConnectionTimeOut_ValidatingText1)
1941             e.Cancel = True
1942         End If
1943     End Sub
1944
1945     Private Sub LabelDateTimeFormatApplied_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles LabelDateTimeFormatApplied.VisibleChanged
1946         CreateDateTimeFormatSample()
1947     End Sub
1948
1949     Private Sub TextCountApi_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextCountApi.Validating
1950         Dim cnt As Integer
1951         Try
1952             cnt = Integer.Parse(TextCountApi.Text)
1953         Catch ex As Exception
1954             MessageBox.Show(My.Resources.TextCountApi_Validating1)
1955             e.Cancel = True
1956             Exit Sub
1957         End Try
1958
1959         If cnt < 20 OrElse cnt > 200 Then
1960             MessageBox.Show(My.Resources.TextCountApi_Validating1)
1961             e.Cancel = True
1962             Exit Sub
1963         End If
1964     End Sub
1965
1966     Private Sub TextCountApiReply_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextCountApiReply.Validating
1967         Dim cnt As Integer
1968         Try
1969             cnt = Integer.Parse(TextCountApiReply.Text)
1970         Catch ex As Exception
1971             MessageBox.Show(My.Resources.TextCountApi_Validating1)
1972             e.Cancel = True
1973             Exit Sub
1974         End Try
1975
1976         If cnt < 20 OrElse cnt > 200 Then
1977             MessageBox.Show(My.Resources.TextCountApi_Validating1)
1978             e.Cancel = True
1979             Exit Sub
1980         End If
1981     End Sub
1982
1983     Public Property LimitBalloon() As Boolean
1984         Get
1985             Return _MyLimitBalloon
1986         End Get
1987         Set(ByVal value As Boolean)
1988             _MyLimitBalloon = value
1989         End Set
1990     End Property
1991
1992     Public Property EventNotifyEnabled As Boolean
1993         Get
1994             Return _MyEventNotifyEnabled
1995         End Get
1996         Set(ByVal value As Boolean)
1997             _MyEventNotifyEnabled = value
1998         End Set
1999     End Property
2000
2001     Public Property EventNotifyFlag As EVENTTYPE
2002         Get
2003             Return _MyEventNotifyFlag
2004         End Get
2005         Set(ByVal value As EVENTTYPE)
2006             _MyEventNotifyFlag = value
2007         End Set
2008     End Property
2009
2010     Public Property IsMyEventNotifyFlag As EVENTTYPE
2011         Get
2012             Return _isMyEventNotifyFlag
2013         End Get
2014         Set(ByVal value As EVENTTYPE)
2015             _isMyEventNotifyFlag = value
2016         End Set
2017     End Property
2018
2019     Public Property ForceEventNotify As Boolean
2020         Get
2021             Return _MyForceEventNotify
2022         End Get
2023         Set(ByVal value As Boolean)
2024             _MyForceEventNotify = value
2025         End Set
2026     End Property
2027
2028     Public Property FavEventUnread As Boolean
2029         Get
2030             Return _MyFavEventUnread
2031         End Get
2032         Set(ByVal value As Boolean)
2033             _MyFavEventUnread = value
2034         End Set
2035     End Property
2036
2037     Public Property TranslateLanguage As String
2038         Get
2039             Return _MyTranslateLanguage
2040         End Get
2041         Set(ByVal value As String)
2042             _MyTranslateLanguage = value
2043             ComboBoxTranslateLanguage.SelectedIndex = (New Google).GetIndexFromLanguageEnum(value)
2044         End Set
2045     End Property
2046
2047     Public Property EventSoundFile As String
2048         Get
2049             Return _MyEventSoundFile
2050         End Get
2051         Set(ByVal value As String)
2052             _MyEventSoundFile = value
2053         End Set
2054     End Property
2055
2056     Private Sub ComboBoxAutoShortUrlFirst_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxAutoShortUrlFirst.SelectedIndexChanged
2057         If ComboBoxAutoShortUrlFirst.SelectedIndex = UrlConverter.Bitly OrElse _
2058            ComboBoxAutoShortUrlFirst.SelectedIndex = UrlConverter.Jmp Then
2059             TextBitlyId.Enabled = True
2060             TextBitlyPw.Enabled = True
2061         Else
2062             TextBitlyId.Enabled = False
2063             TextBitlyPw.Enabled = False
2064         End If
2065     End Sub
2066
2067     Private Sub ButtonBackToDefaultFontColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonBackToDefaultFontColor.Click, ButtonBackToDefaultFontColor2.Click
2068         lblUnread.ForeColor = System.Drawing.SystemColors.ControlText
2069         lblUnread.Font = New Font(SystemFonts.DefaultFont, FontStyle.Bold Or FontStyle.Underline)
2070
2071         lblListFont.ForeColor = System.Drawing.SystemColors.ControlText
2072         lblListFont.Font = System.Drawing.SystemFonts.DefaultFont
2073
2074         lblDetail.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.ControlText)
2075         lblDetail.Font = System.Drawing.SystemFonts.DefaultFont
2076
2077         lblInputFont.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.ControlText)
2078         lblInputFont.Font = System.Drawing.SystemFonts.DefaultFont
2079
2080         lblSelf.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.AliceBlue)
2081
2082         lblAtSelf.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.AntiqueWhite)
2083
2084         lblTarget.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon)
2085
2086         lblAtTarget.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.LavenderBlush)
2087
2088         lblAtFromTarget.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Honeydew)
2089
2090         lblFav.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Red)
2091
2092         lblOWL.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Blue)
2093
2094         lblInputBackcolor.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon)
2095
2096         lblAtTo.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Pink)
2097
2098         lblListBackcolor.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window)
2099
2100         lblDetailBackcolor.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window)
2101
2102         lblDetailLink.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Blue)
2103
2104         lblRetweet.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Green)
2105     End Sub
2106
2107     Private Function Authorize() As Boolean
2108         Dim user As String = Me.Username.Text.Trim
2109         Dim pwd As String = Me.Password.Text.Trim
2110         If String.IsNullOrEmpty(user) OrElse String.IsNullOrEmpty(pwd) Then
2111             MessageBox.Show(My.Resources.Save_ClickText1)
2112             Return False
2113         End If
2114
2115         '現在の設定内容で通信
2116         Dim ptype As HttpConnection.ProxyType
2117         If RadioProxyNone.Checked Then
2118             ptype = HttpConnection.ProxyType.None
2119         ElseIf RadioProxyIE.Checked Then
2120             ptype = HttpConnection.ProxyType.IE
2121         Else
2122             ptype = HttpConnection.ProxyType.Specified
2123         End If
2124         Dim padr As String = TextProxyAddress.Text.Trim()
2125         Dim pport As Integer = Integer.Parse(TextProxyPort.Text.Trim())
2126         Dim pusr As String = TextProxyUser.Text.Trim()
2127         Dim ppw As String = TextProxyPassword.Text.Trim()
2128
2129         '通信基底クラス初期化
2130         HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw)
2131         HttpTwitter.TwitterUrl = TwitterAPIText.Text.Trim
2132         HttpTwitter.TwitterSearchUrl = TwitterSearchAPIText.Text.Trim
2133         If Me.AuthBasicRadio.Checked Then
2134             tw.Initialize("", "")
2135         Else
2136             tw.Initialize("", "", "")
2137         End If
2138         Dim rslt As String = tw.Authenticate(user, pwd)
2139         If String.IsNullOrEmpty(rslt) Then
2140             MessageBox.Show(My.Resources.AuthorizeButton_Click1, "Authenticate", MessageBoxButtons.OK)
2141             Me.AuthStateLabel.Text = My.Resources.AuthorizeButton_Click3
2142             Me.AuthUserLabel.Text = tw.Username
2143             Return True
2144         Else
2145             MessageBox.Show(My.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK)
2146             Me.AuthStateLabel.Text = My.Resources.AuthorizeButton_Click4
2147             Me.AuthUserLabel.Text = ""
2148             Return False
2149         End If
2150     End Function
2151
2152     Private Sub AuthorizeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorizeButton.Click
2153         If Authorize() Then CalcApiUsing()
2154     End Sub
2155
2156     Private Sub AuthClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthClearButton.Click
2157         tw.ClearAuthInfo()
2158         Me.AuthStateLabel.Text = My.Resources.AuthorizeButton_Click4
2159         Me.AuthUserLabel.Text = ""
2160         CalcApiUsing()
2161     End Sub
2162
2163     Private Sub AuthOAuthRadio_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthOAuthRadio.CheckedChanged
2164         If tw Is Nothing Then Exit Sub
2165         If AuthBasicRadio.Checked Then
2166             'BASIC認証時のみ表示
2167             tw.Initialize("", "")
2168             Me.AuthStateLabel.Enabled = False
2169             Me.AuthUserLabel.Enabled = False
2170             Me.AuthClearButton.Enabled = False
2171         Else
2172             tw.Initialize("", "", "")
2173             Me.AuthStateLabel.Enabled = True
2174             Me.AuthUserLabel.Enabled = True
2175             Me.AuthClearButton.Enabled = True
2176         End If
2177         Me.AuthStateLabel.Text = My.Resources.AuthorizeButton_Click4
2178         Me.AuthUserLabel.Text = ""
2179         CalcApiUsing()
2180     End Sub
2181
2182     Private Sub DisplayApiMaxCount()
2183         If TwitterApiInfo.MaxCount > -1 Then
2184             LabelApiUsing.Text = String.Format(My.Resources.SettingAPIUse1, TwitterApiInfo.UsingCount, TwitterApiInfo.MaxCount)
2185         Else
2186             LabelApiUsing.Text = String.Format(My.Resources.SettingAPIUse1, TwitterApiInfo.UsingCount, "???")
2187         End If
2188     End Sub
2189
2190     Private Sub CalcApiUsing()
2191         Dim UsingApi As Integer = 0
2192         Dim tmp As Integer
2193         Dim ListsTabNum As Integer = 0
2194         Dim UserTimelineTabNum As Integer = 0
2195         Dim ApiLists As Integer = 0
2196         Dim ApiUserTimeline As Integer = 0
2197         Dim UsingApiUserStream As Integer = 0
2198
2199         Try
2200             ' 初回起動時などにNothingの場合あり
2201             ListsTabNum = TabInformations.GetInstance.GetTabsByType(TabUsageType.Lists).Count
2202         Catch ex As Exception
2203             Exit Sub
2204         End Try
2205
2206         Try
2207             ' 初回起動時などにNothingの場合あり
2208             UserTimelineTabNum = TabInformations.GetInstance.GetTabsByType(TabUsageType.UserTimeline).Count
2209         Catch ex As Exception
2210             Exit Sub
2211         End Try
2212
2213         ' Recent計算 0は手動更新
2214         If Integer.TryParse(TimelinePeriod.Text, tmp) Then
2215             If tmp <> 0 Then
2216                 UsingApi += 3600 \ tmp
2217             End If
2218         End If
2219
2220         ' Reply計算 0は手動更新
2221         If Integer.TryParse(ReplyPeriod.Text, tmp) Then
2222             If tmp <> 0 Then
2223                 UsingApi += 3600 \ tmp
2224             End If
2225         End If
2226
2227         ' DM計算 0は手動更新 送受信両方
2228         If Integer.TryParse(DMPeriod.Text, tmp) Then
2229             If tmp <> 0 Then
2230                 UsingApi += (3600 \ tmp) * 2
2231             End If
2232         End If
2233
2234         ' Listsタブ計算 0は手動更新
2235         If Integer.TryParse(ListsPeriod.Text, tmp) Then
2236             If tmp <> 0 Then
2237                 ApiLists = (3600 \ tmp) * ListsTabNum
2238                 UsingApi += ApiLists
2239             End If
2240         End If
2241
2242         ' UserTimelineタブ計算 0は手動更新
2243         If Integer.TryParse(UserTimelinePeriod.Text, tmp) Then
2244             If tmp <> 0 Then
2245                 ApiUserTimeline = (3600 \ tmp) * UserTimelineTabNum
2246                 UsingApi += ApiUserTimeline
2247             End If
2248         End If
2249
2250         If tw IsNot Nothing Then
2251             If TwitterApiInfo.MaxCount = -1 Then
2252                 If Twitter.AccountState = ACCOUNT_STATE.Valid Then
2253                     TwitterApiInfo.UsingCount = UsingApi
2254                     Dim proc As New Thread(New Threading.ThreadStart(Sub()
2255                                                                          tw.GetInfoApi(Nothing) '取得エラー時はinfoCountは初期状態(値:-1)
2256                                                                          If Me.IsHandleCreated AndAlso Not Me.IsDisposed Then Invoke(New MethodInvoker(AddressOf DisplayApiMaxCount))
2257                                                                      End Sub))
2258                     proc.Start()
2259                 Else
2260                     LabelApiUsing.Text = String.Format(My.Resources.SettingAPIUse1, UsingApi, "???")
2261                 End If
2262             Else
2263                 LabelApiUsing.Text = String.Format(My.Resources.SettingAPIUse1, UsingApi, TwitterApiInfo.MaxCount)
2264             End If
2265         End If
2266
2267
2268         LabelPostAndGet.Visible = CheckPostAndGet.Checked AndAlso Not tw.UserStreamEnabled
2269         LabelUserStreamActive.Visible = tw.UserStreamEnabled
2270
2271         LabelApiUsingUserStreamEnabled.Text = String.Format(My.Resources.SettingAPIUse2, (ApiLists + ApiUserTimeline).ToString)
2272         LabelApiUsingUserStreamEnabled.Visible = tw.UserStreamEnabled
2273     End Sub
2274
2275     Private Sub CheckPostAndGet_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckPostAndGet.CheckedChanged
2276         CalcApiUsing()
2277     End Sub
2278
2279     Private Sub Setting_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
2280         Do
2281             Thread.Sleep(10)
2282             If Me.Disposing OrElse Me.IsDisposed Then Exit Sub
2283         Loop Until Me.IsHandleCreated
2284         CalcApiUsing()
2285     End Sub
2286
2287     Private Sub ButtonApiCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonApiCalc.Click
2288         CalcApiUsing()
2289     End Sub
2290
2291     Private Sub New()
2292
2293         ' この呼び出しはデザイナーで必要です。
2294         InitializeComponent()
2295
2296         ' InitializeComponent() 呼び出しの後で初期化を追加します。
2297
2298     End Sub
2299
2300     Public Shared ReadOnly Property Instance As AppendSettingDialog
2301         Get
2302             Return _instance
2303         End Get
2304     End Property
2305
2306     Private Function BitlyValidation(ByVal id As String, ByVal apikey As String) As Boolean
2307         If String.IsNullOrEmpty(id) OrElse String.IsNullOrEmpty(apikey) Then
2308             Return False
2309         End If
2310
2311         Dim req As String = "http://api.bit.ly/v3/validate"
2312         Dim content As String = ""
2313         Dim param As New Dictionary(Of String, String)
2314
2315         param.Add("login", "tweenapi")
2316         param.Add("apiKey", "R_c5ee0e30bdfff88723c4457cc331886b")
2317         param.Add("x_login", id)
2318         param.Add("x_apiKey", apikey)
2319         param.Add("format", "txt")
2320
2321         If Not (New HttpVarious).PostData(req, param, content) Then
2322             Return True             ' 通信エラーの場合はとりあえずチェックを通ったことにする
2323         ElseIf content.Trim() = "1" Then
2324             Return True             ' 検証成功
2325         ElseIf content.Trim() = "0" Then
2326             Return False            ' 検証失敗 APIキーとIDの組み合わせが違う
2327         Else
2328             Return True             ' 規定外応答:通信エラーの可能性があるためとりあえずチェックを通ったことにする
2329         End If
2330     End Function
2331
2332     Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
2333         _ValidationError = False
2334     End Sub
2335
2336     Public Property HotkeyEnabled As Boolean
2337     Public Property HotkeyKey As Keys
2338     Public Property HotkeyValue As Integer
2339     Public Property HotkeyMod As Keys
2340
2341     Private Sub HotkeyText_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles HotkeyText.KeyDown
2342         'KeyValueで判定する。
2343         '表示文字とのテーブルを用意すること
2344         HotkeyText.Text = e.KeyCode.ToString
2345         HotkeyCode.Text = e.KeyValue.ToString
2346         HotkeyText.Tag = e.KeyCode
2347         e.Handled = True
2348         e.SuppressKeyPress = True
2349     End Sub
2350
2351     Private Sub HotkeyCheck_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HotkeyCheck.CheckedChanged
2352         HotkeyCtrl.Enabled = HotkeyCheck.Checked
2353         HotkeyAlt.Enabled = HotkeyCheck.Checked
2354         HotkeyShift.Enabled = HotkeyCheck.Checked
2355         HotkeyWin.Enabled = HotkeyCheck.Checked
2356         HotkeyText.Enabled = HotkeyCheck.Checked
2357         HotkeyCode.Enabled = HotkeyCheck.Checked
2358     End Sub
2359
2360     Public Property BlinkNewMentions As Boolean
2361
2362     Private Sub GetMoreTextCountApi_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles GetMoreTextCountApi.Validating
2363         Dim cnt As Integer
2364         Try
2365             cnt = Integer.Parse(GetMoreTextCountApi.Text)
2366         Catch ex As Exception
2367             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2368             e.Cancel = True
2369             Exit Sub
2370         End Try
2371
2372         If Not cnt = 0 AndAlso (cnt < 20 OrElse cnt > 200) Then
2373             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2374             e.Cancel = True
2375             Exit Sub
2376         End If
2377     End Sub
2378
2379     Private Sub UseChangeGetCount_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UseChangeGetCount.CheckedChanged
2380         GetMoreTextCountApi.Enabled = UseChangeGetCount.Checked
2381         FirstTextCountApi.Enabled = UseChangeGetCount.Checked
2382         Label28.Enabled = UseChangeGetCount.Checked
2383         Label30.Enabled = UseChangeGetCount.Checked
2384         Label53.Enabled = UseChangeGetCount.Checked
2385         Label66.Enabled = UseChangeGetCount.Checked
2386         Label17.Enabled = UseChangeGetCount.Checked
2387         Label25.Enabled = UseChangeGetCount.Checked
2388         SearchTextCountApi.Enabled = UseChangeGetCount.Checked
2389         FavoritesTextCountApi.Enabled = UseChangeGetCount.Checked
2390         UserTimelineTextCountApi.Enabled = UseChangeGetCount.Checked
2391         ListTextCountApi.Enabled = UseChangeGetCount.Checked
2392     End Sub
2393
2394     Private Sub FirstTextCountApi_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles FirstTextCountApi.Validating
2395         Dim cnt As Integer
2396         Try
2397             cnt = Integer.Parse(FirstTextCountApi.Text)
2398         Catch ex As Exception
2399             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2400             e.Cancel = True
2401             Exit Sub
2402         End Try
2403
2404         If Not cnt = 0 AndAlso (cnt < 20 OrElse cnt > 200) Then
2405             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2406             e.Cancel = True
2407             Exit Sub
2408         End If
2409     End Sub
2410
2411     Private Sub CheckEnableBasicAuth_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckEnableBasicAuth.CheckedChanged
2412         AuthBasicRadio.Enabled = CheckEnableBasicAuth.Checked
2413     End Sub
2414
2415     Private Sub SearchTextCountApi_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SearchTextCountApi.Validating
2416         Dim cnt As Integer
2417         Try
2418             cnt = Integer.Parse(SearchTextCountApi.Text)
2419         Catch ex As Exception
2420             MessageBox.Show(My.Resources.TextSearchCountApi_Validating1)
2421             e.Cancel = True
2422             Exit Sub
2423         End Try
2424
2425         If Not cnt = 0 AndAlso (cnt < 20 OrElse cnt > 100) Then
2426             MessageBox.Show(My.Resources.TextSearchCountApi_Validating1)
2427             e.Cancel = True
2428             Exit Sub
2429         End If
2430     End Sub
2431
2432     Private Sub FavoritesTextCountApi_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles FavoritesTextCountApi.Validating
2433         Dim cnt As Integer
2434         Try
2435             cnt = Integer.Parse(FavoritesTextCountApi.Text)
2436         Catch ex As Exception
2437             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2438             e.Cancel = True
2439             Exit Sub
2440         End Try
2441
2442         If Not cnt = 0 AndAlso (cnt < 20 OrElse cnt > 200) Then
2443             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2444             e.Cancel = True
2445             Exit Sub
2446         End If
2447     End Sub
2448
2449     Private Sub UserTimelineTextCountApi_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles UserTimelineTextCountApi.Validating
2450         Dim cnt As Integer
2451         Try
2452             cnt = Integer.Parse(UserTimelineTextCountApi.Text)
2453         Catch ex As Exception
2454             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2455             e.Cancel = True
2456             Exit Sub
2457         End Try
2458
2459         If Not cnt = 0 AndAlso (cnt < 20 OrElse cnt > 200) Then
2460             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2461             e.Cancel = True
2462             Exit Sub
2463         End If
2464     End Sub
2465
2466     Private Sub ListTextCountApi_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ListTextCountApi.Validating
2467         Dim cnt As Integer
2468         Try
2469             cnt = Integer.Parse(ListTextCountApi.Text)
2470         Catch ex As Exception
2471             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2472             e.Cancel = True
2473             Exit Sub
2474         End Try
2475
2476         If Not cnt = 0 AndAlso (cnt < 20 OrElse cnt > 200) Then
2477             MessageBox.Show(My.Resources.TextCountApi_Validating1)
2478             e.Cancel = True
2479             Exit Sub
2480         End If
2481     End Sub
2482
2483     Private Sub CheckEventNotify_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
2484                     Handles CheckEventNotify.CheckedChanged, CheckFavoritesEvent.CheckStateChanged, _
2485                             CheckUnfavoritesEvent.CheckStateChanged, CheckFollowEvent.CheckStateChanged, _
2486                             CheckListMemberAddedEvent.CheckStateChanged, CheckListMemberRemovedEvent.CheckStateChanged, _
2487                             CheckListCreatedEvent.CheckStateChanged, CheckUserUpdateEvent.CheckStateChanged
2488         _MyEventNotifyEnabled = CheckEventNotify.Checked
2489         GetEventNotifyFlag(_MyEventNotifyFlag, _isMyEventNotifyFlag)
2490         ApplyEventNotifyFlag(_MyEventNotifyEnabled, _MyEventNotifyFlag, _isMyEventNotifyFlag)
2491     End Sub
2492
2493     Private Class EventCheckboxTblElement
2494         Public CheckBox As CheckBox
2495         Public Type As EVENTTYPE
2496     End Class
2497
2498     Private Function GetEventCheckboxTable() As EventCheckboxTblElement()
2499
2500         Static _eventCheckboxTable As EventCheckboxTblElement() = {
2501             New EventCheckboxTblElement With {.CheckBox = CheckFavoritesEvent, .Type = EVENTTYPE.Favorite},
2502             New EventCheckboxTblElement With {.CheckBox = CheckUnfavoritesEvent, .Type = EVENTTYPE.Unfavorite},
2503             New EventCheckboxTblElement With {.CheckBox = CheckFollowEvent, .Type = EVENTTYPE.Follow},
2504             New EventCheckboxTblElement With {.CheckBox = CheckListMemberAddedEvent, .Type = EVENTTYPE.ListMemberAdded},
2505             New EventCheckboxTblElement With {.CheckBox = CheckListMemberRemovedEvent, .Type = EVENTTYPE.ListMemberRemoved},
2506             New EventCheckboxTblElement With {.CheckBox = CheckBlockEvent, .Type = EVENTTYPE.Block},
2507             New EventCheckboxTblElement With {.CheckBox = CheckUserUpdateEvent, .Type = EVENTTYPE.UserUpdate},
2508             New EventCheckboxTblElement With {.CheckBox = CheckListCreatedEvent, .Type = EVENTTYPE.ListCreated}
2509         }
2510
2511         Return _eventCheckboxTable
2512     End Function
2513     
2514     Private Sub GetEventNotifyFlag(ByRef eventnotifyflag As EVENTTYPE, ByRef isMyeventnotifyflag As EVENTTYPE)
2515         Dim evt As EVENTTYPE = EVENTTYPE.None
2516         Dim myevt As EVENTTYPE = EVENTTYPE.None
2517
2518         For Each tbl As EventCheckboxTblElement In GetEventCheckboxTable()
2519             Select Case tbl.CheckBox.CheckState
2520                 Case CheckState.Checked
2521                     evt = evt Or tbl.Type
2522                     myevt = myevt Or tbl.Type
2523                 Case CheckState.Indeterminate
2524                     evt = evt Or tbl.Type
2525                 Case CheckState.Unchecked
2526                     '
2527             End Select
2528         Next
2529         eventnotifyflag = evt
2530         isMyeventnotifyflag = myevt
2531     End Sub
2532
2533     Private Sub ApplyEventNotifyFlag(ByVal rootEnabled As Boolean, ByVal eventnotifyflag As EVENTTYPE, ByVal isMyeventnotifyflag As EVENTTYPE)
2534         Dim evt = eventnotifyflag
2535         Dim myevt = isMyeventnotifyflag
2536
2537         CheckEventNotify.Checked = rootEnabled
2538
2539         For Each tbl As EventCheckboxTblElement In GetEventCheckboxTable()
2540             If CBool(evt And tbl.Type) Then
2541                 If CBool(myevt And tbl.Type) Then
2542                     tbl.CheckBox.CheckState = CheckState.Checked
2543                 Else
2544                     tbl.CheckBox.CheckState = CheckState.Indeterminate
2545                 End If
2546             Else
2547                 tbl.CheckBox.CheckState = CheckState.Unchecked
2548             End If
2549             tbl.CheckBox.Enabled = rootEnabled
2550         Next
2551
2552     End Sub
2553
2554     Private Sub CheckForceEventNotify_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckForceEventNotify.CheckedChanged
2555         _MyForceEventNotify = CheckEventNotify.Checked
2556     End Sub
2557
2558     Private Sub CheckFavEventUnread_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckFavEventUnread.CheckedChanged
2559         _MyFavEventUnread = CheckFavEventUnread.Checked
2560     End Sub
2561
2562     Private Sub ComboBoxTranslateLanguage_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxTranslateLanguage.SelectedIndexChanged
2563         _MyTranslateLanguage = (New Google).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex)
2564     End Sub
2565
2566     Private Sub SoundFileListup()
2567         If _MyEventSoundFile Is Nothing Then Exit Sub
2568         _soundfileListup = True
2569         ComboBoxEventNotifySound.Items.Clear()
2570         ComboBoxEventNotifySound.Items.Add("")
2571         Dim oDir As IO.DirectoryInfo = New IO.DirectoryInfo(My.Application.Info.DirectoryPath + IO.Path.DirectorySeparatorChar)
2572         If IO.Directory.Exists(IO.Path.Combine(My.Application.Info.DirectoryPath, "Sounds")) Then
2573             oDir = oDir.GetDirectories("Sounds")(0)
2574         End If
2575         For Each oFile As IO.FileInfo In oDir.GetFiles("*.wav")
2576             ComboBoxEventNotifySound.Items.Add(oFile.Name)
2577         Next
2578         Dim idx As Integer = ComboBoxEventNotifySound.Items.IndexOf(_MyEventSoundFile)
2579         If idx = -1 Then idx = 0
2580         ComboBoxEventNotifySound.SelectedIndex = idx
2581         _soundfileListup = False
2582     End Sub
2583
2584     Private Sub ComboBoxEventNotifySound_VisibleChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxEventNotifySound.VisibleChanged
2585         SoundFileListup()
2586     End Sub
2587
2588     Private Sub ComboBoxEventNotifySound_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxEventNotifySound.SelectedIndexChanged
2589         If _soundfileListup Then Exit Sub
2590
2591         _MyEventSoundFile = DirectCast(ComboBoxEventNotifySound.SelectedItem, String)
2592     End Sub
2593
2594 End Class