best practice to indicate long operation

  • Thread starter Thread starter Andrus
  • Start date Start date
A

Andrus

I need to indicate that some time-consumng operation is in progress in .NET
3.5 WinForms application.

I created class below and plan to use it like

using (WaitOper waitOper = new WaitOper())
TimeConsumingOperation();

Is this best way for this ?

Andrus.


using System;
using System.Windows.Forms;

class WaitOper : IDisposable {
Cursor saveCursor;

internal WaitOper() {
saveCursor = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
}

public void Dispose() {
Cursor.Current = saveCursor;
}
}
 
Andrus said:
I need to indicate that some time-consumng operation is in progress in .NET
3.5 WinForms application.

I created class below and plan to use it like

using (WaitOper waitOper = new WaitOper())
TimeConsumingOperation();

Is this best way for this ?

In general, time-consuming operations should be performed in a separate
thread entirely - that keeps the UI thread responsive.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top