private void Image_PrivateCard2_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Card chosenCard; if (!ChooseCard.TryShowChooseCardDialog(out chosenCard)) { return; } this.InvokeUIChange(() => this.Image_PrivateCard2.Source = chosenCard.CardImage); }
public static bool TryShowChooseCardDialog(out Card chosenCard) { ChooseCard window = new ChooseCard(); window.InitializeComponent(); window.ShowDialog(); chosenCard = window.SelectedCard; if (window.Canceled) { return(false); } return(chosenCard != null); }