private void uiFavouritesAddButton_Click(object sender, RoutedEventArgs e) { AddServerWindow window = new AddServerWindow(); window.Owner = this; try { window.ShowDialog(); } catch (Exception ex) { window.Close(); Common.Message(this, "Add server window error.", ex, MessageWindow.Flags.Error); return; } if (window.AddServer) { favourites.Add(window.ServerAddress); } }