Пример #1
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);
                }
            }
        }
Пример #2
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);
                }
            }
        }