OSDN Git Service

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