Esempio n. 1
0
        static void Main(string[] args)
        {
            string pathRoot = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string pathBin  = Path.Combine(pathRoot, "bin") + @"\";

            string pathCache = Path.Combine(pathBin, "Cache");

            if (!Directory.Exists(pathCache))
            {
                Directory.CreateDirectory(pathCache);
            }

            ////////CefSettings settings = new CefSettings() {
            ////////    CachePath = pathCache,
            ////////    //LocalesDirPath = pathBin,
            ////////    //BrowserSubprocessPath = pathBin,
            ////////    //ResourcesDirPath = pathBin
            ////////};
            //////////For Windows 7 and above, best to include relevant app.manifest entries as well
            ////////Cef.EnableHighDPISupport();
            //////////We're going to manually call Cef.Shutdown below, this maybe required in some complex scenarios
            ////////CefSharpSettings.ShutdownOnExit = false;
            //////////Perform dependency check to make sure all relevant resources are in our output directory.
            ////////Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);


            CefSettings settings = new CefSettings();

            settings.CachePath = pathCache;
            //settings.CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache");
            //string rootPath = FileUtility.GetAssemblyPath();
            settings.BrowserSubprocessPath = Path.Combine(pathBin, "CefSharp.BrowserSubprocess.exe");
            settings.LocalesDirPath        = Path.Combine(pathBin, "locales");
            settings.ResourcesDirPath      = Path.Combine(pathRoot);
            Cef.EnableHighDPISupport();
            settings.CefCommandLineArgs.Add("disable-gpu", "1");
            Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);


            var browser = new fBrowser();

            Application.Run(browser);

            //Shutdown before your application exists or it will hang.
            Cef.Shutdown();
        }
Esempio n. 2
0
 public MessageListener(fBrowser parent)
 {
     parent.HandleCreated   += new EventHandler(this.OnHandleCreated);
     parent.HandleDestroyed += new EventHandler(this.OnHandleDestroyed);
     this.parent             = parent;
 }