コード例 #1
0
        /// <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();
        }
コード例 #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();
        }
コード例 #3
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();
        }
コード例 #4
0
ファイル: PleaseWaitService.cs プロジェクト: icygit/Orchestra
        public virtual void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
        {
            Show(status);

            try
            {
                workDelegate();
            }
            finally
            {
                Hide();
            }
        }
コード例 #5
0
        public virtual void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
        {
            Show(status);

            try
            {
                workDelegate();
            }
            finally
            {
                Hide();
            }
        }
コード例 #6
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();
        }
コード例 #7
0
 /// <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);
 }
コード例 #8
0
 /// <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);
 }
コード例 #9
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);
 }
コード例 #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();
 }
コード例 #11
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>
 /// <param name="windowWidth">Width of the window.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate, string status, double windowWidth)
 {
     Show(workDelegate, null, status, windowWidth);
 }
コード例 #12
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 static void Show(PleaseWaitWorkDelegate workDelegate, string status)
 {
     Show(workDelegate, null, status, double.NaN);
 }
コード例 #13
0
 /// <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);
 }
コード例 #14
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 static void Show(PleaseWaitWorkDelegate workDelegate, string status)
 {
     Show(workDelegate, null, status, double.NaN);
 }
コード例 #15
0
        /// <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());
        }
コード例 #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();
 }
コード例 #17
0
ファイル: PleaseWaitService.cs プロジェクト: ziez/Catel
 /// <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);
 }
コード例 #18
0
ファイル: PleaseWaitService.cs プロジェクト: pars87/Catel
        /// <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();
        }
コード例 #19
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>
 /// <param name="windowWidth">Width of the window.</param>
 public static void Show(PleaseWaitWorkDelegate workDelegate, string status, double windowWidth)
 {
     Show(workDelegate, null, status, windowWidth);
 }
コード例 #20
0
 /// <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);
 }
コード例 #21
0
 public override void Show(PleaseWaitWorkDelegate workDelegate, string status = "")
 {
     _shellView.ShowBusyIndicator = true;
 }