コード例 #1
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);
            }));
        }
コード例 #2
0
ファイル: GistCreationViewModel.cs プロジェクト: ehmz11/aaa
        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);
            }));
        }