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); }
public override object run() { _reachable = ReachabilityFactory.get().isReachable(_host); return(true); }
public static void Register() { ReachabilityFactory.addFactory(ch.cyberduck.core.Factory.NATIVE_PLATFORM, new Factory()); }