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); }
public override string ToString() { if (CValue == null) { return("null"); } if (CValue is string) { return(JavascriptNamer.GetCreateExpressionDoubleQuote((string)CValue)); } object unBoxed = CValue; if (unBoxed is DateTime) { var dt = (DateTime)unBoxed; return($@"""{dt.Year:0000}-{dt.Month:00}-{dt.Day:00}T{dt.Hour:00}:{dt.Minute:00}:{dt.Second:00}.{dt.Millisecond:000}Z"""); } if (unBoxed is bool) { var boolValue = (bool)unBoxed; return($"{(boolValue ? "true" : "false")}"); } return(CValue.ToString()); }
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)); }); }
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)); }
public override string ToString() { switch (CValue) { case null: return("null"); case string stringValue: return(JavascriptNamer.GetCreateExpressionDoubleQuote(stringValue)); } object unBoxed = CValue; switch (unBoxed) { case DateTime dt: return($@"""{dt.Year:0000}-{dt.Month:00}-{dt.Day:00}T{dt.Hour:00}:{dt.Minute:00}:{dt.Second:00}.{dt.Millisecond:000}Z"""); case bool boolValue: return($"{(boolValue ? "true" : "false")}"); } return(CValue.ToString()); }
public string GetCreationCode() => JavascriptNamer.GetCreateDoubleString(TypedValue);
private IJavascriptObject Get(object @object) { var code = JavascriptNamer.GetCreateExpression(@object); return(Factory.CreateFromExcecutionCode(new[] { code }).Single()); }
public override string ToString() => JavascriptNamer.GetCreateCharString(TypedValue);
public void GetCreateExpression_Returns_Correct_Information(string value, string expected) { var actual = JavascriptNamer.GetCreateExpression(value); actual.Should().Be(expected); }
public override string ToString() => JavascriptNamer.GetCreateExpressionDoubleQuote(TypedValue);
public string GetCreationCode() => JavascriptNamer.GetCreateExpression(TypedValue);
private string CreateStringValue(IEnumerable <object> from) { return($"[{string.Join(",", from.Select(v => JavascriptNamer.GetCreateExpression(v)))}]"); }