当前位置: 首页>>代码示例>>C#>>正文


C# BindingList.All方法代码示例

本文整理汇总了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)
                            {
开发者ID:dcarter16,项目名称:avaloncardgames,代码行数:67,代码来源:FreeCellGame.cs

示例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;
开发者ID:dcarter16,项目名称:avaloncardgames,代码行数:66,代码来源:SolitaireGame.cs


注:本文中的BindingList.All方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。