void TestRegionBackwardCompatible(double lat, double lon, Region expected) { var region = RegionHelper.CreateRegion(lat, lon); Assert.AreEqual(expected.LatitudePrefix, region.LatitudePrefix); Assert.AreEqual(expected.LongitudePrefix, region.LongitudePrefix); Assert.AreEqual(expected.Precision, region.Precision); }
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { ToolStrip toolStrip = e.ToolStrip; Graphics g = e.Graphics; Rectangle affectedBounds = e.AffectedBounds; if (toolStrip is ToolStripDropDown) { RegionHelper.CreateRegion(toolStrip, affectedBounds, this.ColorTable.BackRadius, this.ColorTable.RadiusStyle); using (SolidBrush brush = new SolidBrush(this.ColorTable.Back)) { g.FillRectangle(brush, affectedBounds); return; } } LinearGradientMode mode = (toolStrip.Orientation == Orientation.Horizontal) ? LinearGradientMode.Vertical : LinearGradientMode.Horizontal; RenderHelperStrip.RenderBackgroundInternal(g, affectedBounds, this.ColorTable.Base, this.ColorTable.ItemBorder, this.ColorTable.Back, this.ColorTable.RadiusStyle, this.ColorTable.BackRadius, 0.35f, false, false, mode); }
public async Task <ActionResult <MessageListResponse> > GetAsync([Required] double lat, [Required] double lon, [Required] int precision, [Required] long lastTimestamp, CancellationToken cancellationToken = default) { try { // Pull queries matching parameters. Legacy precision is ignored var region = RegionHelper.CreateRegion(lat, lon); IEnumerable <MessageContainerMetadata> results = await this._reportService .GetLatestInfoAsync(region, lastTimestamp, cancellationToken); // Return using mapped proto object return(Ok(this._map.Map <MessageListResponse>(results))); } catch (RequestValidationFailedException ex) { return(BadRequest(ex.ValidationResult)); } catch (ArgumentNullException) { return(BadRequest()); } }
public async Task <ActionResult> HeadAsync([Required] double lat, [Required] double lon, [Required] int precision, [Required] long lastTimestamp, CancellationToken cancellationToken = default) { try { // Pull queries matching parameters var region = RegionHelper.CreateRegion(lat, lon); long size = await this._reportService .GetLatestRegionDataSizeAsync(region, lastTimestamp, cancellationToken); // Set Content-Length header with calculated size Response.ContentLength = size; return(Ok()); } catch (RequestValidationFailedException ex) { return(BadRequest(ex.ValidationResult)); } catch (ArgumentNullException) { return(BadRequest()); } }
protected override void OnRenderToolStripBackground( ToolStripRenderEventArgs e) { ToolStrip toolStrip = e.ToolStrip; Graphics g = e.Graphics; Rectangle bounds = e.AffectedBounds; if (toolStrip is ToolStripDropDown) { RegionHelper.CreateRegion(toolStrip, bounds); using (SolidBrush brush = new SolidBrush(ColorTable.BackNormal)) { g.FillRectangle(brush, bounds); } } else if (toolStrip is MenuStrip) { LinearGradientMode mode = toolStrip.Orientation == Orientation.Horizontal ? LinearGradientMode.Vertical : LinearGradientMode.Horizontal; RenderHelper.RenderBackgroundInternal( g, bounds, ColorTable.Base, ColorTable.Border, ColorTable.BackNormal, RoundStyle.None, 0, .35f, false, false, mode); } else { base.OnRenderToolStripBackground(e); } }
private void SetRegion() { RegionHelper.CreateRegion(this, new Rectangle(System.Drawing.Point.Empty, base.Size), this.Radius, this.RadiusStyle); }
//实现圆角 private void SetRegion() { RegionHelper.CreateRegion(this, new Rectangle(Point.Empty, Size), Radius, RadiusStyle); }