Ejemplo n.º 1
1
 public Main()
 {
     InitializeComponent();
     CefSharp.Settings settings = new Settings();
     //            settings.AutoDetectProxySettings = true;
     settings.CachePath = "cache";
     settings.LogFile = "f7chromium.log";
     settings.LogSeverity = LogSeverity.Warning;
     CEF.Initialize(settings);
     CefSharp.BrowserSettings bsettings = new BrowserSettings();
     bsettings.WebSecurityDisabled = true;
     bsettings.ApplicationCacheDisabled = false;
     bsettings.DatabasesDisabled = false;
     bsettings.LocalStorageDisabled = false;
     bsettings.PageCacheDisabled = false;
     bsettings.FileAccessFromFileUrlsAllowed = true;
     bsettings.XssAuditorEnabled = false;
     bsettings.DeveloperToolsDisabled = false;
     bsettings.UniversalAccessFromFileUrlsAllowed = true;
     bsettings.JavaScriptDisabled = false;
     bsettings.LocalStorageDisabled = false;
     view = new CefSharp.WinForms.WebView("file:///./client/start.html", bsettings);
     bt.init(this);
     view.RegisterJsObject("bt", bt);
     events.init(this);
     view.RegisterJsObject("events", events);
     view.Dock = DockStyle.Fill;
     webPanelParent.Controls.Add(view, 0, 1);
 }
Ejemplo n.º 2
0
        public entity(string uri, Form1 host)
            : base(uri, host)
        {
            this.Host = host;
            this.Runtime = new Spider.Scripting.LuaInterpreter(this);
            this.Preprocessor = new Spider.Preprocessor.LuaMako(this);
            entifyScheme = new EntifyScheme(this);
            var fragments = uri.Split(':');
            var app = fragments[1];

            this.uri = uri;
            try
            {
                Program.settings.UserStyleSheetEnabled = true;
                Program.settings.UserStyleSheetLocation = "resources/resources/css/" + Properties.Settings.Default.Theme + ".css";
                webView = new CefSharp.WinForms.WebView("about:blank", Program.settings);
                CefSharp.CEF.RegisterScheme("entify", new EntifySchemeHandlerFactory(this, entifyScheme));

                webView.PropertyChanged += webView_PropertyChanged;
            #if(false)
                template = LoadLocalResource("entify://" + app + "/index.html");
            #endif
                webView.Dock = DockStyle.Fill;
                webViewIsReady = true;
                this.Controls.Add(webView);

            }
            catch (Exception e)
            {
            }
        }
Ejemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            webView = new CefSharp.WinForms.WebView("http://play.spotify.com", new CefSharp.BrowserSettings());
            this.Controls.Add(webView);
            webView.Dock = DockStyle.Fill;
            webView.Address = "http://play.spotify.com";
            SPHeader p = new SPHeader();
            this.Controls.Add(p);
            p.Dock = DockStyle.Top;

            p.MouseMove += p_MouseMove;
            p.MouseDoubleClick += p_MouseDoubleClick;

            SPFooter footer = new SPFooter();
            this.Controls.Add(footer);
            footer.Dock = DockStyle.Bottom;
        }
Ejemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            webView = new CefSharp.WinForms.WebView("http://play.spotify.com", new CefSharp.BrowserSettings());
            this.Controls.Add(webView);
            webView.Dock    = DockStyle.Fill;
            webView.Address = "http://play.spotify.com";
            SPHeader p = new SPHeader();

            this.Controls.Add(p);
            p.Dock = DockStyle.Top;

            p.MouseMove        += p_MouseMove;
            p.MouseDoubleClick += p_MouseDoubleClick;

            SPFooter footer = new SPFooter();

            this.Controls.Add(footer);
            footer.Dock = DockStyle.Bottom;
        }
Ejemplo n.º 5
0
        public GoogleV3TileSchema(string gmeClientID, string googleChannel, string referer, GoogleV3TileSource.MapTypeId mapType)
        {
            MapType = mapType;
            Height  = 256;
            Width   = 256;
            Extent  = new Extent(-20037508.342789, -20037508.342789, 20037508.342789, 20037508.342789);
            OriginX = -20037508.342789;
            OriginY = 20037508.342789;
            Name    = "GoogleSchema";
            Format  = "png";
            Axis    = AxisDirection.InvertedY;
            Srs     = "EPSG:3857";

            m_gmeClientID   = gmeClientID;
            m_googleChannel = googleChannel;
            m_referer       = referer;
            if (m_cachedUrLs.ContainsKey(mapType + "_base"))
            {
                MapUrlTemplates = m_cachedUrLs[mapType + "_base"];
            }
            if (m_cachedUrLs.ContainsKey(mapType + "_overlay"))
            {
                OverlayUrlTemplates = m_cachedUrLs[mapType + "_overlay"];
            }
            m_appContext = new ApplicationContext();


            /* var frm = new Form();
             * frm.Show();
             * frm.Size = new System.Drawing.Size(600, 400);
             * Label l = new Label();
             * l.Text = "Test";
             *
             * WebBrowser bw = new WebBrowser();
             * bw.Size = new System.Drawing.Size(600, 400);
             * frm.Size = new System.Drawing.Size(600, 400);
             *
             * frm.Controls.Add(l);
             * frm.Controls.Add(bw);
             */

            wbThread = new Thread(() =>
            {
                try
                {
#if USE_CefSharp
                    var settings = new CefSharp.Settings
                    {
                        PackLoadingDisabled = true,
                    };

                    if (CEF.Initialize(settings))
                    {
                        m_webView = new WebView();
                        m_webView.PropertyChanged += WebViewOnPropertyChanged;
                        m_webView.Address          = referer;
                    }
#else
                    m_webBrowser                        = new WebBrowser();
                    m_webBrowser.Navigating            += m_WebBrowser_Navigating;
                    m_webBrowser.Visible                = true;
                    m_webBrowser.ScrollBarsEnabled      = false;
                    m_webBrowser.Size                   = new System.Drawing.Size(600, 400);
                    m_webBrowser.ScriptErrorsSuppressed = true;
                    m_webBrowser.DocumentCompleted     += m_WebBrowser_DocumentCompleted;


                    //bw.Invoke(new MethodInvoker(delegate
                    //{
                    //    bw.Navigating += new WebBrowserNavigatingEventHandler(m_WebBrowser_Navigating);
                    //    bw.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(m_WebBrowser_DocumentCompleted);
                    //    bw.DocumentText =
                    //        "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><style>BODY { background-color: red;}</style></head><body></body></html>";
                    //}));

                    //m_webBrowser = bw;

                    if (!string.IsNullOrEmpty(referer))
                    {
                        m_webBrowser.Navigate(referer);
                    }
                    else
                    {
                        m_webBrowser.DocumentText = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><body></body></html>";
                    }
#endif

                    if (m_appContext != null)
                    {
                        Application.Run(m_appContext);
                    }
                }
                catch (Exception ee)
                {
                    m_logger.Error("Exception in WebBrowserThread, quitting", ee);
                }
            });
            wbThread.Name = "WebBrowser Thread";
            wbThread.SetApartmentState(ApartmentState.STA);
            wbThread.Start();
            if (m_logger.IsDebugEnabled)
            {
                m_logger.Debug("WebBrowserThread Started");
            }
        }