/// <summary> /// Show the progress window with the specified title, after a delay of 500ms. /// </summary> /// <param name="title">The window title</param> /// <remarks> /// This method can be called from worker thread. /// </remarks> public void Show(string title, Window owner) { if (!_uiDispatcher.CheckAccess()) { // must use BeginInvoke() here to avoid blocking the worker thread _uiDispatcher.BeginInvoke(new Action<string, Window>(Show), DispatcherPriority.Send, title, owner); return; } if (!IsPendingShow) { CancelPendingClose(); if (_currentWindow == null) { NuGetEventTrigger.Instance.TriggerEvent(NuGetEvent.ProgressDialogBegin); _currentWindow = new ProgressDialog() { Owner = owner }; _currentWindow.Closed += OnWindowClosed; } _currentWindow.Title = title; _showTimer.Value.Start(); } }
private void OnWindowClosed(object sender, EventArgs e) { if (_currentWindow != null) { _currentWindow.Closed -= OnWindowClosed; _currentWindow = null; NuGetEventTrigger.Instance.TriggerEvent(NuGetEvent.ProgressDialogEnd); } }
private void OnWindowClosed(object sender, EventArgs e) { if (_currentWindow != null) { bool upgradeRequested = _currentWindow.UpgradeNuGetRequested; _currentWindow.Closed -= OnWindowClosed; _currentWindow = null; NuGetEventTrigger.Instance.TriggerEvent(NuGetEvent.ProgressDialogEnd); if (upgradeRequested) { UpgradeNuGetRequested(this, EventArgs.Empty); } } }
public bool Close() { if (IsOpen) { _currentWindow.ForceClose(); _currentWindow = null; return true; } else { return false; } }
private void OnWindowClosed(object sender, EventArgs e) { if (_currentWindow != null) { _currentWindow.Closed -= OnWindowClosed; _currentWindow = null; } }
/// <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(); } }