Esempio n. 1
0
        /// <summary>
        /// Ends the Browser Manager. Use this when closing your application.
        /// </summary>
        public static void EndBrowserManagerService()
        {
            if (BrowserManager.Running)                         // Stops the browser manager.
            {
                BrowserManager.Close();
            }

            BrowserManager.awesomiumContext = null;             // Release the sync context.
        }
Esempio n. 2
0
        static void win_KeyPressed(object sender, KeyEventArgs e)
        {
            if (e.Code == Keyboard.Key.A)
            {
                BrowserManager.NewTab(0, "https://www.youtube.com/watch?v=ha6PP-Fw4Qw", 800, 600, 0, 0);
            }

            if (e.Code == Keyboard.Key.Z)
            {
                BrowserManager.DestroyTab(0);
            }
        }
Esempio n. 3
0
        public static SynchronizationContext awesomiumContext = null;   // Used to synchronize multiple tabs.

        /// <summary>
        /// Starts the Browser Manager on another thread. Without this, no web services are available.
        /// </summary>
        public static void StartBrowserManagerService()
        {
            if (!BrowserManager.Running)
            {
                new System.Threading.Thread(() =>
                {
                    Awesomium.Core.WebCore.Started += (s, e) =>
                    {
                        BrowserManager.awesomiumContext = System.Threading.SynchronizationContext.Current;
                        Console.WriteLine("Starting Synchronization Context for Browser");
                    };
                    BrowserManager.Start();
                }).Start();
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            win             = new RenderWindow(new VideoMode(800, 600), "");
            win.Closed     += (sender, e) => win.Close();
            win.KeyPressed += win_KeyPressed;

            BrowserManager.StartBrowserManagerService();

            while (win.IsOpen)
            {
                win.DispatchEvents();
                win.Clear();
                DrawTabs();
                win.Display();
            }

            BrowserManager.EndBrowserManagerService();
            Environment.Exit(0);
        }