I know normally one is not supposed to touch UI elements from threads other than the UI thread, but I am new to WPF and I am wondering if my current working implementation can be improved.

I have an application that is comprised solely of a notification tray icon, and I want to update that icon from a background thread.

Here is my Program.cs entry point:

```
static class Program
{
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        using (IconHandler notify = new IconHandler())
        {
            notify.Display();
            Application.Run();
        }

    }
}

```

This is my IconHandler.cs notification icon handler class:

```
class IconHandler : IDisposable
{

    NotifyIcon ni;

    public IconHandler()
    {
        ni = new NotifyIcon();
    }

    public void Display()
    {
        ni.MouseClick += new MouseEventHandler(ni_MouseClick);
        ni.Icon = Resources.icon1;
        ni.Visible = true;

        new Thread(new ThreadStart(UpdateIcon)).Start();
    }

    public void UpdateIcon()
    {
        while (true)
        {
            // reference ni directly, it updates fine
        }
    }

    public void Dispose()
    {
        ni.Dispose();
    }

    void ni_MouseClick(object sender, MouseEventArgs e)
    {
        // something useful
    }
}

```

Is there anything blatantly incorrect about this? It seems a bit fishy to me - it was just my first attempt. It seems to work for what I want to do, does anyone have any suggestions for a better implementation? Will I run into lifecycle issues with this setup?