public static void ReleaseInstance(WaitDialog instance)
 {
     if (_sharedInstance == null || _sharedInstance != instance)
     {
         return;
     }
     _sharedInstance.CloseDialog();
     _isInstanceAcquired = false;
 }
Example #2
0
 private void StartWaitDialogHelper(string caption, string waitMessage, string progressText,
                                    int delayToShowDialog, bool isCancellable, bool isProgressVisible,
                                    int currentStepCount = 0, int totalStepCount = -1, IWaitDialogCallback callback = null)
 {
     if (!ThreadHelper.CheckAccess())
     {
         ThreadHelper.Generic.Invoke(() =>
         {
             StartWaitDialogHelper(caption, waitMessage, progressText, delayToShowDialog,
                                   isCancellable, isProgressVisible, currentStepCount, totalStepCount, callback);
         });
     }
     else
     {
         ThreadHelper.ThrowIfNotOnUIThread(nameof(StartWaitDialogHelper));
         lock (_syncObject)
         {
             if (_instance == null)
             {
                 _instance = WaitDialog.AcquireInstance();
             }
             if (_instance == null)
             {
                 _isDialogStarted = true;
             }
             else
             {
                 _isUiSuppressed = IsUiSuppressed();
                 if (!_isUiSuppressed)
                 {
                     try
                     {
                         var args = new DialogShowArguments(caption, waitMessage, progressText, isCancellable,
                                                            isProgressVisible, currentStepCount, totalStepCount)
                         {
                             AppMainWindowHandle = GetPrimaryWindowHandle()
                         };
                         _instance.Show(TimeSpan.FromSeconds(delayToShowDialog), args, callback);
                         _isDialogStarted = true;
                     }
                     catch
                     {
                         WaitDialog.ReleaseInstance(_instance);
                         _instance = null;
                         throw;
                     }
                 }
                 else
                 {
                     _isDialogStarted = true;
                 }
             }
         }
     }
 }
Example #3
0
 private void ReleaseDialogInstance()
 {
     lock (_syncObject)
     {
         if (_instance == null)
         {
             return;
         }
         WaitDialog.ReleaseInstance(_instance);
         _instance = null;
     }
 }
 public static WaitDialog AcquireInstance()
 {
     ThreadHelper.ThrowIfNotOnUIThread(nameof(AcquireInstance));
     if (_isInstanceAcquired)
     {
         return(null);
     }
     if (_sharedInstance == null)
     {
         _sharedInstance = new WaitDialog(LauncherServiceProvider.Instance);
     }
     _isInstanceAcquired = true;
     ++_currentInstanceId;
     return(_sharedInstance);
 }
 public CancelHandler(WaitDialog owner)
 {
     _owner = owner;
 }