示例#1
0
文件: FrmMain.cs 项目: jankiny/SrLink
        public FrmMain()
        {
            InitializeComponent();
            Config = new ConfigModel();
            ConfigService.LoadConfig(ref Config);
            if (ConfigService.IsEmpty(ref Config))
            {
                ShowTip(ToolTipIcon.Info, "欢迎使用SrLink", "检测到当前配置为空,请先到配置页面设置连接信息。", false);
                ConfigService.InitialConfig(ref Config);
            }

            _frmDebug = new FrmDebug();

            //TMR_SrLink.Enabled = Config.AutoLink;

            Application.ApplicationExit += (sender, args) =>
            {
                SrLinkService.DisconnectVpn();
                _frmDebug.Dispose();
                ConfigService.SaveConfig(ref Config);
            };
        }
示例#2
0
文件: FrmMain.cs 项目: jankiny/SrLink
 private void 断开连接ToolStripMenuItem_ClickAsync(object sender, EventArgs e)
 {
     _frmDebug.WriteToBoard("(用户操作)执行断开连接");
     try
     {
         if (Config.NetType == 1)
         {
             ShowTip(ToolTipIcon.Warning, "无效操作", "教师网暂时无法断开连接");
         }
         else
         {
             SrLinkService.DisconnectVpn();
             ShowTip(ToolTipIcon.Warning, "断开网络", "网络已断开");
             //if (await SrLinkService.TestInternetAsync())
             //    SrLinkService.DisconnectVpn();
             //else
             //    ShowTip(ToolTipIcon.Warning, "无效操作", "网络还未连接");
         }
     }
     catch (Exception err)
     {
         LoggerService.SaveLog("断开连接ToolStripMenuItem_Click", err);
     }
 }