Esempio n. 1
0
        private async void GoLive(IWebViewComponent viewControl)
        {
            if (Mode != ApplicationMode.Dev)
            {
                return;
            }

            var resourceLoader = new ResourceReader("SetUp.script", this);
            var createOverlay  = resourceLoader.Load("loading.js");

            viewControl.ExecuteJavascript(createOverlay);

            var updateOverlay = resourceLoader.Load("update.js");
            var messageCount  = 0;

            void OnNpmLog(string information)
            {
                if (messageCount++ < 2)
                {
                    return;
                }

                var text = JavascriptNamer.GetCreateExpression(information);
                var code = updateOverlay.Replace("{information}", text);

                viewControl.ExecuteJavascript(code);
            }

            UpdateSetUp(await _Builder.BuildFromMode(ApplicationMode.Live, OnNpmLog));
            await viewControl.SwitchViewAsync(Uri);
        }
Esempio n. 2
0
 private static Action <string, string> GetDispatchAction(IWebView target, Func <string, string, string> codeBuilder)
 {
     return((channel, message) =>
     {
         var transformed = JavascriptNamer.GetCreateExpression(message);
         target.ExecuteJavaScript(codeBuilder($"'{channel}'", transformed));
     });
 }
Esempio n. 3
0
        private async Task DoGoLive(IWebViewComponent viewControl, CancellationToken token)
        {
            var resourceLoader = GetResourceReader();
            var updateOverlay  = resourceLoader.Load("update.js");

            void OnNpmLog(string information)
            {
                if (information == null)
                {
                    return;
                }

                var text = JavascriptNamer.GetCreateExpression(information);
                var code = updateOverlay.Replace("{information}", text);

                viewControl.ExecuteJavascript(code);
            }

            UpdateSetUp(await _Builder.BuildFromMode(ApplicationMode.Live, token, OnNpmLog));
        }
Esempio n. 4
0
        private IJavascriptObject Get(object @object)
        {
            var code = JavascriptNamer.GetCreateExpression(@object);

            return(Factory.CreateFromExcecutionCode(new[] { code }).Single());
        }
Esempio n. 5
0
        public void GetCreateExpression_Returns_Correct_Information(string value, string expected)
        {
            var actual = JavascriptNamer.GetCreateExpression(value);

            actual.Should().Be(expected);
        }
Esempio n. 6
0
 public string GetCreationCode() => JavascriptNamer.GetCreateExpression(TypedValue);
Esempio n. 7
0
 private string CreateStringValue(IEnumerable <object> from)
 {
     return($"[{string.Join(",", from.Select(v => JavascriptNamer.GetCreateExpression(v)))}]");
 }