/// <summary> /// Download window closing event /// </summary> /// <param name="sender">The sender object</param> /// <param name="e">The window closing event arg</param> private void Window_Closing(object sender, CancelEventArgs e) { if (_webClient == null) { DialogResult = false; } else if (_webClient.IsBusy) { _webClient.CancelAsync(); DialogResult = false; } else { DialogResult = true; } }