root/lang/vb2005/FuwaKumo/trunk/FuwaKumo/FuwaLoginDialog.vb @ 34124

Revision 34124, 3.5 kB (checked in by kiri_feather, 5 years ago)
Line 
1Imports System.Windows.Forms
2
3Public Class FuwaLoginDialog
4    Private WithEvents _controller As FuwaController
5
6    Shared Sub Main()
7        Dim f As New FuwaLoginDialog
8        Application.Run()
9    End Sub
10
11    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
12        'Me.DialogResult = System.Windows.Forms.DialogResult.OK
13        Me.Visible = False
14        _controller.StartGet()
15    End Sub
16
17    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
18        'Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
19        Me.Visible = False
20        _controller.StopGet()
21        Me.Close()
22        Application.Exit()
23    End Sub
24
25    Private Sub FuwaLoginDialog_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
26        Me.TopMost = True
27    End Sub
28
29    Private Sub FuwaSettingDialog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
30    End Sub
31
32    Public Sub New()
33
34        ' ���̌Ăяo���́AWindows �t�H�[�� �f�U�C�i�ŕK�v�ł��B
35        InitializeComponent()
36
37        ' InitializeComponent() �Ăяo���̌������lj���܂��B
38        Me.Visible = False
39        '�R���g���[���쐬
40        _controller = New FuwaController()
41        _controller.LoginSyncObject = Me
42        _controller.StartGet()
43    End Sub
44
45    Private Sub FuwaController_RequireAuth(ByVal sender As Object, ByVal e As EventArgs) Handles _controller.RequireAuth
46        Me.AccessToken.Text = SettingTwitter.Instance.Token
47        Me.AccessTokenSecret.Text = SettingTwitter.Instance.TokenSecret
48        Me.Visible = True
49    End Sub
50
51    Private Sub ReqAuthButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReqAuthButton.Click
52        _controller.GetAuthUrl()
53    End Sub
54
55    Private Sub ReqAccessButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReqAccessButton.Click
56        _controller.GetAuthToken(Me.PINCode.Text)
57        Me.AccessToken.Text = SettingTwitter.Instance.Token
58        Me.AccessTokenSecret.Text = SettingTwitter.Instance.TokenSecret
59    End Sub
60
61    Private Sub TasktrayIcon_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TasktrayIcon.Click
62        _controller.DisplayFuwaFuwa()
63    End Sub
64
65    Private Sub TasktrayIcon_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TasktrayIcon.MouseDoubleClick
66        Me.Visible = True
67    End Sub
68
69    Private Sub FuwaLoginDialog_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
70        Me.AccessToken.Text = SettingTwitter.Instance.Token
71        Me.AccessTokenSecret.Text = SettingTwitter.Instance.TokenSecret
72        Me.PINCode.Text = ""
73        Me.ReqAccessButton.Enabled = False
74        Me.OK_Button.Enabled = Not (String.IsNullOrEmpty(Me.AccessToken.Text))
75    End Sub
76
77    Private Sub PINCode_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PINCode.TextChanged
78        If PINCode.Text.Length = 6 Then
79            Me.ReqAccessButton.Enabled = True
80        Else
81            Me.ReqAccessButton.Enabled = False
82        End If
83    End Sub
84
85    Private Sub AccessToken_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles AccessToken.TextChanged
86        Me.OK_Button.Enabled = Not (String.IsNullOrEmpty(Me.AccessToken.Text))
87    End Sub
88End Class
Note: See TracBrowser for help on using the browser.