Example #1
0
        public MainForm()
        {
            InitializeComponent();
            this.ShowInTaskbar             = false;
            this.WindowState               = FormWindowState.Minimized;
            this.Text                      = Utils.GetVersion();
            pacListHandle                  = new PACListHandle();
            pacListHandle.UpdateCompleted += (sender, args) =>
            {
                if (args.Success)
                {
                    v2rayHandler_ProcessEvent(false, "PAC更新成功!");
                }
                else
                {
                    v2rayHandler_ProcessEvent(false, "PAC更新失败!");
                }
            };
            pacListHandle.Error += (sender, args) =>
            {
                v2rayHandler_ProcessEvent(true, args.GetException().Message);
            };

            Application.ApplicationExit += (sender, args) =>
            {
                Utils.ClearTempPath();
            };
        }
Example #2
0
 private void UpdatePAC()
 {
     if (pacListHandle == null)
     {
         pacListHandle = new PACListHandle();
     }
     pacListHandle.UpdatePACFromGFWList(config);
 }
Example #3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            ConfigHandler.LoadConfig(ref config);
            v2rayHandler = new V2rayHandler();
            v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent;

            pacListHandle = new PACListHandle();
            pacListHandle.UpdateCompleted += (sender2, args) =>
            {
                if (args.Success)
                {
                    v2rayHandler_ProcessEvent(false, "PAC更新成功!");
                }
                else
                {
                    v2rayHandler_ProcessEvent(false, "PAC更新失败!");
                }
            };
            pacListHandle.Error += (sender2, args) =>
            {
                v2rayHandler_ProcessEvent(true, args.GetException().Message);
            };
        }
Example #4
0
 private void tsbCheckUpdatePACList_Click(object sender, EventArgs e)
 {
     if (pacListHandle == null)
     {
         pacListHandle = new PACListHandle();
         pacListHandle.UpdateCompleted += (sender2, args) =>
         {
             if (args.Success)
             {
                 v2rayHandler_ProcessEvent(false, "PAC更新成功!");
             }
             else
             {
                 v2rayHandler_ProcessEvent(false, "PAC更新失败!");
             }
         };
         pacListHandle.Error += (sender2, args) =>
         {
             v2rayHandler_ProcessEvent(true, args.GetException().Message);
         };
     }
     v2rayHandler_ProcessEvent(false, "开始更新PAC...");
     pacListHandle.UpdatePACFromGFWList(config);
 }
Example #5
0
 private void tsbCheckUpdatePACList_Click(object sender, EventArgs e)
 {
     if (pacListHandle == null)
     {
         pacListHandle = new PACListHandle();
         pacListHandle.UpdateCompleted += (sender2, args) =>
         {
             if (args.Success)
             {
                 AppendText(false, UIRes.I18N("MsgPACUpdateSuccessfully"));
             }
             else
             {
                 AppendText(false, UIRes.I18N("MsgPACUpdateFailed"));
             }
         };
         pacListHandle.Error += (sender2, args) =>
         {
             AppendText(true, args.GetException().Message);
         };
     }
     AppendText(false, UIRes.I18N("MsgStartUpdatingPAC"));
     pacListHandle.UpdatePACFromGFWList(config);
 }