Beispiel #1
0
 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);
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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;
            }
        }