public void ShowDialogWithDelay(IWin32Window owner, OpenLiveWriter.CoreServices.AsyncOperation asyncOperation, int delayMs) { // JJA: THIS TECHNIQUE DOES NOT WORK AND CAUSES ALL KINDS OF PROBLEMS! WE NEED A DIFFERENT // TECHNIQUE THAT DOES NOT STARVE THE UI THREAD. DO NOT UNDER ANY CONDITIONS RESTORE // THIS CODE!!!!!! /* // start out by polling the get post operation for completion for the delay interval using ( new WaitCursor() ) { const int SPLICE_MS = 100 ; int waitMs = 0 ; while( waitMs < delayMs ) { if ( asyncOperation.IsDone ) { return ; } else { Thread.Sleep(SPLICE_MS); waitMs += SPLICE_MS ; } } } */ // got past the delay interval, need to signup for events and show the dialog _asyncOperation = asyncOperation; if (_asyncOperation.IsDone) return; // show the dialog ShowDialog(owner); }
public void ShowDialogWithDelay(IWin32Window owner, OpenLiveWriter.CoreServices.AsyncOperation asyncOperation, int delayMs) { // JJA: THIS TECHNIQUE DOES NOT WORK AND CAUSES ALL KINDS OF PROBLEMS! WE NEED A DIFFERENT // TECHNIQUE THAT DOES NOT STARVE THE UI THREAD. DO NOT UNDER ANY CONDITIONS RESTORE // THIS CODE!!!!!! /* * // start out by polling the get post operation for completion for the delay interval * using ( new WaitCursor() ) * { * const int SPLICE_MS = 100 ; * int waitMs = 0 ; * while( waitMs < delayMs ) * { * if ( asyncOperation.IsDone ) * { * return ; * } * else * { * Thread.Sleep(SPLICE_MS); * waitMs += SPLICE_MS ; * } * } * } */ // got past the delay interval, need to signup for events and show the dialog _asyncOperation = asyncOperation; if (_asyncOperation.IsDone) { return; } // show the dialog ShowDialog(owner); }