Exemple #1
0
 private void TryLinkTeacher()
 {
     if (VpnService.Worked())
     {
         if (MessageBox.Show("警告:如果切换网络类型,会断开当前网络。是否切换?", "当前网络正在使用", MessageBoxButtons.YesNo,
                             MessageBoxIcon.Warning) != DialogResult.Yes)
         {
             return;
         }
         VpnService.Abort();
     }
     if (SrLinkService.RegisterSchoolNet(Config.TeacherNet.SettingCertify.UserId,
                                         Config.TeacherNet.SettingCertify.Password))
     {
         Config.NetType = 1;
         ShowTip(ToolTipIcon.Info, "切换到教师网", $"{Config.TeacherNet.SettingCertify.UserId}登录成功",
                 false);
     }
     else
     {
         Config.NetType = 0;
         ShowTip(ToolTipIcon.Error, "切换到教师网", "登录失败:用户名/密码错误。请进入配置页面手动尝试。", false);
     }
     ConfigService.SaveConfig(ref Config);
 }
Exemple #2
0
 private void RBT_Teacher_CheckedChanged(object sender, EventArgs e)
 {
     if (((RadioButton)sender).Checked)
     {
         // 保存配置
         Config.NetType = 1;
         // 判断切换是否合法
         PNL_Student.Visible = RBT_Student.Checked;
         PNL_Teacher.Visible = RBT_Teacher.Checked;
         // TODO: 由于断网,下面的代码没有经过测试
         if (VpnService.Worked())
         {
             if (MessageBox.Show("警告:如果切换网络类型,会断开当前网络。是否切换?", "当前网络正在使用", MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Warning) == DialogResult.Yes)
             {
                 VpnService.Abort();
             }
             else
             {
                 RBT_Student.Checked = true;
                 Config.NetType      = 0;
             }
         }
         ConfigService.SaveConfig(ref Config);
         ReFreshUi();
     }
 }
Exemple #3
0
 private void FRM_Main_Load(object sender, EventArgs e)
 {
     try
     {
         版本ToolStripMenuItem.Text = StringHelper.GetAppString("Version");
         WindowState = FormWindowState.Minimized;
         ShowScreen(new SubFrmNormal(_frmDebug));
         VpnService.Abort();
         TMR_SrLink.Enabled = (Config.NetType == 0 && Config.StudentNet.AutoLink);
     }
     catch (Exception err)
     {
         LoggerService.SaveLog("FRM_Main_Load", err);
     }
 }