private void Save_Click(object sender, RoutedEventArgs e) { if (!String.IsNullOrEmpty(Command.Text) && !String.IsNullOrEmpty(Substitutor_title.Text)) { Snippets.List[index].Command = Command.Text; Snippets.List[index].SubstitutorTitle = Substitutor_title.Text; Snippets.List[index].ExtraArgs = Extra_args.Text; Snippets.Serialize(); Close(); } else if (String.IsNullOrEmpty(Command.Text) && !String.IsNullOrEmpty(Substitutor_title.Text)) { MessageBox.Show("Command cannot be left empty!"); } else if (!String.IsNullOrEmpty(Command.Text) && String.IsNullOrEmpty(Substitutor_title.Text)) { MessageBox.Show("Substitutor Title cannot be left empty!"); } else { MessageBox.Show("Command and Substitutor Title both must be filled!"); } }