コード例 #1
0
        private void proxyToggleBtn_Click(object sender, EventArgs e)
        {
            var proxy          = new ProxyHandler();
            var threadHandler  = new ThreadHandler();
            var installHandler = new InstallHandler();

            if (ProxyHandler.IsRunning)
            {
                threadHandler.StopRequestThread();
                proxy.Stop();
                installHandler.Uninstall(true);
                runProxyLbl.Text = @"Proxy not running";
            }
            else
            {
                proxy.Start();
                threadHandler.StartRequestThread();
                installHandler.Install();
                runProxyLbl.Text = @"Proxy running";
            }
        }