Пример #1
0
        private async Task <Rect> InvokeRenderMethodReturnBoundingBox(string method, params object[] args)
        {
            var task = await this.BrowserMainFrame.EvaluateScriptAsync(PrimitiveRenderer.CreateJavascriptCall(method, args));

            var result = (Dictionary <string, object>)task.Result;

            return(PrimitiveRenderer.CreateBoundingBox(result));
        }
Пример #2
0
        private async Task <Rect> InvokeAsyncRenderMethodReturnBoundingBox(string method, params object[] args)
        {
            await BrowserContext.CallbackObject.Acquire();

            await this.BrowserMainFrame.EvaluateScriptAsync(PrimitiveRenderer.CreateJavascriptCall(method, args));

            SpinWait.SpinUntil(() => BrowserContext.CallbackObject.IsCalledBack);

            var result = BrowserContext.CallbackObject.Result;

            BrowserContext.CallbackObject.Release();

            return(PrimitiveRenderer.CreateBoundingBox(result));
        }
Пример #3
0
        public async Task <Rect> DrawEllipseAroundNotes(Rect bounds)
        {
            var builder = new StringBuilder();

            builder.Append($"renderer.drawEllipseAroundBounds({{ left: {bounds.X}, top: {bounds.Y}, width: {bounds.Width}, height: {bounds.Height} }});");

            Debug.WriteLine(builder.ToString());

            var task = await this.BrowserMainFrame.EvaluateScriptAsync(builder.ToString());

            var result = (Dictionary <string, object>)task.Result;

            return(PrimitiveRenderer.CreateBoundingBox(result));
        }
Пример #4
0
        private async Task RenderTablature()
        {
            var primitiveRenderer = new PrimitiveRenderer(this.Browser);
            //var tablature = TabMLParser.TryParse(File.ReadAllText(@"..\..\..\..\..\Documentations\samples\temptest.txt"));
            //var tablature = TabMLParser.TryParse(File.ReadAllText(@"..\..\..\..\..\Documentations\samples\my home town.txt"));
            //var tablature = TabMLParser.TryParse(File.ReadAllText(@"..\..\..\..\..\Documentations\samples\bartest.txt"));
            //var tablature = TabMLParser.TryParse(File.ReadAllText(@"..\..\..\..\..\Documentations\samples\yellow2.txt"));
            var tablature = TabMLParser.TryParse(File.ReadAllText(@"..\..\..\..\..\Documentations\samples\city of stars.txt"));
            var style     = new TablatureStyle();
            var location  = new Point(style.Padding.Left, style.Padding.Top);
            var size      = new Size(
                1200 - style.Padding.Left - style.Padding.Right,
                3200 - style.Padding.Top - style.Padding.Bottom);

            var renderingContext = new RenderingContext();

            var renderer = new TablatureRenderer(primitiveRenderer, style, tablature);

            renderer.Initialize();
            renderingContext.AssignRenderingContext(renderer, renderingContext);
            await renderer.Render(renderingContext, location, size);

            _rendered = true;
        }
Пример #5
0
 private void InvokeRenderMethod(string method, params object[] args)
 {
     this.BrowserMainFrame.ExecuteJavaScriptAsync(PrimitiveRenderer.CreateJavascriptCall(method, args));
 }