Esempio n. 1
0
        public static void Start()
        {
            MyCef3InitEssential.CefDoMessageLoopWork();
            if (tinyForm == null)
            {
                tinyForm         = new Form();
                tinyForm.Size    = new System.Drawing.Size(10, 10);
                tinyForm.Visible = false;
            }
            //force it create handle****
            tinyFormHandle = tinyForm.Handle;

            //Cef3's message pump ***
            //---------------------------
            //this is CefMsgLoopPump implementation
            //it should not too fast or too slow to call
            bool appIsIdel = true;
            bool looping1  = false;

            loopTimer.Interval = 30;//30ms
            loopTimer.Tick    += (s, e) =>
            {
                if (appIsIdel)
                {
                    looping1  = true;
                    appIsIdel = false;
                    for (int i = 10; i >= 0; --i)
                    {
                        MyCef3InitEssential.CefDoMessageLoopWork();
                    }

                    looping1 = false;
                }
            };

            Application.Idle += (s, e) =>
            {
                if (!looping1)
                {
                    appIsIdel = true;
                }
            };

            loopTimer.Enabled = true;
        }