Ejemplo n.º 1
0
 IObservable <ProgressState> OnLogout(object unused)
 {
     return(DoLogout().ToObservable()
            .Select(_ => ProgressState.Success)
            .Catch <ProgressState, Exception>(ex =>
     {
         if (!ex.IsCriticalException())
         {
             log.Error(ex);
             var error = StandardUserErrors.GetUserFriendlyErrorMessage(ex, ErrorType.LogoutFailed);
             notificationService.ShowError(error);
         }
         return Observable.Return(ProgressState.Fail);
     }));
 }
Ejemplo n.º 2
0
        IObservable <Gist> OnCreateGist(object unused)
        {
            var newGist = new NewGist
            {
                Description = Description,
                Public      = !IsPrivate
            };

            newGist.Files.Add(FileName, SelectedText);

            return(gistPublishService.PublishGist(apiClient, newGist)
                   .Catch <Gist, Exception>(ex =>
            {
                if (!ex.IsCriticalException())
                {
                    log.Error(ex);
                    var error = StandardUserErrors.GetUserFriendlyErrorMessage(ex, ErrorType.GistCreateFailed);
                    notificationService.ShowError(error);
                }
                return Observable.Return <Gist>(null);
            }));
        }
Ejemplo n.º 3
0
        IObservable <Gist> OnCreateGist()
        {
            var newGist = new NewGist
            {
                Description = Description,
                Public      = !IsPrivate
            };

            newGist.Files.Add(FileName, SelectedText);

            return(gistPublishService.PublishGist(apiClient, newGist)
                   .Do(_ => usageTracker.IncrementCounter(x => x.NumberOfGists).Forget())
                   .Catch <Gist, Exception>(ex =>
            {
                if (!ex.IsCriticalException())
                {
                    log.Error(ex, "Error Creating Gist");
                    var error = StandardUserErrors.GetUserFriendlyErrorMessage(ex, ErrorType.GistCreateFailed);
                    notificationService.ShowError(error);
                }
                return Observable.Return <Gist>(null);
            }));
        }