private void CardCollectionControl_CardCollectionControlClick(object sender, RoutedEventArgs e)
		{
			Controls.CardStackControl csc = e.OriginalSource as Controls.CardStackControl;
			if (game == null || game.ActivePlayer == null || csc == null)
				return;

			if ((game.ActivePlayer.Phase == DominionBase.Players.PhaseEnum.Action &&
				((csc.ClickedCard.Category & DominionBase.Cards.Category.Action) == DominionBase.Cards.Category.Action ||
				(csc.ClickedCard.Category & DominionBase.Cards.Category.Treasure) == DominionBase.Cards.Category.Treasure)) ||
				((game.ActivePlayer.Phase == DominionBase.Players.PhaseEnum.ActionTreasure || game.ActivePlayer.Phase == DominionBase.Players.PhaseEnum.BuyTreasure) &&
				(csc.ClickedCard.Category & DominionBase.Cards.Category.Treasure) == DominionBase.Cards.Category.Treasure))
			{
				if (_Settings.PromptUnplayedActions &&
					game.ActivePlayer.Phase == DominionBase.Players.PhaseEnum.Action &&
					game.ActivePlayer.Hand[DominionBase.Cards.Category.Action].Count > 0 &&
					game.ActivePlayer.Actions > 0 &&
					((csc.ClickedCard.Category & DominionBase.Cards.Category.Action) != DominionBase.Cards.Category.Action))
				{
					if (wMessageBox.Show("You have unplayed actions left.  Are you sure you want to do this?", "Please confirm", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
						return;
				}

				WaitCallback wcb = new WaitCallback(UpdateDisplayTarget);
				DominionBase.GamePlayMessage gpm = new DominionBase.GamePlayMessage(wcb, game.ActivePlayer, csc.ClickedCard);
				gpm.Message = String.Format("{0} playing {1}", game.ActivePlayer, csc.ClickedCard);
				EnqueueGameMessageAndWait(gpm);
			}
		}
		private void AutoPlayTreasures()
		{
			WaitCallback wcb = new WaitCallback(UpdateDisplayTarget);
			DominionBase.GamePlayMessage gpm = null;

			// Always play Contraband first
			DominionBase.Cards.CardCollection contrabandTreasures = _Player.Hand[DominionBase.Cards.Prosperity.TypeClass.Contraband];
			foreach (DominionBase.Cards.Card card in contrabandTreasures)
			{
				if (_Player.Phase != DominionBase.Players.PhaseEnum.ActionTreasure && _Player.Phase != DominionBase.Players.PhaseEnum.BuyTreasure)
					break;

				while (game.MessageResponseQueue.Count > 0)
					game.MessageResponseQueue.Dequeue();

				gpm = new DominionBase.GamePlayMessage(wcb, _Player, card);
				gpm.Message = String.Format("{0} playing {1}", _Player, card);
				EnqueueGameMessageAndWait(gpm);
			}

			// Play "normal" Treasure cards next
			DominionBase.Cards.CardCollection tNormal = _Player.Hand[c =>
				(c.Category & DominionBase.Cards.Category.Treasure) == DominionBase.Cards.Category.Treasure &&
				c.CardType != DominionBase.Cards.Prosperity.TypeClass.Bank &&
				c.CardType != DominionBase.Cards.Prosperity.TypeClass.Contraband &&
				c.CardType != DominionBase.Cards.Prosperity.TypeClass.Loan &&
				c.CardType != DominionBase.Cards.Prosperity.TypeClass.Venture &&
				c.CardType != DominionBase.Cards.Cornucopia.TypeClass.HornOfPlenty];
			if (tNormal.Count > 0)
				_Player.PlayCards(tNormal);

			// Only play Loan & Venture after cards like Philosopher's Stone that work better with more cards
			// There are some very specific situations where playing Horn Of Plenty before Philospher's Stone
			// or Venture is the right way to play things, but that's so incredibly rare.
			DominionBase.Cards.CardCollection tLoanVenture = _Player.Hand[DominionBase.Cards.Prosperity.TypeClass.Venture];
			if (_Settings.AutoPlayTreasures_IncludingLoan)
			{
				if (_Settings.AutoPlayTreasures_LoanFirst)
					tLoanVenture.InsertRange(0, _Player.Hand[DominionBase.Cards.Prosperity.TypeClass.Loan]);
				else
					tLoanVenture.AddRange(_Player.Hand[DominionBase.Cards.Prosperity.TypeClass.Loan]);
			}

			foreach (DominionBase.Cards.Card card in tLoanVenture)
			{
				if (_Player.Phase != DominionBase.Players.PhaseEnum.ActionTreasure && _Player.Phase != DominionBase.Players.PhaseEnum.BuyTreasure)
					break;

				gpm = new DominionBase.GamePlayMessage(wcb, _Player, card);
				gpm.Message = String.Format("{0} playing {1}", _Player, card);
				EnqueueGameMessageAndWait(gpm);
				return;
			}

			// Always play Bank & Horn of Plenty last
			DominionBase.Cards.CardCollection tBankHornofPlenty = _Player.Hand[DominionBase.Cards.Prosperity.TypeClass.Bank];
			if (_Settings.AutoPlayTreasures_IncludingHornOfPlenty)
			{
				// If Horn Of Plenty is to be played first, play ALL Horn Of Plenty cards first
				if (_Settings.AutoPlayTreasures_HornOfPlentyFirst)
					tBankHornofPlenty.InsertRange(0, _Player.Hand[DominionBase.Cards.Cornucopia.TypeClass.HornOfPlenty]);
				// Otherwise, play a SINGLE Bank card, then ALL Horn of Plenty cards, then all remaining Bank cards
				else
					tBankHornofPlenty.InsertRange(tBankHornofPlenty.Count == 0 ? 0 : 1, _Player.Hand[DominionBase.Cards.Cornucopia.TypeClass.HornOfPlenty]);
			}
			foreach (DominionBase.Cards.Card card in tBankHornofPlenty)
			{
				if (_Player.Phase != DominionBase.Players.PhaseEnum.ActionTreasure && _Player.Phase != DominionBase.Players.PhaseEnum.BuyTreasure)
					break;

				gpm = new DominionBase.GamePlayMessage(wcb, _Player, card);
				gpm.Message = String.Format("{0} playing {1}", _Player, card);
				EnqueueGameMessageAndWait(gpm);
			}
		}