c# - WPF startup application execute after internet connection connected? -


i'm developing windows application using wpf.the program running in startup , should wait untill internet connection connected, executed. internet connection time connect. therefore im running thread ping(like this) server in space of 3 seconds watch connection status.

 public bool checkconnection()     {            try         {              //////////////check connction             system.net.sockets.tcpclient clnt = new system.net.sockets.tcpclient(userconfig.configlist[2], convert.toint32(userconfig.configlist[3]));             clnt.close();             return true;          }         catch (exception)         {              return false;          }     } 

if status true program executed. there efficient way of doing this. ideas please??????

there useful networkmanager class on over cp allow check network connection status using netconnectionstatus enum...

you start timer check network connection every couple of seconds if (networkmanager.netconnectionstatus != netconnectionstatus.connected){} , wait execute network dependent code until network status changes connected.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -