public bool prompt(BackgroundException failure) { if (_supressed) { return(_option); } if (_controller.Visible) { AtomicBoolean c = new AtomicBoolean(true); _controller.Invoke(delegate { TaskDialogResult result = _controller.View.CommandBox(LocaleFactory.localizedString("Error"), failure.getMessage() ?? LocaleFactory.localizedString("Unknown"), failure.getDetail() ?? LocaleFactory.localizedString("Unknown"), null, null, LocaleFactory.localizedString("Always"), LocaleFactory.localizedString("Continue", "Credentials"), true, TaskDialogIcon.Warning, TaskDialogIcon.Information, delegate(int opt, bool verificationChecked) { if (verificationChecked) { _supressed = true; _option = c.Value; } }); if (result.Result == TaskDialogSimpleResult.Cancel) { c.SetValue(false); } }, true); return(c.Value); } // Abort return(false); }
public bool alert(Host host, BackgroundException failure, StringBuilder log) { FailureDiagnostics.Type type = _diagnostics.determine(failure); if (type == FailureDiagnostics.Type.cancel) { return(false); } _notification.alert(host, failure, log); bool r = false; _controller.Invoke(delegate { string footer = ProviderHelpServiceFactory.get().help(host.getProtocol()); string title = LocaleFactory.localizedString("Error"); string message = failure.getMessage() ?? LocaleFactory.localizedString("Unknown"); string detail = failure.getDetail() ?? LocaleFactory.localizedString("Unknown"); string expanded = log.length() > 0 ? log.toString() : null; string commandButtons; if (type == FailureDiagnostics.Type.network) { commandButtons = String.Format("{0}|{1}", LocaleFactory.localizedString("Try Again", "Alert"), LocaleFactory.localizedString("Network Diagnostics", "Alert")); } else if (type == FailureDiagnostics.Type.quota) { commandButtons = String.Format("{0}|{1}", LocaleFactory.localizedString("Try Again", "Alert"), LocaleFactory.localizedString("Help", "Main")); } else { commandButtons = String.Format("{0}", LocaleFactory.localizedString("Try Again", "Alert")); } _controller.WarningBox(title, message, detail, expanded, commandButtons, true, footer, delegate(int option, bool @checked) { switch (option) { case 0: r = true; break; case 1: if (type == FailureDiagnostics.Type.network) { ReachabilityFactory.get().diagnose(host); } if (type == FailureDiagnostics.Type.quota) { BrowserLauncherFactory.get().open(new DefaultProviderHelpService().help(host.getProtocol())); } r = false; break; } }); }, true); return(r); }
public bool alert(Host host, BackgroundException failure, StringBuilder log) { _notification.alert(host, failure, log); bool r = false; _controller.Invoke(delegate { String provider = host.getProtocol().getProvider(); string footer = String.Format("{0}/{1}", PreferencesFactory.get().getProperty("website.help"), provider); string title = LocaleFactory.localizedString("Error"); string message = failure.getMessage() ?? LocaleFactory.localizedString("Unknown"); string detail = failure.getDetail() ?? LocaleFactory.localizedString("Unknown"); string expanded = log.length() > 0 ? log.toString() : null; string commandButtons; if (_diagnostics.determine(failure) == FailureDiagnostics.Type.network) { commandButtons = String.Format("{0}|{1}", LocaleFactory.localizedString("Try Again", "Alert"), LocaleFactory.localizedString("Network Diagnostics", "Alert")); } else { commandButtons = String.Format("{0}", LocaleFactory.localizedString("Try Again", "Alert")); } _controller.WarningBox(title, message, detail, expanded, commandButtons, true, footer, delegate(int option, bool @checked) { switch (option) { case 0: r = true; break; case 1: ReachabilityFactory.get().diagnose(host); r = false; break; } }); }, true); return(r); }