コード例 #1
0
        public InlineAnnotationViewModelDesigner()
        {
            var checkRunAnnotationModel = new CheckRunAnnotationModel
            {
                AnnotationLevel = CheckAnnotationLevel.Failure,
                Path            = "SomeFile.cs",
                EndLine         = 12,
                StartLine       = 12,
                Message         = "Some Error Message",
                Title           = "CS12345"
            };

            var checkRunModel =
                new CheckRunModel
            {
                Annotations = new List <CheckRunAnnotationModel> {
                    checkRunAnnotationModel
                },
                Name = "Fake Check Run"
            };

            var checkSuiteModel = new CheckSuiteModel()
            {
                ApplicationName = "Fake Check Suite",
                HeadSha         = "ed6198c37b13638e902716252b0a17d54bd59e4a",
                CheckRuns       = new List <CheckRunModel> {
                    checkRunModel
                }
            };

            Model = new InlineAnnotationModel(checkSuiteModel, checkRunModel, checkRunAnnotationModel);
        }
コード例 #2
0
        /// <summary>
        /// Initializes the <see cref="PullRequestAnnotationItemViewModel"/>.
        /// </summary>
        /// <param name="annotation">The check run annotation model.</param>
        /// <param name="isFileInPullRequest">A flag that denotes if the annotation is part of the pull request's changes.</param>
        /// <param name="checkSuite">The check suite model.</param>
        /// <param name="session">The pull request session.</param>
        /// <param name="editorService">The pull request editor service.</param>
        public PullRequestAnnotationItemViewModel(
            CheckRunAnnotationModel annotation,
            bool isFileInPullRequest,
            CheckSuiteModel checkSuite,
            IPullRequestSession session,
            IPullRequestEditorService editorService)
        {
            Annotation          = annotation;
            IsFileInPullRequest = isFileInPullRequest;

            OpenAnnotation = ReactiveCommand.CreateFromTask <Unit>(
                async _ => await editorService.OpenDiff(session, annotation.Path, checkSuite.HeadSha, annotation.EndLine - 1),
                Observable.Return(IsFileInPullRequest));
        }