private void ButtonSave_Click(object sender, EventArgs e) { if (AreParametersValid()) { Filter result = new Filter(textBoxName.Text); if (checkBoxTextContains.Checked) { result.TextContains = textBoxShiftText.Text; } if (checkBoxNoteContains.Checked) { result.NoteContains = textBoxShiftNote.Text; } if (checkBoxColor.Checked) { result.Color = panelColor.BackColor; } result.InvertFilter = checkBoxInvertFilter.Checked; FilterResult?.Invoke(result); this.Close(); } }