Пример #1
0
        /*DPI选项卡*/
        private void AddRulebutton_Click(object sender, RoutedEventArgs e)
        {
            StaticGlobal.editflag = false;
            FireWallConfigurationDetail fwcd = new FireWallConfigurationDetail();

            fwcd.ShowDialog();
        }
Пример #2
0
        private void editclick(object sender, MouseButtonEventArgs e)
        {
            string[] source                  = (dataGrid.SelectedItem as FireWallRuleDataTable).source.ToString().Split('.');
            string[] destination             = (dataGrid.SelectedItem as FireWallRuleDataTable).destination.ToString().Split('.');
            FireWallConfigurationDetail fwcd = new FireWallConfigurationDetail();

            fwcd.ProtocolComboBox.Text = (dataGrid.SelectedItem as FireWallRuleDataTable).protocol.ToString();
            if (fwcd.ProtocolComboBox.Text == "ModbusTCP")
            {
                fwcd.CoilAddresslabel.Visibility        = Visibility.Visible;
                fwcd.CoilAddressStarttextBox.Visibility = Visibility.Visible;
                fwcd.ConnectBorder.Visibility           = Visibility.Visible;
                fwcd.CoilAddressEndtextBox.Visibility   = Visibility.Visible;
                fwcd.AbledFunctionCodelabel.Visibility  = Visibility.Visible;
                fwcd.MinDatalabel.Visibility            = Visibility.Visible;
                fwcd.MinDatatextBox.Visibility          = Visibility.Visible;
                fwcd.MaxDatalabel.Visibility            = Visibility.Visible;
                fwcd.MaxDatatextBox.Visibility          = Visibility.Visible;
                fwcd.FunctionCodeComboBox.Visibility    = Visibility.Visible;
                fwcd.CodeNum.Visibility      = Visibility.Visible;
                fwcd.CodeNumLabel.Visibility = Visibility.Visible;
            }
            else
            {
                fwcd.CoilAddresslabel.Visibility        = Visibility.Collapsed;
                fwcd.CoilAddressStarttextBox.Visibility = Visibility.Collapsed;
                fwcd.ConnectBorder.Visibility           = Visibility.Collapsed;
                fwcd.CoilAddressEndtextBox.Visibility   = Visibility.Collapsed;
                fwcd.MinDatalabel.Visibility            = Visibility.Collapsed;
                fwcd.MinDatatextBox.Visibility          = Visibility.Collapsed;
                fwcd.MaxDatalabel.Visibility            = Visibility.Collapsed;
                fwcd.MaxDatatextBox.Visibility          = Visibility.Collapsed;
                fwcd.AbledFunctionCodelabel.Visibility  = Visibility.Collapsed;
                fwcd.FunctionCodeComboBox.Visibility    = Visibility.Collapsed;
                fwcd.CodeNum.Visibility      = Visibility.Collapsed;
                fwcd.CodeNumLabel.Visibility = Visibility.Collapsed;
            }
            if (source[0] != "any")
            {
                fwcd.SourceIPtextBox_1.Text = source[0];
                fwcd.SourceIPtextBox_2.Text = source[1];
                fwcd.SourceIPtextBox_3.Text = source[2];
                fwcd.SourceIPtextBox_4.Text = source[3];
            }
            else
            {
                fwcd.SourceIPtextBox_1.Text = "";
                fwcd.SourceIPtextBox_2.Text = "";
                fwcd.SourceIPtextBox_3.Text = "";
                fwcd.SourceIPtextBox_4.Text = "";
            }
            if (destination[0] != "any")
            {
                fwcd.DestinationIPtextBox_1.Text = destination[0];
                fwcd.DestinationIPtextBox_2.Text = destination[1];
                fwcd.DestinationIPtextBox_3.Text = destination[2];
                fwcd.DestinationIPtextBox_4.Text = destination[3];
            }
            else
            {
                fwcd.DestinationIPtextBox_1.Text = "";
                fwcd.DestinationIPtextBox_2.Text = "";
                fwcd.DestinationIPtextBox_3.Text = "";
                fwcd.DestinationIPtextBox_4.Text = "";
            }

            fwcd.CoilAddressStarttextBox.Text = (dataGrid.SelectedItem as FireWallRuleDataTable).coiladdressstart.ToString();
            fwcd.CoilAddressEndtextBox.Text   = (dataGrid.SelectedItem as FireWallRuleDataTable).coiladdressend.ToString();
            fwcd.MinDatatextBox.Text          = (dataGrid.SelectedItem as FireWallRuleDataTable).mindata.ToString();
            fwcd.MaxDatatextBox.Text          = (dataGrid.SelectedItem as FireWallRuleDataTable).maxdata.ToString();
            fwcd.FunctionCodeComboBox.Text    = (dataGrid.SelectedItem as FireWallRuleDataTable).func.ToString();
            fwcd.logcheckBox.IsChecked        = (dataGrid.SelectedItem as FireWallRuleDataTable).log;
            StaticGlobal.selectedindex        = StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getFireWallRule_list().IndexOf(dataGrid.SelectedItem as FireWallRuleDataTable);
            StaticGlobal.editflag             = true;
            this.Close();
            fwcd.ShowDialog();
        }