CompositeDisposable TryCreateTrayIcon() { const string explorerErrorMessage = "This exception is usually due to explorer.exe not running when trying to create tray icon.\n" + "Try to resolve it by starting explorer.exe and then restarting the application."; const string explorerErrorTitle = "Tray icon creation failed."; try { return(CreateTrayIcon()); } catch (Win32Exception e) { _dialogManager.ExceptionDialog(e, explorerErrorMessage, explorerErrorTitle).WaitSpecial(); } catch (XamlParseException e) { var inner = e.FindInnerException <Win32Exception>(); if (inner != null) { _dialogManager.ExceptionDialog(inner, explorerErrorMessage, explorerErrorTitle).WaitSpecial(); } } catch (CompositionException e) { var found = FindException(e); if (found != null) { _dialogManager.ExceptionDialog(found, explorerErrorMessage, explorerErrorTitle); } } catch (ActivationException e) { var found = e.FindInnerException <Win32Exception>(); if (found != null) { _dialogManager.ExceptionDialog(found, explorerErrorMessage, explorerErrorTitle).WaitSpecial(); } } return(new CompositeDisposable()); }
async Task <Server> TryFindOrCreateServer(ServerAddress str) { try { return(ServerList.FindOrCreateServer(str)); } catch (SocketException e) { await _dialogManager.ExceptionDialog(e, "Failed to add server, is the address valid?"); } catch (ArgumentException e) { await _dialogManager.ExceptionDialog(e, "Failed to add server, is the address valid?"); } return(null); }
async Task InstallToolsIfNeeded() { try { await TryInstallToolsIfNeeded().ConfigureAwait(false); } catch (Exception e) { await _dialogManager.ExceptionDialog(e, "Tools failed to download, Play withSIX will not function correctly without these files. " + "Verify that your Internet connection is working and restart to try again.", "A problem occurred during tools download").ConfigureAwait(false); await UserErrorHandler.HandleUserError(new InformationalUserError(e, "A problem occurred during tools download", null)); } }