Wednesday, 14 August 2013

I'm getting InvalidCastException while actually casting nothing

I'm getting InvalidCastException while actually casting nothing

AutoResetEvent receiver = new AutoResetEvent(false);
Thread t = null;
t = new Thread(new ThreadStart(() =>
{
while (Browser.ReadyState !=
WebBrowserReadyState.Complete) // error
{
Thread.Sleep(10);
}
receiver.Set();
t.Abort();
}));
t.Start();
// Timeout
success = receiver.WaitOne(10000);
Browser is
public WebBrowser Browser { get; set; }

I don't really understand why I get such error. The Browser.ReadyState is
a enum type WebBrowserReadyState
So what do you think?

No comments:

Post a Comment