Esempio n. 1
0
        /*策略路由PRT选项卡*/
        private void NewPRT_Click(object sender, RoutedEventArgs e)
        {
            StaticGlobal.editflag = false;
            PRTConfigurationDetail fwcd = new PRTConfigurationDetail();

            fwcd.ShowDialog();
        }
Esempio n. 2
0
        private void PRTeditclick(object sender, MouseButtonEventArgs e)
        {
            string[] gate = (PRTdataGrid.SelectedItem as PRTRuleDataTable).Gateway.ToString().Split('.');

            PRTConfigurationDetail fw = new PRTConfigurationDetail();

            switch ((PRTdataGrid.SelectedItem as PRTRuleDataTable).route_type.ToString())
            {
            case "默认路由":
                fw.NetInterface.Visibility         = Visibility.Visible;
                fw.GateIP.Visibility               = Visibility.Visible;
                fw.ETHComboBox.Visibility          = Visibility.Visible;
                fw.destIP.Visibility               = Visibility.Collapsed;
                fw.Mask.Visibility                 = Visibility.Collapsed;
                fw.GateStarttextBox_1.Text         = ""; fw.GateStarttextBox_2.Text = ""; fw.GateStarttextBox_3.Text = ""; fw.GateStarttextBox_4.Text = "";
                fw.destIPStarttextBox_1.Visibility = Visibility.Collapsed; fw.destIPStarttextBox_2.Visibility = Visibility.Collapsed;
                fw.destIPStarttextBox_3.Visibility = Visibility.Collapsed; fw.destIPStarttextBox_4.Visibility = Visibility.Collapsed;
                fw.destsep1.Visibility             = Visibility.Collapsed; fw.destsep2.Visibility = Visibility.Collapsed; fw.destsep3.Visibility = Visibility.Collapsed;
                fw.MaskStarttextBox_1.Visibility   = Visibility.Collapsed; fw.MaskStarttextBox_2.Visibility = Visibility.Collapsed;
                fw.MaskStarttextBox_3.Visibility   = Visibility.Collapsed; fw.MaskStarttextBox_4.Visibility = Visibility.Collapsed;
                fw.Masksep1.Visibility             = Visibility.Collapsed; fw.Masksep2.Visibility = Visibility.Collapsed; fw.Masksep3.Visibility = Visibility.Collapsed;
                break;

            case "主机路由":
                string[] host = (PRTdataGrid.SelectedItem as PRTRuleDataTable).host_IP.ToString().Split('.');
                fw.NetInterface.Visibility         = Visibility.Visible;
                fw.GateIP.Visibility               = Visibility.Visible;
                fw.ETHComboBox.Visibility          = Visibility.Visible;
                fw.destIP.Visibility               = Visibility.Visible;
                fw.Mask.Visibility                 = Visibility.Collapsed;
                fw.GateStarttextBox_1.Text         = ""; fw.GateStarttextBox_2.Text = ""; fw.GateStarttextBox_3.Text = ""; fw.GateStarttextBox_4.Text = "";
                fw.destIPStarttextBox_1.Text       = ""; fw.destIPStarttextBox_2.Text = ""; fw.destIPStarttextBox_3.Text = ""; fw.destIPStarttextBox_4.Text = "";
                fw.destIPStarttextBox_1.Visibility = Visibility.Visible; fw.destIPStarttextBox_2.Visibility = Visibility.Visible;
                fw.destIPStarttextBox_3.Visibility = Visibility.Visible; fw.destIPStarttextBox_4.Visibility = Visibility.Visible;
                fw.destsep1.Visibility             = Visibility.Visible; fw.destsep2.Visibility = Visibility.Visible; fw.destsep3.Visibility = Visibility.Visible;
                fw.MaskStarttextBox_1.Visibility   = Visibility.Collapsed; fw.MaskStarttextBox_2.Visibility = Visibility.Collapsed;
                fw.MaskStarttextBox_3.Visibility   = Visibility.Collapsed; fw.MaskStarttextBox_4.Visibility = Visibility.Collapsed;
                fw.Masksep1.Visibility             = Visibility.Collapsed; fw.Masksep2.Visibility = Visibility.Collapsed;
                fw.Masksep3.Visibility             = Visibility.Collapsed;
                if (host[0] != "")
                {
                    fw.destIPStarttextBox_1.Text = host[0];
                    fw.destIPStarttextBox_2.Text = host[1];
                    fw.destIPStarttextBox_3.Text = host[2];
                    fw.destIPStarttextBox_4.Text = host[3];
                }
                break;

            case "网络路由":
                string[] dst  = (PRTdataGrid.SelectedItem as PRTRuleDataTable).dstIP.ToString().Split('.');
                string[] mask = (PRTdataGrid.SelectedItem as PRTRuleDataTable).netmask.ToString().Split('.');
                fw.NetInterface.Visibility         = Visibility.Visible;
                fw.GateIP.Visibility               = Visibility.Visible;
                fw.ETHComboBox.Visibility          = Visibility.Visible;
                fw.destIP.Visibility               = Visibility.Visible;
                fw.destIP.Content                  = "网络主机IP :";
                fw.Mask.Visibility                 = Visibility.Visible;
                fw.GateStarttextBox_1.Text         = ""; fw.GateStarttextBox_2.Text = ""; fw.GateStarttextBox_3.Text = ""; fw.GateStarttextBox_4.Text = "";
                fw.GateStarttextBox_1.Visibility   = Visibility.Visible; fw.GateStarttextBox_2.Visibility = Visibility.Visible;
                fw.GateStarttextBox_3.Visibility   = Visibility.Visible; fw.GateStarttextBox_4.Visibility = Visibility.Visible;
                fw.Gatesep1.Visibility             = Visibility.Visible; fw.Gatesep2.Visibility = Visibility.Visible; fw.Gatesep3.Visibility = Visibility.Visible; fw.Gatesep1.Visibility = Visibility.Visible;
                fw.destIPStarttextBox_1.Text       = ""; fw.destIPStarttextBox_2.Text = ""; fw.destIPStarttextBox_3.Text = ""; fw.destIPStarttextBox_4.Text = "";
                fw.destIPStarttextBox_1.Visibility = Visibility.Visible; fw.destIPStarttextBox_2.Visibility = Visibility.Visible;
                fw.destIPStarttextBox_3.Visibility = Visibility.Visible; fw.destIPStarttextBox_4.Visibility = Visibility.Visible;
                fw.destsep1.Visibility             = Visibility.Visible; fw.destsep2.Visibility = Visibility.Visible; fw.destsep3.Visibility = Visibility.Visible;
                fw.MaskStarttextBox_1.Text         = ""; fw.MaskStarttextBox_2.Text = ""; fw.MaskStarttextBox_3.Text = ""; fw.MaskStarttextBox_4.Text = "";
                fw.MaskStarttextBox_1.Visibility   = Visibility.Visible; fw.MaskStarttextBox_2.Visibility = Visibility.Visible;
                fw.MaskStarttextBox_3.Visibility   = Visibility.Visible; fw.MaskStarttextBox_4.Visibility = Visibility.Visible;
                fw.Masksep1.Visibility             = Visibility.Visible; fw.Masksep2.Visibility = Visibility.Visible; fw.Masksep3.Visibility = Visibility.Visible;
                if (dst[0] != "")
                {
                    fw.destIPStarttextBox_1.Text = dst[0];
                    fw.destIPStarttextBox_2.Text = dst[1];
                    fw.destIPStarttextBox_3.Text = dst[2];
                    fw.destIPStarttextBox_4.Text = dst[3];
                }
                if (mask[0] != "")
                {
                    fw.MaskStarttextBox_1.Text = mask[0];
                    fw.MaskStarttextBox_2.Text = mask[1];
                    fw.MaskStarttextBox_3.Text = mask[2];
                    fw.MaskStarttextBox_4.Text = mask[3];
                }
                break;
            }
            if (gate[0] != "")
            {
                fw.GateStarttextBox_1.Text = gate[0];
                fw.GateStarttextBox_2.Text = gate[1];
                fw.GateStarttextBox_3.Text = gate[2];
                fw.GateStarttextBox_4.Text = gate[3];
            }
            fw.ETHComboBox.Text        = (PRTdataGrid.SelectedItem as PRTRuleDataTable).ETH.ToString();
            fw.logcheckBox.IsChecked   = (PRTdataGrid.SelectedItem as PRTRuleDataTable).log;
            StaticGlobal.selectedindex = StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getFireWallPRTRule_list().IndexOf(PRTdataGrid.SelectedItem as PRTRuleDataTable);
            StaticGlobal.editflag      = true;
            fw.ShowDialog();
        }