public LauncherForm(IApplicationCore AppCore) { this.AppCore = AppCore; PageStack = new Stack<Uri>(); InitializeComponent(); if (!WebCore.IsInitialized) { WebCore.Initialize(new WebConfig() { HomeURL = new Uri(@"asset://bzlauncher/home"), LogLevel = LogLevel.None, RemoteDebuggingHost = @"127.0.0.1", RemoteDebuggingPort = 8001 }, true); } session = WebCore.CreateWebSession(@".\SessionDataPath", WebPreferences.Default); DataSource = new LauncherDataSource(); ResourceInterceptor = new LauncherResourceInterceptor(); session.AddDataSource("bzlauncher", DataSource); WebCore.ResourceInterceptor = ResourceInterceptor; }
private WebSession InitializeCoreAndSession() { if (!WebCore.IsInitialized) { WebCore.Initialize(new WebConfig() { AssetProtocol = "https", LogLevel = LogLevel.Normal }); } // Build a data path string. In this case, a Cache folder under our executing directory. // - If the folder does not exist, it will be created. // - The path should always point to a writeable location. string dataPath = String.Format("{0}{1}Cache", Path.GetDirectoryName(Application.ExecutablePath), Path.DirectorySeparatorChar); // Check if a session synchronizing to this data path, is already created; // if not, create a new one. session = WebCore.Sessions[dataPath] ?? WebCore.CreateWebSession(dataPath, new WebPreferences() { }); session.AddDataSource(DataSource.CATCH_ALL, new MyDataSource()); // The core must be initialized by now. Print the core version. Debug.Print(WebCore.Version.ToString()); // Return the session. return(session); }
public MainWindow() { if (!WebCore.IsInitialized) { WebCore.Initialize(new WebConfig() { HomeURL = new Uri("http://localhost"), RemoteDebuggingPort = 8001, }); } // Create a WebSession. WebSession session = WebCore.CreateWebSession(new WebPreferences() { SmoothScrolling = true }); session.AddDataSource("core", new ResourceDataSource(ResourceType.Embedded, Assembly.GetExecutingAssembly())); InitializeComponent(); webControl.DocumentReady += onDocumentReady; webControl.ConsoleMessage += onConsoleMessage; webControl.LoadingFrameComplete += onLoadingFrameComplete; webControl.WebSession = session; }
public FrmMain() { InitializeComponent(); string dataPath = String.Format("{0}{1}Cache", Path.GetDirectoryName(Application.ExecutablePath), Path.DirectorySeparatorChar); session = WebCore.Sessions[dataPath] ?? WebCore.CreateWebSession(dataPath, WebPreferences.Default); session.AddDataSource("local", new ResourceDataSource(ResourceType.Packed)); this.webControl1.WebSession = session; }
private void CreateSession() { _session = WebCore.CreateWebSession( _cacheDir, new WebPreferences { SmoothScrolling = true, WebGL = true, EnableGPUAcceleration = true, }); _session.AddDataSource("demo", new DirectoryDataSource( Path.GetDirectoryName(@"html\greeter.html"))); }
private WebSession CreateBattlelogWebSession() { Utilities.Log("BattlelogiumMain.CreateBattlelogWebSession() Called"); WebSession session = WebCore.CreateWebSession( Path.Combine( AppDomain.CurrentDomain.BaseDirectory, "Battlelogium", "WebSession"), new WebPreferences { CustomCSS = config.CSS, EnableGPUAcceleration = true, }); session.AddDataSource("local", new ResourceDataSource(ResourceType.Packed)); WebCore.HomeURL = new Uri("http://battlelog.battlefield.com/bf3"); WebCore.Download += new DownloadEventHandler(WebCore_Download); return(session); }
/// <summary> /// Initializes a new instance of the <see cref="ScreenManager"/> class. /// </summary> /// <param name="game">The game.</param> /// <param name="spriteBatch">The sprite batch to use for rendering.</param> /// <param name="manager">The input manager to use.</param> public ScreenManager(Game game, SpriteBatch spriteBatch, InputManager manager) : base(game) { _spriteBatch = spriteBatch; _inputManager = manager; ScrollAmount = 100; // Create texture to blit web screen into for XNA rendering. _backBuffer = new Texture2D(Game.GraphicsDevice, Game.GraphicsDevice.Viewport.Width, Game.GraphicsDevice.Viewport.Height); // Register for events. foreach (var keyboard in _inputManager.Keyboards) { keyboard.KeyPressed += HandleKeyPressed; keyboard.CharacterEntered += HandleCharacterEntered; keyboard.KeyReleased += HandleKeyReleased; } foreach (var mouse in _inputManager.Mice) { mouse.MouseButtonPressed += HandleMouseButtonPressed; mouse.MouseButtonReleased += HandleMouseButtonReleased; mouse.MouseMoved += HandleMouseMoved; mouse.MouseWheelRotated += HandleMouseWheelRotated; } // Start webcore if it's not running. if (!WebCore.IsRunning) { WebCore.Initialize(new WebConfig { #if DEBUG LogLevel = LogLevel.Verbose, #else LogLevel = LogLevel.None, #endif LogPath = Environment.CurrentDirectory + "\\awesomium.log", RemoteDebuggingPort = 1337 }); // If we created it, we shut it down on disposal, too. _ownsWebCore = true; } // Create our session. _session = WebCore.CreateWebSession(new WebPreferences { CustomCSS = DefaultCSS, WebSecurity = false, ProxyConfig = "none" }); // Register our custom data source. Keep a reference to it, as the // one the session holds seems to be a weak one. _dataSource = new ContentLoaderDataSource(Game.Content); _session.AddDataSource("xna", _dataSource); // Add default callbacks to allow JS to modify screens. AddCallback("Screens", "push", JSPushScreen); AddCallback("Screens", "pop", JSPopScreen); }