C# threading and polling
<p>I have a tray icon that needs to display two icons:</p>

<ol>
<li>If there is network connectivity, display a green circle with a check mark</li>
<li>If there isn't network connectivity, display a red circle with an X</li>
</ol>

<p>So what I have is:</p>

<pre><code>using System.Net.NetworkInformation;

bool isConnected = NetworkInterface.GetIsNetworkAvailable()
</code></pre>

<p>So I'm thinking of starting a new thread or using the background worker progress because the tray icon is a NotifyIcon which is a component so I can't use:</p>

<pre><code>Form.Invoke(delegate, object[])
</code></pre>

<p>to update the icon property of the NotifyIcon class.</p>

<p>My big concern is the polling process:  I could write some logic that does:</p>

<pre><code>while (true) 
{
    System.Threading.Thread.Sleep(1000);
    isConnected = NetworkInterface.GetIsNetworkAvailable();
    if (isConnected)
        notifyIcon.Icon = "ConnectedIcon.ico";
    else
        notifyIcon.Icon = "DisconnectedIcon.ico";
}
</code></pre>

<p>but I've seen a couple of articles that tell me to stay away from Sleep(1000).  I can't seem to find those articles since I didn't bookmark them.  I'm just curious to know why that isn't a good idea for polling in a thread.</p>
