Esempio n. 1
0
        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++;
        }
Esempio n. 2
0
        public static void GetKanColle2ndHtml5Core(CefSharp.Wpf.ChromiumWebBrowser browser)
        {
            try
            {
                browser.ExecuteScriptAsync("var node = document.createElement('style'); " +
                                           "node.innerHTML = 'html, body, iframe {overflow:hidden;margin:0;}'; " +
                                           "document.body.appendChild(node);");

                browser.ExecuteScriptAsync("var node = document.createElement('style'); " +
                                           "node.innerHTML = 'game_frame {position:fixed; left:50%; top:0px; margin-left:-480px; z-index:1;}'; " +
                                           "document.body.appendChild(node);");

                browser.ExecuteScriptAsync("var node = document.createElement('style'); " +
                                           "node.innerHTML = 'ul.area-menu {display: none;}'; " +
                                           "document.body.appendChild(node);");
                browser.ExecuteScriptAsync("var node = document.createElement('style'); " +
                                           "node.innerHTML = '.dmm-ntgnavi {display: none;}'; " +
                                           "document.body.appendChild(node);");

                var game_frame = browser.GetBrowser().GetFrame("game_frame");
                var source     = game_frame?.GetSourceAsync();
                source?.Wait();


                //Browser.SetZoomLevel(Math.Log(zoomFactor, 1.2));


                //if (StyleSheetApplied)
                //{
                //    Browser.Size = Browser.MinimumSize = new Size(
                //        (int)(KanColleSize.Width * zoomFactor),
                //        (int)(KanColleSize.Height * zoomFactor)
                //        );

                //    CenteringBrowser();
                //}
                //"overlap-contents"
                //var contents_iframe = browser.GetBrowser().GetFrame("contents_iframe");
                //var list2 = game_frame.Browser.GetFrameNames();
                //var list = browser.GetBrowser().GetFrameNames();
                //browser.GetBrowser();

                game_frame?.ExecuteJavaScriptAsync("document.getElementById('spacing_top').style.height = '0px'");
            }
            catch (System.Exception ex)
            {
            }
        }
Esempio n. 3
0
        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
            });
        }