public Subnet CreateNewSubnet(string newSubnetName, string newSubnetAddressPrefix) { var tokens = ResourceId.Split('/'); var newResourceId = ResourceId.Replace($"/{tokens.Last()}", $"/{newSubnetName}"); return(new Subnet($"{newResourceId}{Delimiter}{Location}{Delimiter}{newSubnetAddressPrefix}{Delimiter}{VNetAddressPrefixes}")); }
private void CanvasViewOnPaintSurface(object sender, SKPaintSurfaceEventArgs args) { _canvas = args.Surface.Canvas; _canvas.Clear(); if (string.IsNullOrEmpty(ResourceId)) { return; } if (ResourceId.Contains("resource://")) { ResourceId = ResourceId.Replace("resource://", ""); } using (Stream stream = GetType().Assembly.GetManifestResourceStream(ResourceId)) { SkiaSharp.Extended.Svg.SKSvg svg = new SkiaSharp.Extended.Svg.SKSvg(); if (ResourceId.Contains("storage")) { svg.Load(ResourceId); } else { svg.Load(stream); } SKImageInfo info = args.Info; _canvas.Translate(info.Width / 2f, info.Height / 2f); SKRect bounds = svg.ViewBox; float xRatio = info.Width / bounds.Width; float yRatio = info.Height / bounds.Height; float ratio = Math.Min(xRatio, yRatio); _canvas.Scale(ratio); _canvas.Translate(-bounds.MidX, -bounds.MidY); _canvas.DrawPicture(svg.Picture); } }