public MainForm() { Controls = new Layout { new TextBlock { Text = "SharpJS - ExaPhaser.WebForms Demo", TextAlign = TextAlign.Center, FontStyle = new FontStyle { FontSize = 24, FontWeight = FontWeight.Bold } }, new TextBlock { Text = "A random TextBox is below" }, new TextBox { PlaceholderText = "Placeholder Stuff", }, new Button { Text = "OK", Command = new DelegateCommand(() => JSLibrary.Alert("You clicked the button")) }, new TextArea { PlaceholderText = "This awesome placeholder!", Rows = 20 } }; }
protected override void JSComponent_Loaded(object sender, RoutedEventArgs e) { if (Configuration.AreSourcesSet) { _jsLibrary = new JSLibrary( css: new Interop.ResourceFile[] { new Interop.ResourceFile("kendo.common-material", Configuration.LocationOfKendoCommonMaterialCSS), // e.g. "ms-appx:///CSHTML5.Wrappers.KendoUI.Grid/styles/kendo.common-material.min.css" new Interop.ResourceFile("kendo.material", Configuration.LocationOfKendoMaterialCSS), // e.g. "ms-appx:///CSHTML5.Wrappers.KendoUI.Grid/styles/kendo.material.min.css" new Interop.ResourceFile("kendo.material.mobile", Configuration.LocationOfKendoMaterialMobileCSS), // e.g. "ms-appx:///CSHTML5.Wrappers.KendoUI.Grid/styles/kendo.material.mobile.min.css" new Interop.ResourceFile("kendo.rtl", Configuration.LocationOfKendoRTLCSS) // e.g. "ms-appx:///CSHTML5.Wrappers.KendoUI.Grid/styles/kendo.rtl.min.css" }, js: new Interop.ResourceFile[] { new Interop.ResourceFile("jQuery", "ms-appx:///CSHTML5.Migration.Wrappers.KendoUI.Charts/scripts/jquery.min.js"), new Interop.ResourceFile("kendo", Configuration.LocationOfKendoAllJS) // e.g. "ms-appx:///CSHTML5.Wrappers.KendoUI.Grid/scripts/kendo.all.min.js" } ); base.JSComponent_Loaded(sender, e); } else { this.Html = @"Before you can use the Kendo Chart Control, you must add to your project the corresponding libraries. To do so, please follow the tutorial at: http://www.cshtml5.com"; MessageBox.Show(@"Before you can use the Kendo Chart Control, you must add to your project the corresponding libraries. To do so, please follow the tutorial at: http://www.cshtml5.com"); //todo: put the address of the tutorial. base.AbortLoading(); } }
protected override void JSComponent_Loaded(object sender, RoutedEventArgs e) { if (Configuration.AreSourcesSet) { _jsLibrary = new JSLibrary( css: new Interop.ResourceFile[] { //----------------OLD ONES----------------// new Interop.ResourceFile("kendo.common", Configuration.LocationOfKendoCommonCSS), // e.g. "ms-appx:///CSHTML5.Wrappers.KendoUI.TreeView/styles/kendo.common.min.css" new Interop.ResourceFile("kendo.default", Configuration.LocationOfKendoDefaultCSS), // e.g. "ms-appx:///CSHTML5.Wrappers.KendoUI.TreeView/styles/kendo.default.min.css" new Interop.ResourceFile("kendo.default.mobile", Configuration.LocationOfKendoDefaultMobileCSS), // e.g. "ms-appx:///CSHTML5.Wrappers.KendoUI.TreeView/styles/kendo.default.mobile.min.css" }, js: new Interop.ResourceFile[] { #if SLMIGRATION new Interop.ResourceFile("jQuery", "ms-appx:///CSHTML5.Migration.Wrappers.KendoUI.TreeView/scripts/jquery.min.js"), #else new Interop.ResourceFile("jQuery", "ms-appx:///CSHTML5.Wrappers.KendoUI.TreeView/scripts/jquery.min.js"), #endif new Interop.ResourceFile("kendo.all", Configuration.LocationOfKendoAllJS), } ); base.JSComponent_Loaded(sender, e); } else { this.Html = @"Before you can use the Kendo TreeView Control, you must add to your project the corresponding libraries. To do so, please follow the tutorial at: http://www.cshtml5.com"; MessageBox.Show(@"Before you can use the Kendo TreeView Control, you must add to your project the corresponding libraries. To do so, please follow the tutorial at: http://www.cshtml5.com"); //todo: put the address of the tutorial. base.AbortLoading(); } }
protected override void JSComponent_Loaded(object sender, RoutedEventArgs e) { if (Configuration.AreSourcesSet) { _jsLibrary = new JSLibrary( css: new Interop.ResourceFile[] { new Interop.ResourceFile("dx.common", Configuration.LocationOfDXCommonCSS), // e.g. "ms-appx:///CSHTML5.Wrappers.DevExtreme.DataGrid/styles/dx.common.css" new Interop.ResourceFile("dx.theme", Configuration.LocationOfDXThemeCSS), // e.g. "ms-appx:///CSHTML5.Wrappers.DevExtreme.DataGrid/styles/dx."theme name".css" }, js: new Interop.ResourceFile[] { new Interop.ResourceFile("jQueryDevExtreme", Configuration.LocationOfJquery), // e.g. "ms-appx:///CSHTML5.Wrappers.DevExtreme.DataGrid/scripts/jquery.min.js" new Interop.ResourceFile("dx", Configuration.LocationOfDXAllJS) // e.g. "ms-appx:///CSHTML5.Wrappers.DevExtreme.DataGrid/scripts/dx.all.js" } ); base.JSComponent_Loaded(sender, e); CheckErrorandDisplayItInsteadOfEditorIfNeeded(); } else { this.Html = @"Before you can use the DevExtreme DataGrid, you must add to your project the corresponding libraries. To do so, please follow the tutorial at: http://www.cshtml5.com"; MessageBox.Show(@"Before you can use the DevExtreme DataGrid, you must add to your project the corresponding libraries. To do so, please follow the tutorial at: http://www.cshtml5.com"); //todo: put the address of the tutorial. base.AbortLoading(); } }
/// <summary> /// Opens a URL in a popup window. /// </summary> /// <param name="url"></param> public static void Start(string url) { JSLibrary.OpenLinkInNewTab(url); }
public static void Show(string message) { JSLibrary.Alert(message); }
/// <summary> /// Processes the website. /// </summary> /// <param name="Crawler">The crawler.</param> /// <param name="Host">The host.</param> private static async Task ProcessWebsite(Crawler Crawler, Uri Host) { Log.Warning(typeof(Program), "Processing '" + Host.AbsoluteUri + "'."); if (Crawler == null) { throw new ArgumentNullException(nameof(Crawler)); } if (Host == null) { throw new ArgumentNullException(nameof(Host)); } if (Host.AbsoluteUri.EndsWith(".html")) { Crawler.SetUri(new Uri(Host.AbsoluteUri.Replace(Host.Segments.Last(), string.Empty))); await Crawler.LoadAsync(Host, async Page => { if (Page.IsEmpty) { return; } foreach (var Url in Page.DetectedUrls) { if (Url.Contains("{@gate}")) { continue; } var Uri = new Uri(Crawler.Uri, Url); if (Url.EndsWith(".js")) { var LastSection = Url.Split('/').Last(); var FileName = LastSection.Split('.').First(); switch (FileName) { case "main": case "runtime": case "polyfills": { await Crawler.LoadAsync(Url, async JSFile => { JSFile.SaveToFile(); }); break; } case "coherent": { await Crawler.LoadAsync(Url, async JSLibrary => { JSLibrary.SaveToFile(); }); break; } default: { break; } } } else { await Crawler.LoadAsync(Url, async OtherFile => { OtherFile.SaveToFile(); }); } Log.Warning(typeof(Program), "-> " + Uri.AbsolutePath); } }); } else { throw new ArgumentException("Host doesnt end with .html extension.", nameof(Host)); } }
void logic_JobLoaded(object sender, JSLibrary.Data.GenericEvents.UnaryValueEvent<int> evt) { EvaluateJob(evt.Value); }
void logic_JobCreated(object sender, JSLibrary.Data.GenericEvents.UnaryValueEvent<IilAction> evt) { this.AddPacket(evt.Value); }