示例#1
0
        public Sheet(IList <Kana> kanas, int pages, int questionsOnARow, SheetType type = SheetType.Kana, bool includePageNumbers = true, bool includeAnswerSheets = false)
        {
            kanas = kanas.Where(x => x.Group != KanaGroup.Empty).ToList();
            Pages = new List <SheetPage>();
            var  sheetType = type;
            bool evenRow   = false;

            for (var pageCount = 1; pageCount <= pages; pageCount++)
            {
                var page = new SheetPage();
                page.PageNumber = pageCount;
                for (var rowCount = 1; rowCount <= 8; rowCount++)
                {
                    if (type == SheetType.Alternate && evenRow)
                    {
                        sheetType = SheetType.Kana;
                    }
                    if (type == SheetType.Alternate && !evenRow)
                    {
                        sheetType = SheetType.Romaji;
                    }

                    page.Rows.Add(new KanaRow(kanas.RandomItems(questionsOnARow), sheetType));
                    evenRow = !evenRow;
                }
                Pages.Add(page);
            }

            Type                = type;
            QuestionOnARow      = questionsOnARow;
            IncludePageNumbers  = includePageNumbers;
            IncludeAnswerSheets = includeAnswerSheets;
        }
示例#2
0
文件: Sheet.cs 项目: rlucassen/kana
        public Sheet(IList<Kana> kanas, int pages, int questionsOnARow, SheetType type = SheetType.Kana, bool includePageNumbers = true, bool includeAnswerSheets = false)
        {
            kanas = kanas.Where(x => x.Group != KanaGroup.Empty).ToList();
            Pages = new List<SheetPage>();
            var sheetType = type;
            bool evenRow = false;
            for (var pageCount = 1; pageCount <= pages; pageCount++)
            {
                var page = new SheetPage();
                page.PageNumber = pageCount;
                for (var rowCount = 1; rowCount <= 8; rowCount++)
                {
                    if(type == SheetType.Alternate && evenRow)
                        sheetType = SheetType.Kana;
                    if(type == SheetType.Alternate && !evenRow)
                        sheetType = SheetType.Romaji;

                    page.Rows.Add(new KanaRow(kanas.RandomItems(questionsOnARow), sheetType));
                    evenRow = !evenRow;
                }
                Pages.Add(page);
            }

            Type = type;
            QuestionOnARow = questionsOnARow;
            IncludePageNumbers = includePageNumbers;
            IncludeAnswerSheets = includeAnswerSheets;
        }