protected override AsyncAction CreateAction(out bool cancelled) { AsyncAction action = null; if (diskSpaceReq.CanCleanup) { Program.Invoke(Program.MainWindow, delegate() { DialogResult r = new ThreeButtonDialog( new ThreeButtonDialog.Details( SystemIcons.Warning, diskSpaceReq.GetSpaceRequirementsMessage()), new ThreeButtonDialog.TBDButton(Messages.YES, DialogResult.Yes, ThreeButtonDialog.ButtonType.ACCEPT, true), ThreeButtonDialog.ButtonNo ).ShowDialog(Program.MainWindow); if (r == DialogResult.Yes) { action = new CleanupDiskSpaceAction(this.Server, patch, true); } }); } else { Program.Invoke(Program.MainWindow, delegate() { new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, diskSpaceReq.GetSpaceRequirementsMessage())) .ShowDialog(); }); } cancelled = action == null; return action; }
private void errorLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (!canDownload) { var msgtemplate = SelectedExistingPatch.host_patches.Count > 0 ? Messages.PATCH_DOWNLOAD_FAILED_MORE_INFO : Messages.PATCH_DOWNLOAD_FAILED_MORE_INFO_NOT_APPLIED; var msg = string.Format(msgtemplate, SelectedExistingPatch.name_label, SelectedExistingPatch.Connection.Name, Branding.Update); using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Error, msg))) { dlg.ShowDialog(this); } } if (diskSpaceRequirements == null) return; if (diskSpaceRequirements.CanCleanup) { using (var d = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, diskSpaceRequirements.GetSpaceRequirementsMessage()), new ThreeButtonDialog.TBDButton(Messages.OK, DialogResult.OK), new ThreeButtonDialog.TBDButton(Messages.CANCEL, DialogResult.Cancel))) { if (d.ShowDialog(this) == DialogResult.OK) { // do the cleanup and retry uploading CleanupDiskSpaceAction action = new CleanupDiskSpaceAction(diskSpaceRequirements.Host, null, true); action.Completed += delegate { if (action.Succeeded) { Program.Invoke(Program.MainWindow, TryUploading); } }; action.RunAsync(); } } } else { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, diskSpaceRequirements.GetSpaceRequirementsMessage()))) { dlg.ShowDialog(this); } } }
private void diskspaceErrorLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (diskSpaceRequirements == null) return; if (diskSpaceRequirements.CanCleanup) { ThreeButtonDialog d = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, diskSpaceRequirements.GetSpaceRequirementsMessage()), new ThreeButtonDialog.TBDButton(Messages.OK, DialogResult.OK), new ThreeButtonDialog.TBDButton(Messages.CANCEL, DialogResult.Cancel)); if (d.ShowDialog(this) == DialogResult.OK) { // do the cleanup and retry uploading CleanupDiskSpaceAction action = new CleanupDiskSpaceAction(diskSpaceRequirements.Host, null, true); action.Completed += delegate { if (action.Succeeded) { Program.Invoke(Program.MainWindow, TryUploading); } }; action.RunAsync(); } } else { new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, diskSpaceRequirements.GetSpaceRequirementsMessage())) .ShowDialog(this); } }