Exemplo n.º 1
0
 private void Window_Closed_1(object sender, EventArgs e)
 {
     AbortAllThread();
     if ((bool)IsCancelCheckBox.IsChecked)
     {
         try
         {
             ProxyHelper proxy = new ProxyHelper();
             proxy.CancelProxy();
             //MessageBox.Show("取消代理成功!");
         }
         catch
         {
             //MessageBox.Show("取消代理失败!");
         }
     }
 }
Exemplo n.º 2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)//获取数据
        {
            //new Thread(new ThreadStart(delegate
            //{
            //    msgLabel.Dispatcher.Invoke(new Action(delegate
            //    {
            //        msgLabel.Content = "123";
            //    }), null);
            //})).Start();
            msgLabel.Content = "正在获取中,请稍后...";
            DispatcherHelper.DoEvents();
            myProxyList.Clear();
            myListView.ItemsSource = null;
            myListView.ItemsSource = myProxyList;
            ProxyHelper proxy = new ProxyHelper();
            string      strReturn;

            switch (srcComboBox.SelectedIndex)
            {
            case 0:
                strReturn = proxy.GetCnproxyFreeIP(myProxyList);
                break;

            case 1:
                strReturn = proxy.GetXiciFreeIP(myProxyList, 0);
                break;

            case 2:
                strReturn = proxy.GetXiciFreeIP(myProxyList, 1);
                break;

            case 3:
                strReturn = proxy.GetXiciFreeIP(myProxyList, 2);
                break;

            case 4:
                strReturn = proxy.GetXiciFreeIP(myProxyList, 3);
                break;

            default:
                strReturn = "未知错误";
                break;
            }
            msgLabel.Content = strReturn;
        }
Exemplo n.º 3
0
        private void MenuItem_Click_3(object sender, RoutedEventArgs e)//一键获取
        {
            msgLabel.Content = "正在获取中,请稍后...";
            DispatcherHelper.DoEvents();
            myProxyList.Clear();
            myListView.ItemsSource = null;
            myListView.ItemsSource = myProxyList;
            ProxyHelper proxy = new ProxyHelper();
            string      strReturn;

            switch (srcComboBox.SelectedIndex)
            {
            case 0:
                strReturn = proxy.GetCnproxyFreeIP(myProxyList);
                break;

            case 1:
                strReturn = proxy.GetXiciFreeIP(myProxyList, 0);
                break;

            case 2:
                strReturn = proxy.GetXiciFreeIP(myProxyList, 1);
                break;

            case 3:
                strReturn = proxy.GetXiciFreeIP(myProxyList, 2);
                break;

            case 4:
                strReturn = proxy.GetXiciFreeIP(myProxyList, 3);
                break;

            default:
                strReturn = "未知错误";
                break;
            }
            msgLabel.Content = strReturn;
        }