/* NAT选项卡*/ private void AddNATRulebutton_Click(object sender, RoutedEventArgs e) { StaticGlobal.editflag = false; NATConfigurationDetail fw = new NATConfigurationDetail(); fw.ShowDialog(); }
private void NATeditclick(object sender, MouseButtonEventArgs e) { NATConfigurationDetail fwcd = new NATConfigurationDetail(); if (NATComboBox.SelectedItem.ToString() == "DNAT") { fwcd.NATComboBox.Text = "DNAT"; string[] origin_dstIP = (DNATdataGrid.SelectedItem as DNATRuleDataTable).origin_dstIP.ToString().Split('.'); string[] map_IP = (DNATdataGrid.SelectedItem as DNATRuleDataTable).map_IP.ToString().Split('.'); fwcd.NATComboBox.Text = NATComboBox.Text.ToString(); fwcd.srcStarttextBox_1.Text = origin_dstIP[0]; fwcd.srcStarttextBox_2.Text = origin_dstIP[1]; fwcd.srcStarttextBox_3.Text = origin_dstIP[2]; fwcd.srcStarttextBox_4.Text = origin_dstIP[3]; fwcd.dstStarttextBox_1.Text = map_IP[0]; fwcd.dstStarttextBox_2.Text = map_IP[1]; fwcd.dstStarttextBox_3.Text = map_IP[2]; fwcd.dstStarttextBox_4.Text = map_IP[3]; fwcd.orig_dportBox.Text = (DNATdataGrid.SelectedItem as DNATRuleDataTable).origin_dport.ToString(); fwcd.nat_dportBox.Text = (DNATdataGrid.SelectedItem as DNATRuleDataTable).map_port.ToString(); fwcd.ShowDialog(); } if (NATComboBox.SelectedItem.ToString() == "SNAT") { fwcd.NATComboBox.Text = "SNAT"; fwcd.iface.Visibility = Visibility.Visible; fwcd.ETHComboBox.Visibility = Visibility.Visible; fwcd.dstIP.Content = "设备IP地址 :"; fwcd.NATIP.Content = "网口IP :"; fwcd.orig_dport.Content = "映射IP地址 :" + StaticGlobal.FwMACandIP[StaticGlobal.firewallmac]; fwcd.orig_dportBox.Visibility = Visibility.Collapsed; fwcd.nat_dport.Visibility = Visibility.Collapsed; fwcd.nat_dportBox.Visibility = Visibility.Collapsed; string[] origin_devIP = (SNATdataGrid.SelectedItem as SNATRuleDataTable).origin_devIP.ToString().Split('.'); string[] EthIP = (SNATdataGrid.SelectedItem as SNATRuleDataTable).EthIP.ToString().Split('.'); //string[] NATIP = (SNATdataGrid.SelectedItem as SNATRuleDataTable).NATIP.ToString().Split('.'); fwcd.ETHComboBox.Text = (SNATdataGrid.SelectedItem as SNATRuleDataTable).EthName.ToString(); fwcd.srcStarttextBox_1.Text = origin_devIP[0]; fwcd.srcStarttextBox_2.Text = origin_devIP[1]; fwcd.srcStarttextBox_3.Text = origin_devIP[2]; fwcd.srcStarttextBox_4.Text = origin_devIP[3]; fwcd.dstStarttextBox_1.Text = EthIP[0]; fwcd.dstStarttextBox_2.Text = EthIP[1]; fwcd.dstStarttextBox_3.Text = EthIP[2]; fwcd.dstStarttextBox_4.Text = EthIP[3]; fwcd.ShowDialog(); } }
private void NATeditclick(object sender, MouseButtonEventArgs e) { NATConfigurationDetail fwcd = new NATConfigurationDetail(); if (NATComboBox.SelectedItem.ToString() == "DNAT") { fwcd.NATComboBox.Text = "DNAT"; string[] origin_dstIP = (DNATdataGrid.SelectedItem as DNATRuleDataTable).origin_dstIP.ToString().Split('.'); string[] map_IP = (DNATdataGrid.SelectedItem as DNATRuleDataTable).map_IP.ToString().Split('.'); fwcd.NATComboBox.Text = NATComboBox.Text.ToString(); fwcd.srcStarttextBox_1.Text = origin_dstIP[0]; fwcd.srcStarttextBox_2.Text = origin_dstIP[1]; fwcd.srcStarttextBox_3.Text = origin_dstIP[2]; fwcd.srcStarttextBox_4.Text = origin_dstIP[3]; fwcd.dstStarttextBox_1.Text = map_IP[0]; fwcd.dstStarttextBox_2.Text = map_IP[1]; fwcd.dstStarttextBox_3.Text = map_IP[2]; fwcd.dstStarttextBox_4.Text = map_IP[3]; fwcd.orig_dportBox.Text = (DNATdataGrid.SelectedItem as DNATRuleDataTable).origin_dport.ToString(); fwcd.nat_dportBox.Text = (DNATdataGrid.SelectedItem as DNATRuleDataTable).map_port.ToString(); StaticGlobal.selectedindex = StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getDNATRule_list().IndexOf(DNATdataGrid.SelectedItem as DNATRuleDataTable); StaticGlobal.editflag = true; this.Close(); fwcd.ShowDialog(); } if (NATComboBox.SelectedItem.ToString() == "SNAT") { fwcd.NATComboBox.Text = "SNAT"; string[] origin_devIP = (SNATdataGrid.SelectedItem as SNATRuleDataTable).origin_devIP.ToString().Split('.'); string[] EthIP = (SNATdataGrid.SelectedItem as SNATRuleDataTable).EthIP.ToString().Split('.'); //string[] NATIP = (SNATdataGrid.SelectedItem as SNATRuleDataTable).NATIP.ToString().Split('.'); fwcd.ETHComboBox.Text = (SNATdataGrid.SelectedItem as SNATRuleDataTable).EthName.ToString(); fwcd.srcStarttextBox_1.Text = origin_devIP[0]; fwcd.srcStarttextBox_2.Text = origin_devIP[1]; fwcd.srcStarttextBox_3.Text = origin_devIP[2]; fwcd.srcStarttextBox_4.Text = origin_devIP[3]; fwcd.dstStarttextBox_1.Text = EthIP[0]; fwcd.dstStarttextBox_2.Text = EthIP[1]; fwcd.dstStarttextBox_3.Text = EthIP[2]; fwcd.dstStarttextBox_4.Text = EthIP[3]; StaticGlobal.selectedindex = StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getSNATRule_list().IndexOf(SNATdataGrid.SelectedItem as SNATRuleDataTable); StaticGlobal.editflag = true; this.Close(); fwcd.ShowDialog(); } }