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


C# List.Skip方法代码示例

本文整理汇总了C#中iTextSharp.text.List.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# List.Skip方法的具体用法?C# List.Skip怎么用?C# List.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.text.List的用法示例。


在下文中一共展示了List.Skip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildPDF

        private void BuildPDF(Dictionary<string, ISPage> pageMap, string baseRoom, Dictionary<string, int> chapterPageMap, bool fakeRun)
        {
            if (fakeRun)
            {
                ISPageHtmlParser.BuildAllISPages(pageMap, baseRoom, filePath).Wait();
            }
            //now that we have all the pages, we'll have to clean them up and decide on pages

            Dictionary<string, int> ISPageToPhysicalPageMap = new Dictionary<string, int>();

            int currentPage = 1;
            int currentChapter = 1;
            Random r = new Random(123456);
            List<string> pagesLeft = new List<string>(pageMap.Count);
            foreach (string x in pageMap.Keys)
            {
                pagesLeft.Add(x);
            }

            using (MemoryStream memStream = new MemoryStream())
            {
                Document pdfDoc = new Document();
                iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(pdfDoc, memStream);
                HeaderFooter evnt = new HeaderFooter();
                if (fakeRun)
                {
                    evnt.pageByTitle = chapterPageMap;
                }
                else
                {
                    evnt.pageByTitle = new Dictionary<string, int>();
                }
                if (!fakeRun)
                {
                    writer.PageEvent = evnt;
                }

                pdfDoc.Open();
                pdfDoc.AddAuthor("test");
                pdfDoc.AddTitle("testTitle");

                while (pagesLeft.Any())
                {

                    string pageToAdd = pagesLeft.First();
                    if (currentPage > 1)
                    {
                        pagesLeft.Skip(r.Next(pagesLeft.Count)).First();
                    }
                    pagesLeft.Remove(pageToAdd);

                    if (fakeRun)
                    {
                        chapterPageMap.Add(pageToAdd, writer.PageNumber + 1);
                    }

                    ISPageToPhysicalPageMap.Add(pageToAdd, currentPage);

                    var chapter = GetPDFPage(pageMap[pageToAdd], int.Parse(pageToAdd), chapterPageMap);
                    pdfDoc.Add(chapter);

                    int actualPageLength = fakeRun ? 1 : chapterPageMap[pageToAdd];

                    currentPage += actualPageLength;
                    currentChapter++;
                }

                pdfDoc.Close();
                writer.Close();

                if (!fakeRun)
                {
                    File.WriteAllBytes(Path.Combine(filePath, fileName), memStream.GetBuffer());
                }
            }
        }
开发者ID:aaams,项目名称:infinite-story-download,代码行数:76,代码来源:PdfWriter.cs

示例2: Draw

        void Draw()
        {
            _interpolatedFieldsList = _krigingSelectionControl.GetSelectedMaps();
            setMapsCount();

            updateProgressbar(0);

            if (_interpolatedFieldsList.Count > 0)
            {
                int columnsCount = 1;
                int width = 90;

                if (_mapsCount == 2)
                {
                    columnsCount = 1;
                    width = 45;
                }
                else if (_mapsCount == 4)
                {
                    columnsCount = 2;
                    width = 90;
                }

                _tblKrigingMapImage = new PdfPTable(columnsCount);

                _tblKrigingMapImage.DefaultCell.Padding = 0;
                _tblKrigingMapImage.DefaultCell.Border = 0;
                _tblKrigingMapImage.TotalWidth = _document.PageSize.Width;
                _tblKrigingMapImage.WidthPercentage = width;

                double pages = Math.Ceiling((double)_interpolatedFieldsList.Count / _mapsCount);

                int addedItems = 0;

                for (int p = 0; p < pages; p++)
                {
                    _document.NewPage();

                    addedItems = 0;

                    foreach (var item in _interpolatedFieldsList.Skip(_mapsCount * p).Take(_mapsCount))
                    {
                        clearPanelControl();

                        if (!string.IsNullOrEmpty(item.Image) && !string.IsNullOrEmpty(item.ColorsCategories))
                        {
                            var colorsList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Repository.Utils.LegendPattern>>(item.ColorsCategories);

                            if (_mapsCount == 1)
                            {
                                var ctrl = new MainApp.Controls.KrigingViewerControl(colorsList, item);
                                addControlViewPanel(ctrl);
                            }
                            else
                            {
                                var ctrl = new MainApp.Controls.KrigingViewerSmallControl(colorsList, item);
                                addControlViewPanel(ctrl);
                                addedItems++;
                            }
                        }
                        else
                        {
                            _backgroundWorker.ReportProgress(_progressBar.Value + 1);
                        }
                    }

                    if (_mapsCount - addedItems > 0)
                    {
                        for (int i = 1; i <= (_mapsCount - addedItems); i++)
                        {
                            _tblKrigingMapImage.AddCell("");
                        }
                    }
                }

            }
            else
            {
                _backgroundWorker.ReportProgress(0);
            }

        }
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:82,代码来源:GenerateReportStatusForm.cs


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