Exemple #1
0
        /// <summary>
        /// Show the progress window with the specified title.
        /// </summary>
        /// <param name="title">The window title</param>
        /// <remarks>
        /// This method can be called from worker thread.
        /// </remarks>
        public void Show(string title)
        {
            if (!_uiDispatcher.CheckAccess())
            {
                // must use BeginInvoke() here to avoid blocking the worker thread
                _uiDispatcher.BeginInvoke(new Action <string>(Show), title);
                return;
            }

            if (IsOpen)
            {
                // if the window is hidden, just re-show it instead of creating a new window instance
                if (_currentWindow.Title != title)
                {
                    _currentWindow.Title = title;
                }
                _currentWindow.ShowDialog();
            }
            else
            {
                _currentWindow         = new ProgressDialog();
                _currentWindow.Title   = title;
                _currentWindow.Closed += OnWindowClosed;

                _currentWindow.ShowModal();
            }
        }
        /// <summary>
        /// Show the progress window with the specified title.
        /// </summary>
        /// <param name="title">The window title</param>
        /// <remarks>
        /// This method can be called from worker thread.
        /// </remarks>
        public void Show(string title)
        {
            if (!_uiDispatcher.CheckAccess()) {
                // must use BeginInvoke() here to avoid blocking the worker thread
                _uiDispatcher.BeginInvoke(new Action<string>(Show), title);
                return;
            }

            if (IsOpen) {
                // if the window is hidden, just re-show it instead of creating a new window instance
                if (_currentWindow.Title != title) {
                    _currentWindow.Title = title;
                }
                _currentWindow.ShowDialog();
            }
            else {
                _currentWindow = new ProgressDialog();
                _currentWindow.Title = title;
                _currentWindow.Closed += OnWindowClosed;

                _currentWindow.ShowModal();
            }
        }