public Task <LinkedList <News> > FetchAsync(string projectId, System.IProgress <OperationProgress> progress, CancellationToken cancellationToken) { var url = string.Format(CultureInfo.InvariantCulture, @"projects/{0}/news.xml", projectId); progress?.Report(new OperationProgress(Resources.StrsFetchingNews.AddEllipsis())); return(FetchItemsFromAllPagesAsync(url, cancellationToken)); }
protected override Task <LinkedList <Issue> > FetchDataAsync(System.IProgress <OperationProgress> progress, CancellationToken cancellationToken) { Verify.State.IsFalse(IsDisposed, "IssuesListBinding is disposed."); IssuesListBox.Cursor = Cursors.WaitCursor; return(ServiceContext.Issues.FetchOpenAsync(ServiceContext.DefaultProjectId, progress, cancellationToken)); }
public QueueAbstract GetQueue(XElement ep, System.IProgress <QueueMonitorMessage> monitorMessageProgress) { string queueType = ep.Attribute("type").Value; QueueAbstract queue; switch (queueType) { case "MSMQ": queue = new QEMSMQ(ep, monitorMessageProgress); break; case "MQ": queue = new QEMQ(ep, monitorMessageProgress); break; case "HTTP": queue = new QEHTTP(ep, monitorMessageProgress); break; case "REST": queue = new QERest(ep, monitorMessageProgress); break; case "KAFKA": queue = new QEKafka(ep, monitorMessageProgress); break; case "RABBITDEFEX": queue = new QERabbitDefExchange(ep, monitorMessageProgress); break; case "FILE": queue = new QEFile(ep, monitorMessageProgress); break; case "SINK": queue = new QESink(ep, monitorMessageProgress); break; case "TCPSERVER": case "TCPCLIENT": queue = new QETCP(ep, monitorMessageProgress); break; case "TESTSOURCE": queue = new QESink(ep, monitorMessageProgress); break; case "SMTP": queue = new QESMTP(ep, monitorMessageProgress); break; case "MQTT": queue = new QEMQTT(ep, monitorMessageProgress); break; case "FTP": queue = new QEFTP(ep, monitorMessageProgress); break; default: queue = null; break; } return(queue); }
public void CreateAllTiles(IRasterDataset dataset, int maxZoom, IOutput output, System.IProgress <int> progress = null) { double xMin, yMin, xMax, yMax; var bytes = 65 * 65 * 2; byte zero = 0; int count = 0; RasterInfo r = dataset.Info; xMin = r.FieldInfo[0].Envelope.XMin; xMax = r.FieldInfo[0].Envelope.XMax; yMin = r.FieldInfo[0].Envelope.YMin; yMax = r.FieldInfo[0].Envelope.YMax; Dictionary <string, string> existingTiles = new Dictionary <string, string>(); for (int zoom = maxZoom; zoom >= 0; zoom--) { //only generate tiles within the extents of the data var southWestTile = PointToTile.LatLonToTile(zoom, yMin, xMin); var northEastTile = PointToTile.LatLonToTile(zoom, yMax, xMax); var dx = northEastTile.X - southWestTile.X; var dy = northEastTile.Y - southWestTile.Y; var boundingBox = PointToTile.TileBounds(zoom, northEastTile.X, northEastTile.Y); var tileSample = (boundingBox.Max.Lon - boundingBox.Min.Lon) / 64; var sourceSample = dataset.Info.FieldInfo[0].CellSizeX.Decimal; ThreadLocal <byte[]> terrainTileLocal = new ThreadLocal <byte[]>(() => new byte[(bytes + 2)]); Console.WriteLine($"{(dx+1)*dy}"); Parallel.For(0, dx + 1, (easterlyOffset) => { Parallel.For(0, dy + 1, (northerlyOffset) => { int tX = southWestTile.X + easterlyOffset; int tY = southWestTile.Y + northerlyOffset; var terrainTile = terrainTileLocal.Value; byte childQuadSwitch = zero; if (zoom != maxZoom) { childQuadSwitch = GetChildQuads(zoom, tX, tY, existingTiles); } //always create tiles with child tiles bool create = childQuadSwitch > 0 || (zoom == maxZoom); if (create) { bool created = false; created = CreateTile(tX, tY, zoom, dataset, terrainTile); if (zoom == maxZoom) { create = created; } } if (create) { terrainTile[bytes] = childQuadSwitch; terrainTile[bytes + 1] = 0; //We'll say it's all land for now output.WriteTile(zoom, tX, tY, terrainTile); existingTiles.Add($"{zoom}/{tX}/{tY}", ""); } progress?.Report(++count); }); }); } }