private void CloseDialog([NotNull] object sender, [NotNull] RoutedEventArgs e) { Debug.ArgumentNotNull(e, nameof(e)); Debug.ArgumentNotNull(sender, nameof(sender)); if (!string.IsNullOrEmpty(ListBox.LocationTextBox.Text)) { ListBox.AddLocation(); } ListBox.Save(); this.Close(true); }