public static TValue Guard <TException, TValue>(Func <TValue> lambda, IInteractionService interactionService) where TException : Exception { try { return(lambda()); } catch (Exception e) { if (e is TException) { interactionService.ShowError(e.Message, e); return(default);
protected override void OnLoadOptions(string key, System.IO.Stream stream) { Dispatcher.CurrentDispatcher.VerifyAccess(); if (key.Equals(OptionSolutionProfiles)) { var settings = GetSettings(); if (settings.Storage == ProjectSetProfileStorage.Solution) { try { m_repository.LoadBinary(stream, GetSolutionManager()); } catch (Exception ex) { m_interactionService.ShowError("Error loading profile configuration from solution:\r\n{0}", ex.Message); } } } else { base.OnLoadOptions(key, stream); } }
public static void Guard <TException>(Action lambda, IInteractionService interactionService) where TException : Exception { try { lambda(); } catch (Exception e) { if (e is TException) { interactionService.ShowError(e.Message, e); return; } throw; } }