コード例 #1
0
        private void generateBatnBowlers()
        {
            Bowler         bowler        = new Bowler();
            Batsmen        batsmen       = new Batsmen();
            Innings        firstInnings  = new Innings();
            Innings        secondInnings = new Innings();
            List <Bowler>  bowlerList    = new List <Bowler>();
            List <Batsmen> batsmens      = new List <Batsmen>();
            var            batList       = new ObservableCollection <Batsmen>();
            var            bowlList      = new ObservableCollection <Bowler>();

            for (int i = 0; i < 5; i++)
            {
                bowler = new Bowler
                {
                    matchId    = 1,
                    bowlerName = "Bumrah",
                    overs      = 10,
                    runs       = 60,
                    economy    = 6
                };
                bowlList.Add(bowler);
            }

            for (int i = 0; i < 10; i++)
            {
                batsmen = new Batsmen
                {
                    matchId     = 1,
                    batsmenName = "MS Doni",
                    balls       = 14,
                    runs        = 27,
                    fours       = 3,
                    sixes       = 1,
                    strikeRate  = 197.65,
                    outInfo     = "Caught by abcdefgh"
                };
                batList.Add(batsmen);
            }
            TestStorage.WriteXml <ObservableCollection <Batsmen> >(batList, "Batsmen.xml");
            TestStorage.WriteXml <ObservableCollection <Bowler> >(bowlList, "Bowlers.xml");
        }
コード例 #2
0
        private void generateScoreCard(int cnt)
        {
            Scorecard      scoreCard     = new Scorecard();
            Bowler         bowler        = new Bowler();
            Batsmen        batsmen       = new Batsmen();
            Innings        firstInnings  = new Innings();
            Innings        secondInnings = new Innings();
            List <Bowler>  bowlerList    = new List <Bowler>();
            List <Batsmen> batsmens      = new List <Batsmen>();
            var            scoreList     = new ObservableCollection <Scorecard>();

            for (int i = 0; i < 10; i++)
            {
                batsmen = new Batsmen
                {
                    matchId     = 1,
                    batsmenName = "MS Doni",
                    balls       = 14,
                    runs        = 27,
                    fours       = 3,
                    sixes       = 1,
                    strikeRate  = 197.65,
                    outInfo     = "Caught by abcdefgh"
                };

                batsmens.Add(batsmen);
            }

            for (int i = 0; i < 5; i++)
            {
                bowler = new Bowler
                {
                    matchId    = 1,
                    bowlerName = "Bumrah",
                    overs      = 10,
                    runs       = 60,
                    economy    = 6
                };
                bowlerList.Add(bowler);
            }
            firstInnings = new Innings
            {
                batsmenList = batsmens,
                bowlerList  = bowlerList
            };
            secondInnings = new Innings
            {
                batsmenList = batsmens,
                bowlerList  = bowlerList
            };

            for (int j = 0; j < cnt; j++)
            {
                scoreCard = new Scorecard
                {
                    matchId       = j,
                    matchName     = "TeamA VS TeamB",
                    firstInnings  = firstInnings,
                    secondInnings = secondInnings
                };
                scoreList.Add(scoreCard);
            }
            TestStorage.WriteXml <ObservableCollection <Scorecard> >(scoreList, "ScoreCard.xml");
        }