예제 #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.
        }
예제 #2
0
        public static bool DraggingUI = false;                          // Are we dragging?

        /// <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");
                        OnContextReady();
                    };
                    BrowserManager.Start();
                }).Start();
            }
        }
예제 #3
0
        /// <summary>
        /// Cleans all tabs. Use this if you want to destroy every existing tab.
        /// </summary>
        public static void Clean()
        {
            Console.WriteLine("Cleaning tabs... Count: " + Tabs.Count);
            while (Tabs.Count > 0)
            {
                for (int i = 0; i < Tabs.Count; i++)
                {
                    awesomiumContext.Send(state =>
                    {
                        Tabs[i].Dispose();
                    }, null);

                    Tabs.Remove(Tabs[i]);
                }
            }
            BrowserManager.EndBrowserManagerService();
            Console.WriteLine("Tabs should be clean. Count: " + Tabs.Count);
        }