本文整理汇总了C#中BindingList.All方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.All方法的具体用法?C# BindingList.All怎么用?C# BindingList.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.All方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FreeCellGame
//.........这里部分代码省略.........
//this.MyStatus.Container.Hide();
// add autoscroll ?
this.MyDeck.SizeTo(DefaultWidth, DefaultHeight);
this.MyDeck.AttachContainerTo(this);
this.MyDeck.GetRank = e => (int)RankMapping[e];
System.Console.WriteLine("--- freecell ---");
System.Console.WriteLine("adding card infos... ");
MyDeck.UnusedCards.AddRange(CardInfo.FullDeck());
this.MyStatus.CardsLeft = MyDeck.UnusedCards.Count;
this.MyStatus.Score = -1;
this.MyStatus.Update();
System.Console.WriteLine("creating stacklists... ");
PlayStacks = MyDeck.CreateStackList();
PlayStacks.ForEachNewItem(
k =>
{
k.CardMargin = new Vector { Y = 20 };
k.Update();
}
);
TempStacks = MyDeck.CreateStackList();
Func<bool> Rule_WinConditionMet =
delegate
{
if (PlayStacks.All(s => s.Cards.Count > 0))
return false;
if (TempStacks.All(s => s.Cards.Count == 0))
return false;
return true;
};
Action MyStatus_UpdateCardsLeft =
delegate
{
MyStatus.CardsLeft = 0;
PlayStacks.ForEach(q => MyStatus.CardsLeft += q.Cards.Count);
TempStacks.ForEach(q => MyStatus.CardsLeft += q.Cards.Count);
};
GoalStacks = MyDeck.CreateStackList();
GoalStacks.ForEachNewItem(
k =>
{
k.CardMargin.Y = 0;
k.Cards.ForEachNewItem(
card =>
{
Console.WriteLine("GoalStacks ForEachNewItem " + new { k.CardMargin.Y });
if (card.Info.Rank == CardInfo.RankEnum.RankKing)
{
示例2: SolitaireGame
//.........这里部分代码省略.........
System.Console.WriteLine("creating goalstack... ");
var Margin = (DefaultWidth - CardInfo.Width * 7) / 8;
var ReserveStack = new CardStack().MoveTo(Margin, Margin);
var UsedChoiceStack = new CardStack().MoveTo(Margin + CardInfo.Width + Margin, Margin);
var ChoiceStack = new CardStack().MoveTo(Margin + CardInfo.Width + Margin, Margin);
TempStacks.AddRange(
ReserveStack,
UsedChoiceStack,
ChoiceStack
);
ReserveStack.CardMargin.X = 0;
ReserveStack.CardMargin.Y = 0;
UsedChoiceStack.CardMargin.X = 0;
UsedChoiceStack.CardMargin.Y = 0;
ChoiceStack.CardMargin.X = 20;
ChoiceStack.CardMargin.Y = 0;
#region rules
Func<bool> Rule_WinConditionMet =
delegate
{
if (PlayStacks.All(s => s.Cards.Count > 0))
return false;
if (TempStacks.All(s => s.Cards.Count == 0))
return false;
return true;
};
Func<Card, Card, bool> RuleForStackingCardsInGoalStack =
(Previous, Current) =>
{
if (Cheat)
return true;
if (Previous == null)
return Current.Info.Rank == CardInfo.RankEnum.RankAce;
if (Previous.Info.Suit != Current.Info.Suit)
return false;
if (Previous.Rank != Current.Rank + 1)
return false;
return true;
};
Func<Card, Card, bool> RuleForStackingCardsInPlayStack =
(Previous, Current) =>
{
if (Cheat)
return true;