private void TestButton_Click(object sender, RoutedEventArgs e) { foreach (UIElement pru in rel.Children) { ProxyItem proxy = pru as ProxyItem; Task.Run(() => { proxy.TestSpeed(); }); } }
async Task DownloadProxies() { try { ProxyList = await ProxyFetcher.FetchFrom(""); } catch (Exception e) { Download_List.Content = "Failed"; } foreach (Proxy proxy in ProxyList) { ProxyItem pi = new ProxyItem(proxy); pi.Margin = new Thickness(pi.Margin.Left + 5, 0, pi.Margin.Right + 5, pi.Margin.Bottom + 5); rel.Children.Add(pi); } }
private async void AddButton_Click(object sender, RoutedEventArgs e) { if (IPTextBox.Text == null || PortTextBox.Text == null) { return; } try { ProxyList.Add(new Proxy(IPTextBox.Text, Convert.ToInt32(PortTextBox.Text))); ProxyItem pi = new ProxyItem(new Proxy(IPTextBox.Text, Convert.ToInt32(PortTextBox.Text))); pi.Margin = new Thickness(pi.Margin.Left + 5, 0, pi.Margin.Right + 5, pi.Margin.Bottom + 5); rel.Children.Add(pi); } catch (Exception t) { PortTextBox.Text = t.Message; } }
List <Proxy> ParseProxiest() //This was all i could do :D { if (Sproxylist == null) { return(null); } List <Proxy> PastedList = new List <Proxy>(); int seek = 0; string IP; string port; int last = 0; for (int i = Sproxylist.Length - 1; i > 0; i--) { if (Sproxylist[i] == '\t') { last = i; break; } } while (seek < last - 2) { IP = Sproxylist.Substring(seek, Sproxylist.IndexOf('\t', seek) - seek); seek = Sproxylist.IndexOf('\t', seek); port = Sproxylist.Substring(seek + 1, Sproxylist.IndexOf('\t', seek + 1) - seek - 1); seek = Sproxylist.IndexOf('\n', seek + 2) + 1; if (seek == 0) { break; } PastedList.Add(new Proxy(IP, Convert.ToInt32(port))); ProxyItem pi = new ProxyItem(new Proxy(IP, Convert.ToInt32(port))); pi.Margin = new Thickness(pi.Margin.Left + 5, 0, pi.Margin.Right + 5, pi.Margin.Bottom + 5); rel.Children.Add(pi); } return(PastedList); }