Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/25/11 21:02:58 (13 years ago)
Author:
ascheibe
Message:

#1652

  • added MainForms for Single and Multiple Documents to Optimizer
  • moved cursor handling code up to MainForm
  • added a configuration dialog for switching between different MainForms
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r5463 r6827  
    3131  public partial class MainForm : Form, IMainForm {
    3232    private bool initialized;
     33    private int appStartingCursors;
     34    private int waitingCursors;
    3335
    3436    protected MainForm()
     
    3941      this.initialized = false;
    4042      this.showContentInViewHost = false;
     43      appStartingCursors = 0;
     44      waitingCursors = 0;
    4145    }
    4246
     
    447451    }
    448452    #endregion
     453
     454    #region Cursor Handling
     455    public void SetAppStartingCursor() {
     456      if (InvokeRequired)
     457        Invoke(new Action(SetAppStartingCursor));
     458      else {
     459        appStartingCursors++;
     460        SetCursor();
     461      }
     462    }
     463    public void ResetAppStartingCursor() {
     464      if (InvokeRequired)
     465        Invoke(new Action(ResetAppStartingCursor));
     466      else {
     467        appStartingCursors--;
     468        SetCursor();
     469      }
     470    }
     471    public void SetWaitCursor() {
     472      if (InvokeRequired)
     473        Invoke(new Action(SetWaitCursor));
     474      else {
     475        waitingCursors++;
     476        SetCursor();
     477      }
     478    }
     479    public void ResetWaitCursor() {
     480      if (InvokeRequired)
     481        Invoke(new Action(ResetWaitCursor));
     482      else {
     483        waitingCursors--;
     484        SetCursor();
     485      }
     486    }
     487    private void SetCursor() {
     488      if (waitingCursors > 0) Cursor = Cursors.WaitCursor;
     489      else if (appStartingCursors > 0) Cursor = Cursors.AppStarting;
     490      else Cursor = Cursors.Default;
     491    }
     492    #endregion
    449493  }
    450494}
Note: See TracChangeset for help on using the changeset viewer.