private void Yes_Click(object sender, RoutedEventArgs e) { if (IPStarttextBox_1.Text != "" && IPStarttextBox_2.Text != "" && IPStarttextBox_3.Text != "" && IPStarttextBox_4.Text != "") { string resetIP = IPStarttextBox_1.Text + '.' + IPStarttextBox_2.Text + '.' + IPStarttextBox_3.Text + '.' + IPStarttextBox_4.Text; StaticGlobal.FwMACandIP[StaticGlobal.firewallmac] = resetIP; IResetIP res = new ResetIP(); for (int i = 0; i < StaticGlobal.fwdev_list.Count(); i++) { if (StaticGlobal.fwdev_list[i].getDev_MAC() == StaticGlobal.firewallmac) { if (res.ResetIP(StaticGlobal.fwdev_list[i].getProtecDev_list()[0], resetIP)) { UserMessageBox.Show("提示", "IP重设成功"); StaticGlobal.FwMACandIP[StaticGlobal.firewallmac] = resetIP; } else { UserMessageBox.Show("提示", "无IP模式配置失败!"); } } } this.Close(); ConfigFW update = new ConfigFW(); update.FWIP.Text = StaticGlobal.FwMACandIP[StaticGlobal.firewallmac]; //update.FWIP.AppendText(StaticGlobal.FwMACandIP[StaticGlobal.firewallmac]); } else { UserMessageBox.Show("提示", "请输入正确的IP地址"); } }
//双击事件 private void DoubleClick(object sender, MouseButtonEventArgs e) { bool add_flag = true; var selectedItem = VisualUpwardSearch <TreeViewItem>(e.OriginalSource as DependencyObject) as TreeViewItem; if (selectedItem != null && selectedItem.Header.ToString().Contains("防火墙")) { e.Handled = true; currentselectedItem = selectedItem; StaticGlobal.firewallmac = currentselectedItem.Header.ToString().Replace("防火墙 MAC: ", ""); TabItem FWMAC = new TabItem(); foreach (TabItem item in FirsttabControl.Items) { if (FirsttabControl.Items.Count > 1) { if (item.Header.ToString() != "网络拓扑") { item.Visibility = Visibility.Collapsed; } } if (item.Header.ToString() == StaticGlobal.firewallmac) { add_flag = false; if (item.Visibility == Visibility.Collapsed) { item.Visibility = Visibility.Visible; } } } if (add_flag) { FWMAC.Header = StaticGlobal.firewallmac; ConfigFW fw = new ConfigFW(); FWMAC.Content = fw; FirsttabControl.Items.Add(FWMAC); //FirsttabControl.SelectedItem = FWMAC; DB_DataGridbinding fwbind = new DB_DataGridbinding(); fwbind.SNATDB_Gridbinding(); fwbind.DNATDB_Gridbinding(); fwbind.WHLDB_Gridbinding(); fwbind.PropertyBind(); fwbind.DPIDB_Gridbinding(); fwbind.APCDB_Gridbinding(); fwbind.CNCDB_Gridbinding(); fwbind.PRTDB_Gridbinding(); fwbind.STDDB_Gridbinding(); selectedItem.Focus(); } } }