- Joined
- May 11, 2009
- Messages
- 1
- Reaction score
- 0
Hello all,
I am using a Webrowser control to display a MemoryStream which contains the results of an XSL translation in C#. Everything is working great except for the cursor.
I can launch the process from two places on a button press on the form, and two a context menu from the webrowswer control.
The following function when called from a button press on the form works perfectly (the busy cursor is displayed for the entire length of time the read is taking place) however if i launch the same function from the context menu of the webrowser control the cursor changes briefly to the busy cursor and then immediatly back to the default cursor.
The mDA.Read() function reads from a serial device and is syncronous.
private void GetDevice()
{
Cursor.Current = Cursors.WaitCursor;
MemoryStream XMLStream = mDA.Read();
if (XMLStream != null)
{
webBrowser1.DocumentStream = XMLStream;
UpdateStatusBarLabel(mDA.UID + " read successful.", false);
}
else
{
webBrowser1.DocumentStream = null;
UpdateStatusBarLabel("read was not successful. Please verify the port has been selected and the device is connected and awake.", true);
}
Cursor.Current = Cursors.Default;
}
I am very unsure how and why calling the same function the same way from two differenct sources one a button press and the other a context menu click would cause different behaviour from the cursors.
Thanks for any help!
JF
I am using a Webrowser control to display a MemoryStream which contains the results of an XSL translation in C#. Everything is working great except for the cursor.
I can launch the process from two places on a button press on the form, and two a context menu from the webrowswer control.
The following function when called from a button press on the form works perfectly (the busy cursor is displayed for the entire length of time the read is taking place) however if i launch the same function from the context menu of the webrowser control the cursor changes briefly to the busy cursor and then immediatly back to the default cursor.
The mDA.Read() function reads from a serial device and is syncronous.
private void GetDevice()
{
Cursor.Current = Cursors.WaitCursor;
MemoryStream XMLStream = mDA.Read();
if (XMLStream != null)
{
webBrowser1.DocumentStream = XMLStream;
UpdateStatusBarLabel(mDA.UID + " read successful.", false);
}
else
{
webBrowser1.DocumentStream = null;
UpdateStatusBarLabel("read was not successful. Please verify the port has been selected and the device is connected and awake.", true);
}
Cursor.Current = Cursors.Default;
}
I am very unsure how and why calling the same function the same way from two differenct sources one a button press and the other a context menu click would cause different behaviour from the cursors.
Thanks for any help!
JF