void _Supply_PileChanged(object sender, DominionBase.Piles.PileChangedEventArgs e) { if (this.Dispatcher.CheckAccess()) { DominionBase.Piles.Supply supply = sender as DominionBase.Piles.Supply; if ((wMain.Settings.DisplaySupplyPileNames && supply.Location == DominionBase.Cards.Location.Kingdom) || (wMain.Settings.DisplayBasicSupplyPileNames && supply.Location == DominionBase.Cards.Location.General)) { lName.Visibility = System.Windows.Visibility.Visible; tbName.Text = supply.Randomizer.Name; lName.Background = Caching.BrushRepository.GetBackgroundBrush(supply.Randomizer.Category); lName.Foreground = Caching.BrushRepository.GetForegroundBrush(supply.Randomizer.Category); if ((supply.Randomizer.Category & DominionBase.Cards.Category.Reaction) == DominionBase.Cards.Category.Reaction) { tbName.Effect = Caching.DropShadowRepository.GetDSE(8, Colors.White, 1d); } } else { lName.Visibility = System.Windows.Visibility.Collapsed; tbName.Text = String.Empty; } Caching.ImageRepository repo = Caching.ImageRepository.Acquire(); if (supply.TopCard != null) { imCardIcon.Source = repo.GetBitmapImage(supply.TopCard.Name.Replace(" ", "").Replace("'", ""), "small"); ttcCard.ICard = supply.TopCard; } else { imCardIcon.Source = repo.GetBitmapImage(supply.Name.Replace(" ", "").Replace("'", ""), "small"); ttcCard.ICard = supply.Randomizer; } Caching.ImageRepository.Release(); this.InvalidateVisual(); } else { this.Dispatcher.BeginInvoke(new EventHandler <DominionBase.Piles.PileChangedEventArgs>(_Supply_PileChanged), System.Windows.Threading.DispatcherPriority.Normal, sender, e); } }
private void SupplyControl_SupplyClick(object sender, RoutedEventArgs e) { DominionBase.Piles.Supply supply = (e.Source as SupplyControl).Supply; bOK.IsEnabled = false; this.ChoiceResult = new DominionBase.ChoiceResult(supply); if (this.ChoiceResult != null) { bOK.IsEnabled = true; } if (bOK.IsEnabled && this.ChoiceResult.Supply != null && cbAutoClick.IsChecked == true) { bOK_Click(bOK, null); } }