private void click_AddRule(object sender, RoutedEventArgs e) { int port; try { port = Int32.Parse(TextBoxPort.Text); } catch (FormatException) { MessageBox.Show("Port is not a number! Please enter a valid port number then try again."); return; } bool def = (bool)CheckBoxDefault.IsChecked; //should never be null string ssid; if (TextBoxSsid.IsEnabled) { if (TextBoxSsid.Text == "") { ssid = "Put something here"; //TODO: Check for valid SSID } else { ssid = TextBoxSsid.Text; } } else { ssid = ""; } string host; if (TextBoxProxy.IsEnabled) { if (TextBoxProxy.Text == "") { host = "localhost"; //TODO: Check for valid host } else { host = TextBoxProxy.Text; } } else { host = ""; } returned_rule = new ProxyRule(new ProxyHost(host, port), ssid); this.Close(); }
private void click_AddRule(object sender, RoutedEventArgs e) { AddRule window = new AddRule(); ProxyRule newrule = null; window.ShowDialog(); newrule = window.GetRule(); if (newrule != null) { rules.Add(newrule); } WriteRules(); }
private void click_AddRule(object sender, RoutedEventArgs e) { int port; try { port = Int32.Parse(TextBoxPort.Text); } catch (FormatException) { MessageBox.Show("Port is not a number! Please enter a valid port number then try again."); return; } bool def = (bool)CheckBoxDefault.IsChecked; //should never be null string ssid; if (TextBoxSsid.IsEnabled) if (TextBoxSsid.Text == "") ssid = "Put something here"; //TODO: Check for valid SSID else ssid = TextBoxSsid.Text; else ssid = ""; string host; if (TextBoxProxy.IsEnabled) if (TextBoxProxy.Text == "") host = "localhost"; //TODO: Check for valid host else host = TextBoxProxy.Text; else host = ""; returned_rule = new ProxyRule(new ProxyHost(host, port), ssid); this.Close(); }
private void click_Cancel(object sender, RoutedEventArgs e) { returned_rule = null; }
private void click_Cancel(object sender, RoutedEventArgs e) { returned_rule = null; Close(); }