/// <summary>
        /// Shows the please wait window with the default status text and executes the work delegate (in a background thread). When the work
        /// is finished, the please wait window will be automatically closed. This method will also subscribe to the
        /// <see cref="BackgroundWorker.RunWorkerCompleted"/> event.
        /// </summary>
        /// <param name="workDelegate">The work delegate.</param>
        /// <param name="runWorkerCompletedDelegate">The run worker completed delegate.</param>
        /// <param name="status">The status.</param>
        /// <param name="windowWidth">Width of the window.</param>
        public static void Show(PleaseWaitWorkDelegate workDelegate, RunWorkerCompletedEventHandler runWorkerCompletedDelegate, string status, double windowWidth)
        {
            UpdateStatus(status, windowWidth);

            Instance.ShowWindow();

            if (workDelegate != null)
            {
                workDelegate();

                lock (_visibleStopwatchLock)
                {
                    // Make sure the window is shown for a minimum duration
                    int milliSecondsLeftToShow = 0;
                    if (_visibleStopwatch != null)
                    {
                        _visibleStopwatch.Stop();
                        milliSecondsLeftToShow = MinimumShowTime - (int)_visibleStopwatch.ElapsedMilliseconds;
                        _visibleStopwatch      = null;
                    }

                    if (milliSecondsLeftToShow > 0)
                    {
                        Thread.Sleep(milliSecondsLeftToShow);
                    }
                }
            }

            if (runWorkerCompletedDelegate != null)
            {
                runWorkerCompletedDelegate(null, null);
            }

            Hide();
        }
Beispiel #2
0
        /// <summary>
        /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work
        /// is finished, the please wait window will be automatically closed.
        /// </summary>
        /// <param name="workDelegate">The work delegate.</param>
        /// <param name="status">The status. When the string is <c>null</c> or empty, the default please wait text will be used.</param>
        /// <remarks></remarks>
        public void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
        {
            Argument.IsNotNull("workDelegate", workDelegate);

            InitializeBusyIndicator();

            Show(status);

            workDelegate();

            Hide();
        }
        /// <summary>
        /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work
        /// is finished, the please wait window will be automatically closed.
        /// </summary>
        /// <param name="workDelegate">The work delegate.</param>
        /// <param name="status">The status. When the string is <c>null</c> or empty, the default please wait text will be used.</param>
        /// <remarks></remarks>
        public void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
        {
            Argument.IsNotNull("workDelegate", workDelegate);

            InitializeBusyIndicator();

            Show(status);

            workDelegate();

            Hide();
        }
Beispiel #4
0
        public virtual void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
        {
            Show(status);

            try
            {
                workDelegate();
            }
            finally
            {
                Hide();
            }
        }
        public virtual void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
        {
            Show(status);

            try
            {
                workDelegate();
            }
            finally
            {
                Hide();
            }
        }
        /// <summary>
        /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work
        /// is finished, the please wait window will be automatically closed.
        /// </summary>
        /// <param name="workDelegate">The work delegate.</param>
        /// <param name="status">The status.</param>
        public virtual void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
        {
            Argument.IsNotNull("workDelegate", workDelegate);

            if (!InitializeBusyIndicator())
            {
                return;
            }

            Show(status);

            workDelegate();

            Hide();
        }
 /// <summary>
 /// Shows the please wait window with the default status text and executes the work delegate (in a background thread). When the work
 /// is finished, the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate)
 {
     Show(workDelegate, null, "Please wait...", double.NaN);
 }
 /// <summary>
 /// Shows the please wait window with the default status text and executes the work delegate (in a background thread). When the work
 /// is finished, the please wait window will be automatically closed. This method will also subscribe to the
 /// <see cref="BackgroundWorker.RunWorkerCompleted"/> event.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="runWorkerCompletedDelegate">The run worker completed delegate.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate, RunWorkerCompletedEventHandler runWorkerCompletedDelegate)
 {
     Show(workDelegate, runWorkerCompletedDelegate, "Please wait...", double.NaN);
 }
 /// <summary>
 /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work is finished,
 /// the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="status">The status.</param>
 public virtual void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
 {
     PleaseWaitHelper.Show(workDelegate, null, status);
 }
Beispiel #10
0
 /// <summary>
 /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work
 /// is finished, the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="status">The status. When the string is <c>null</c> or empty, the default please wait text will be used.</param>
 /// <remarks></remarks>
 public void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
 {
     // Invoke work delegate
     workDelegate();
 }
 /// <summary>
 /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work 
 /// is finished, the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="status">The status.</param>
 /// <param name="windowWidth">Width of the window.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate, string status, double windowWidth)
 {
     Show(workDelegate, null, status, windowWidth);
 }
 /// <summary>
 /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work
 /// is finished, the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="status">The status.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate, string status)
 {
     Show(workDelegate, null, status, double.NaN);
 }
 /// <summary>
 /// Shows the please wait window with the default status text and executes the work delegate (in a background thread). When the work
 /// is finished, the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate)
 {
     Show(workDelegate, null, "Please wait...", double.NaN);
 }
 /// <summary>
 /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work 
 /// is finished, the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="status">The status.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate, string status)
 {
     Show(workDelegate, null, status, double.NaN);
 }
        /// <summary>
        /// Shows the please wait window with the default status text and executes the work delegate (in a background thread). When the work
        /// is finished, the please wait window will be automatically closed. This method will also subscribe to the
        /// <see cref="BackgroundWorker.RunWorkerCompleted" /> event.
        /// </summary>
        /// <param name="workDelegate">The work delegate.</param>
        /// <param name="runWorkerCompletedDelegate">The run worker completed delegate.</param>
        /// <param name="status">The status.</param>
        /// <param name="windowWidth">Width of the window.</param>
        public static void Show(PleaseWaitWorkDelegate workDelegate, RunWorkerCompletedEventHandler runWorkerCompletedDelegate = null, string status = "", double windowWidth = double.NaN)
        {
            Dispatcher.Invoke(() =>
            {
                UpdateStatus(status, windowWidth);

                Instance.ShowWindow(-1);
            });

            if (workDelegate != null)
            {
                workDelegate();

                lock (_visibleStopwatchLock)
                {
                    // Make sure the window is shown for a minimum duration
                    int milliSecondsLeftToShow = 0;
                    if (_visibleStopwatch != null)
                    {
                        _visibleStopwatch.Stop();
                        milliSecondsLeftToShow = MinimumShowTime - (int)_visibleStopwatch.ElapsedMilliseconds;
                        _visibleStopwatch = null;
                    }

                    if (milliSecondsLeftToShow > 0)
                    {
                        ThreadHelper.Sleep(milliSecondsLeftToShow);
                    }
                }
            }

            if (runWorkerCompletedDelegate != null)
            {
                runWorkerCompletedDelegate(null, null);
            }

            Dispatcher.Invoke(() => Hide());
        }
Beispiel #16
0
 /// <summary>
 /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work
 /// is finished, the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="status">The status. When the string is <c>null</c> or empty, the default please wait text will be used.</param>
 /// <remarks></remarks>
 public void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
 {
     // Invoke work delegate
     workDelegate();
 }
Beispiel #17
0
 /// <summary>
 /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work
 /// is finished, the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="status">The status.</param>
 public virtual void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
 {
     PleaseWaitHelper.Show(workDelegate, null, status);
 }
Beispiel #18
0
        /// <summary>
        /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work 
        /// is finished, the please wait window will be automatically closed.
        /// </summary>
        /// <param name="workDelegate">The work delegate.</param>
        /// <param name="status">The status.</param>
        public virtual void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
        {
            Argument.IsNotNull("workDelegate", workDelegate);

            if (!InitializeBusyIndicator())
            {
                return;
            }

            Show(status);

            workDelegate();

            Hide();
        }
 /// <summary>
 /// Shows the please wait window with the specified status text and executes the work delegate (in a background thread). When the work
 /// is finished, the please wait window will be automatically closed.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="status">The status.</param>
 /// <param name="windowWidth">Width of the window.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate, string status, double windowWidth)
 {
     Show(workDelegate, null, status, windowWidth);
 }
 /// <summary>
 /// Shows the please wait window with the default status text and executes the work delegate (in a background thread). When the work
 /// is finished, the please wait window will be automatically closed. This method will also subscribe to the
 /// <see cref="BackgroundWorker.RunWorkerCompleted"/> event.
 /// </summary>
 /// <param name="workDelegate">The work delegate.</param>
 /// <param name="runWorkerCompletedDelegate">The run worker completed delegate.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate, RunWorkerCompletedEventHandler runWorkerCompletedDelegate)
 {
     Show(workDelegate, runWorkerCompletedDelegate, "Please wait...", double.NaN);
 }
 public override void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
 {
     _shellView.ShowBusyIndicator = true;
 }