コード例 #1
0
ファイル: Form1.cs プロジェクト: lockehamann/GetCourseInfo
        TsinghuaCourseInfo GetTsinghuaCourseInfoHelper()
        {
            var helper = TsinghuaCourseInfo.LoadFromDataFile();

            if (helper == null)
            {
                Invoke(new Action(() =>
                {
                    using (var loginForm = new LoginForm())
                    {
                        var dialogResult = loginForm.ShowDialog();
                        if (dialogResult != DialogResult.Yes)
                        {
                            menuStrip1.Enabled = true;
                            显示网络学堂主界面ToolStripMenuItem.Enabled = false;
                            throw new NoLoginIn();
                        }

                        var userId = loginForm.textBox1.Text;
                        var password = loginForm.maskedTextBox1.Text;
                        helper = new TsinghuaCourseInfo(userId, password);
                    }
                }));
            }

            return helper;
        }
コード例 #2
0
        TsinghuaCourseInfo GetTsinghuaCourseInfoHelper()
        {
            var helper = TsinghuaCourseInfo.LoadFromDataFile();

            if (helper == null)
            {
                this.Invoke(new Action(() =>
                {
                    var loginForm = new LoginForm();

                    if (loginForm.ShowDialog() != DialogResult.Yes)
                    {
                        menuStrip1.Enabled = true;
                        显示网络学堂主界面ToolStripMenuItem.Enabled = false;
                        选择课程范围ToolStripMenuItem.Enabled = false;
                        throw new NoLoginIn();
                    }

                    helper = new TsinghuaCourseInfo(loginForm.textBox1.Text, loginForm.maskedTextBox1.Text);
                }));
            }

            return helper;
        }