private void button1_Click(object sender, RoutedEventArgs e) { if (cb_interfaceList.SelectedIndex == -1) { MessageBox.Show("You must select an interface to listen on!"); return; } if (textBox1.Text == "") { MessageBox.Show("You must choose one or more TCP ports to listen on for Proxy traffic!"); return; } string portsStr = textBox1.Text; string[] portsStrs = portsStr.Split(','); int[] ports = new int[portsStrs.Length]; for (int i = 0; i < portsStrs.Length; i++) { ports[i] = int.Parse(portsStrs[i]); } CaptureService.ProxyCapturePorts = ports; CaptureService.SelectDevice(cb_interfaceList.SelectedIndex); this.Close(); }