private void ConfirmButton_Click(object sender, RoutedEventArgs e) { string name = NameTextBox.Text; string description = DescriptionTextBox.Text; if (string.IsNullOrWhiteSpace(name)) { NameTextBox.Focus(); return; } if (string.IsNullOrWhiteSpace(description)) { DescriptionTextBox.Focus(); return; } if (!_edit) { Goal goal = new Goal { Name = name, Text = description, Important = _importance, Urgent = _urgency, Completed = false }; _storage.AddGoal(_user, goal); _user.Goals.Add(goal); DialogResult = true; } else { _goal.Name = name; _goal.Text = description; _goal.Important = _importance; _goal.Urgent = _urgency; _storage.EditGoal(_goal); DialogResult = true; } }