/// <summary> /// Initializes a new instance of the <see cref="InlineCommentPeekViewModel"/> class. /// </summary> public InlineCommentPeekViewModel( IInlineCommentPeekService peekService, IPeekSession peekSession, IPullRequestSessionManager sessionManager, INextInlineCommentCommand nextCommentCommand, IPreviousInlineCommentCommand previousCommentCommand) { Guard.ArgumentNotNull(peekService, nameof(peekService)); Guard.ArgumentNotNull(peekSession, nameof(peekSession)); Guard.ArgumentNotNull(sessionManager, nameof(sessionManager)); Guard.ArgumentNotNull(nextCommentCommand, nameof(nextCommentCommand)); Guard.ArgumentNotNull(previousCommentCommand, nameof(previousCommentCommand)); this.peekService = peekService; this.peekSession = peekSession; this.sessionManager = sessionManager; triggerPoint = peekSession.GetTriggerPoint(peekSession.TextView.TextBuffer); peekSession.Dismissed += (s, e) => Dispose(); NextComment = ReactiveCommand.CreateAsyncTask( Observable.Return(nextCommentCommand.Enabled), _ => nextCommentCommand.Execute(new InlineCommentNavigationParams { FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1, })); PreviousComment = ReactiveCommand.CreateAsyncTask( Observable.Return(previousCommentCommand.Enabled), _ => previousCommentCommand.Execute(new InlineCommentNavigationParams { FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1, })); }
public InlineCommentPeekableItemSource( IInlineCommentPeekService peekService, IPullRequestSessionManager sessionManager, INextInlineCommentCommand nextCommentCommand, IPreviousInlineCommentCommand previousCommentCommand) { this.peekService = peekService; this.sessionManager = sessionManager; this.nextCommentCommand = nextCommentCommand; this.previousCommentCommand = previousCommentCommand; }
public InlineCommentPeekableItemSourceProvider( IApiClientFactory apiClientFactory, IInlineCommentPeekService peekService, IPullRequestSessionManager sessionManager, INextInlineCommentCommand nextCommentCommand, IPreviousInlineCommentCommand previousCommentCommand) { this.apiClientFactory = apiClientFactory; this.peekService = peekService; this.sessionManager = sessionManager; this.nextCommentCommand = nextCommentCommand; this.previousCommentCommand = previousCommentCommand; }
public InlineCommentPeekableItemSourceProvider( IInlineCommentPeekService peekService, IPullRequestSessionManager sessionManager, INextInlineCommentCommand nextCommentCommand, IPreviousInlineCommentCommand previousCommentCommand, IViewViewModelFactory factory) { this.peekService = peekService; this.sessionManager = sessionManager; this.nextCommentCommand = nextCommentCommand; this.previousCommentCommand = previousCommentCommand; this.factory = factory; }
/// <summary> /// Initializes a new instance of the <see cref="InlineCommentPeekViewModel"/> class. /// </summary> public InlineCommentPeekViewModel(IInlineCommentPeekService peekService, IPeekSession peekSession, IPullRequestSessionManager sessionManager, INextInlineCommentCommand nextCommentCommand, IPreviousInlineCommentCommand previousCommentCommand, IViewViewModelFactory factory) { Guard.ArgumentNotNull(peekService, nameof(peekService)); Guard.ArgumentNotNull(peekSession, nameof(peekSession)); Guard.ArgumentNotNull(sessionManager, nameof(sessionManager)); Guard.ArgumentNotNull(nextCommentCommand, nameof(nextCommentCommand)); Guard.ArgumentNotNull(previousCommentCommand, nameof(previousCommentCommand)); Guard.ArgumentNotNull(factory, nameof(factory)); this.peekService = peekService; this.peekSession = peekSession; this.sessionManager = sessionManager; this.factory = factory; triggerPoint = peekSession.GetTriggerPoint(peekSession.TextView.TextBuffer); peekSession.Dismissed += (s, e) => Dispose(); Close = this.WhenAnyValue(x => x.Thread) .Where(x => x != null) .SelectMany(x => x.IsNewThread ? x.Comments.Single().CancelEdit.SelectUnit() : Observable.Never <Unit>()); NextComment = ReactiveCommand.CreateFromTask( () => nextCommentCommand.Execute(new InlineCommentNavigationParams { FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1, }), Observable.Return(nextCommentCommand.Enabled)); PreviousComment = ReactiveCommand.CreateFromTask( () => previousCommentCommand.Execute(new InlineCommentNavigationParams { FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1, }), Observable.Return(previousCommentCommand.Enabled)); }