private void test_Click(object sender, RoutedEventArgs e) { string uid = "lkj3klj"; if (times == 0) { QCircle(uid, 10, 10 + 10 * times); QCircle("follower", 100, 100); } else if (times == 20) { myBrowser.LoadHtml(GetResourceString("SharpFabric.JavaScript.GreenSockTest.html"), "http://junky/"); } else if (times > 22) { myBrowser.ExecuteScriptAsync(string.Format("tl.pause(); tl.progress({0})", ((double)times - 22) / 40)); } else if (times > 10) { QDelete(uid); } else { QMove(uid, 50, 10 + 10 * times); } if (times == 3) { QSetDrawingMode(); } times++; }
public MainWindow() { InitializeComponent(); CefSharp.CefSettings settings = new CefSharp.CefSettings() { //PackLoadingDisabled = true, }; CefSharp.Cef.Initialize(settings); myBrowser = new CefSharp.Wpf.ChromiumWebBrowser(); //myBrowser.Width = browserHolder.Width - 300; //myBrowser.Height = browserHolder.Height - 30; //myBrowser.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; //myBrowser.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; // Seems WebBrowser is fine - it's canvas that's a fixed size. Rescale automatically? // http://stackoverflow.com/questions/1664785/resize-html5-canvas-to-fit-window myBrowser.Background = new SolidColorBrush(System.Windows.Media.Colors.CadetBlue); browserHolder.Children.Add(myBrowser); myBrowser.LoadHtml(GetResourceString("SharpFabric.JavaScript.CanvBody.html"), "http://junky/"); // Initialize fabric.js after the DOM is fully loaded. Not sure whether this is the recommended way to ensure this. myBrowser.FrameLoadEnd += delegate { myBrowser.ExecuteScriptAsync(GetResourceString("SharpFabric.JavaScript.fabric.js")); myBrowser.ExecuteScriptAsync(GetResourceString("SharpFabric.JavaScript.qFunctions.js")); }; myBrowser.RegisterJsObject("callbackObj", new CallbackObjectForJs() { win = this }); }