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; }
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; }