c# - Awesomium freezes / not responding -


i have traffic exchange website , want convert windows application using c# winform awesomium 1.7.5. basic setup ready there problem awesomium. after visiting few websites slows down , freezes entirely ( not responding ).

           public form1()         {             initializecomponent();              text = "traffic exchange";             windowstate = formwindowstate.maximized;             timer1 = new system.windows.forms.timer();             timer1.tick += new eventhandler(timer1_tick);             int user_id = properties.settings.default.user_id;             string user_id_s = user_id.tostring();             toolstriplabel2.text = user_id_s;              if (properties.settings.default.user_id == 0)             {                 toolstriplabel3.visible = true;                 toolstripbutton3.visible = false;             }             else             {                 toolstripbutton3.visible = true;                 toolstriplabel3.visible = false;             }          }          private void toolstripbutton3_click_1(object sender, eventargs e)         { // starting traffic traffic exchange             loadurl();             starttimer();         }            private void loadurl()         {             try             {                 string myconnection2 = "*******";                 string query = "select * ****** status = 1 , credits > 5 order rand() limit 1";                 mysqlconnection myconn2 = new mysqlconnection(myconnection2);                 mysqlcommand mycommand2 = new mysqlcommand(query, myconn2);                 myconn2.open();                 using (mysqldatareader dr = mycommand2.executereader())                 {                     while (dr.read())                     {                         string weburl = convert.tostring(dr.getvalue(*));                         string websurfsec = convert.tostring(dr.getvalue(*));                           int result = convert.toint32(websurfsec);                         int sec_to_mil = result * 1000;                         toolstriplabel5.text = websurfsec;                          //toolstripstatuslabel2.text = result.tostring();                         //toolstripstatuslabel3.text = sec_to_mil.tostring();                         webcontrol3.source = new uri(weburl);                         toolstriptextbox1.text = weburl;                         toolstriplabel6.text = toolstriptextbox1.text;                           timer1.interval = sec_to_mil; // in miliseconds                      }                 }                 myconn2.close();                 // webcore.releasememory();               //  webcontrol3.update();              //   thread.sleep(500);                }             catch (exception ex)             {                 messagebox.show(ex.message);             }          }       private void timer1_tick(object sender, eventargs e)         {             loadurl();         }       private void starttimer()         {             timer1.start();         } 

so loadurl() it's loop. when app started loads in traffic exchange website, a little bit slow works , can go form page without freezing when exchange in action ( loadurl() ) after 5 minutes app dead. i've been searching solution day , ended nothing, couldn't find solution problem.

the timer should not recreated each time loop. happening creating multiple event handlers each time loop. creating handler once in constructor , starting timer in button click routine right way.

you can change interval inside loop, avoid adding start() method call there.


Comments

Popular posts from this blog

SQL php on different pages to Insert (mysqli) -

php - How can an email be returned from Stripe Checkout? -

sql - Partition elimination in Greenplum -