protected override AsyncAction CreateAction(out bool cancelled)
        {
            AsyncAction action = null;

            if (patch != null && diskSpaceReq.CanCleanup)
            {
                Program.Invoke(Program.MainWindow, delegate()
                {
                    using (var dlg = new WarningDialog(diskSpaceReq.GetSpaceRequirementsMessage(),
                                                       new ThreeButtonDialog.TBDButton(Messages.YES, DialogResult.Yes, selected: true),
                                                       ThreeButtonDialog.ButtonNo))
                    {
                        if (dlg.ShowDialog() == DialogResult.Yes)
                        {
                            action = new CleanupDiskSpaceAction(this.Server, patch, true);
                        }
                    }
                });
            }
            else
            {
                Program.Invoke(Program.MainWindow, delegate()
                {
                    using (var dlg = new WarningDialog(diskSpaceReq.GetSpaceRequirementsMessage()))
                        dlg.ShowDialog();
                });
            }
            cancelled = action == null;

            return(action);
        }
Beispiel #2
0
        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);
                }
            }
        }
Beispiel #3
0
        private void errorLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            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(this, TryUploading);
                            }
                        };
                        action.RunAsync();
                    }
                }
            }
            else
            {
                using (var dlg = new ThreeButtonDialog(
                           new ThreeButtonDialog.Details(SystemIcons.Warning,
                                                         diskSpaceRequirements.GetSpaceRequirementsMessage())))
                {
                    dlg.ShowDialog(this);
                }
            }
        }
Beispiel #4
0
        protected override AsyncAction CreateAction(out bool cancelled)
        {
            AsyncAction action = null;

            if (diskSpaceReq.CanCleanup)
            {
                Program.Invoke(Program.MainWindow, delegate()
                {
                    using (var dlg = new ThreeButtonDialog(
                               new ThreeButtonDialog.Details(
                                   SystemIcons.Warning,
                                   diskSpaceReq.GetSpaceRequirementsMessage()),
                               new ThreeButtonDialog.TBDButton(Messages.YES, DialogResult.Yes, ThreeButtonDialog.ButtonType.ACCEPT, true),
                               ThreeButtonDialog.ButtonNo))
                    {
                        DialogResult r = dlg.ShowDialog();
                        if (r == DialogResult.Yes)
                        {
                            action = new CleanupDiskSpaceAction(this.Server, patch, true);
                        }
                    }
                });
            }
            else
            {
                Program.Invoke(Program.MainWindow, delegate()
                {
                    using (var dlg = new ThreeButtonDialog(
                               new ThreeButtonDialog.Details(SystemIcons.Warning, diskSpaceReq.GetSpaceRequirementsMessage())))
                    {
                        dlg.ShowDialog();
                    }
                });
            }
            cancelled = action == null;

            return(action);
        }