From 289fbf244a4bcff8223b14c00c75c8b1fe76b42e Mon Sep 17 00:00:00 2001 From: amaitland Date: Fri, 9 Sep 2016 13:21:48 +1000 Subject: [PATCH] Update WinFormsBrowserProcessHandler to use the simplest possible approach - NOT PRODUCTION READY --- .../Handlers/WinFormsBrowserProcessHandler.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/CefSharp.WinForms.Example/Handlers/WinFormsBrowserProcessHandler.cs b/CefSharp.WinForms.Example/Handlers/WinFormsBrowserProcessHandler.cs index c188fd724..eec43bb7b 100644 --- a/CefSharp.WinForms.Example/Handlers/WinFormsBrowserProcessHandler.cs +++ b/CefSharp.WinForms.Example/Handlers/WinFormsBrowserProcessHandler.cs @@ -29,26 +29,18 @@ namespace CefSharp.WinForms.Example.Handlers private void TimerTick(object sender, EventArgs e) { - //Reset the timer interval to maximum - timer.Interval = MaxTimerDelay; - + //Basically execute Cef.DoMessageLoopWork 30 times per second //Execute DoMessageLoopWork on UI thread factory.StartNew(() => Cef.DoMessageLoopWork()); } protected override void OnScheduleMessagePumpWork(int delay) { - //Basically execute Cef.DoMessageLoopWork 30 times per second, - //when delay <= 0 set the timer interval to really small so it's executed - // relatively quickly. + //when delay <= 0 queue the Task up for execution on the UI thread. if(delay <= 0) { //Update the timer to execute almost immediately - timer.Interval = 1; - } - else - { - timer.Interval = delay; + factory.StartNew(() => Cef.DoMessageLoopWork()); } }