protected override bool ApplyChanges() { if (!CanApplyChanges) { ShowMessage("The data in the page is invalid. Correct the data and try again."); return(false); } var filter = GetFilter(cbMatch); Rule.Name = txtName.Text; Rule.PreCondition = cbPreCondition.Text == "<None>" ? string.Empty : cbPreCondition.Text; Rule.CustomTags = cbTags.Text; Rule.Enabled = true; Rule.Syntax = cbUsing.SelectedIndex; Rule.Stopping = cbStop.Checked; Rule.Filter = filter; Rule.ServerVariable = txtVariable.Text; Rule.Pattern = txtPattern.Text; Rule.Negate = cbContent.SelectedIndex == 1; Rule.IgnoreCase = cbIgnoreCase.Checked; Rule.TrackAllCaptures = cbTrack.Checked; Rule.LogicalGrouping = cbAny.SelectedIndex; Rule.Action = cbAction.SelectedIndex; Rule.Value = txtValue.Text; Rule.Replace = !string.IsNullOrWhiteSpace(txtValue.Text); Rule.Conditions.Clear(); foreach (ConditionListViewItem item in lvConditions.Items) { Rule.Conditions.Add(item.Item); } if (txtName.ReadOnly) { _feature.EditItem(Rule); } else { txtName.ReadOnly = true; _feature.AddItem(Rule); } if (!Rule.ApplyChanges()) { return(false); } ClearChanges(); return(true); }
protected override bool ApplyChanges() { var filter = GetFilter(cbMatch); if (Rule == null) { Rule = new OutboundRule(null); } Rule.Name = txtName.Text; Rule.PreCondition = cbPreCondition.Text == "<None>" ? string.Empty : cbPreCondition.Text; Rule.CustomTags = cbTags.Text; Rule.Enabled = true; Rule.Syntax = cbUsing.SelectedIndex; Rule.Stopping = cbStop.Checked; Rule.Filter = filter; Rule.ServerVariable = txtVariable.Text; Rule.Pattern = txtPattern.Text; Rule.Negate = cbContent.SelectedIndex == 1; Rule.IgnoreCase = cbIgnoreCase.Checked; Rule.TrackAllCaptures = cbTrack.Checked; Rule.LogicalGrouping = cbAny.SelectedIndex; Rule.Action = cbAction.SelectedIndex; Rule.Value = txtValue.Text; Rule.Replace = !string.IsNullOrWhiteSpace(txtValue.Text); if (txtName.ReadOnly) { _feature.EditItem(Rule); } else { txtName.ReadOnly = true; _feature.AddItem(Rule); } if (!Rule.ApplyChanges()) { return(false); } ClearChanges(); return(true); }