本文整理汇总了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());
}
}
}
示例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);
}
}