This repository was archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathCommentThreadViewModel.cs
More file actions
53 lines (44 loc) · 1.69 KB
/
CommentThreadViewModel.cs
File metadata and controls
53 lines (44 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using GitHub.Extensions;
using GitHub.Models;
using ReactiveUI;
namespace GitHub.ViewModels
{
/// <summary>
/// Base view model for a thread of comments.
/// </summary>
public abstract class CommentThreadViewModel : ReactiveObject, ICommentThreadViewModel
{
readonly ReactiveList<ICommentViewModel> comments = new ReactiveList<ICommentViewModel>();
/// <summary>
/// Initializes a new instance of the <see cref="CommentThreadViewModel"/> class.
/// </summary>
[ImportingConstructor]
public CommentThreadViewModel()
{
}
/// <summary>
/// Intializes a new instance of the <see cref="CommentThreadViewModel"/> class.
/// </summary>
/// <param name="currentUser">The current user.</param>
protected Task InitializeAsync(ActorModel currentUser)
{
Guard.ArgumentNotNull(currentUser, nameof(currentUser));
CurrentUser = new ActorViewModel(currentUser);
return Task.CompletedTask;
}
/// <inheritdoc/>
public IReactiveList<ICommentViewModel> Comments => comments;
/// <inheritdoc/>
public IActorViewModel CurrentUser { get; private set; }
/// <inheritdoc/>
IReadOnlyReactiveList<ICommentViewModel> ICommentThreadViewModel.Comments => comments;
/// <inheritdoc/>
public abstract Task PostComment(string body);
/// <inheritdoc/>
public abstract Task EditComment(string id, string body);
/// <inheritdoc/>
public abstract Task DeleteComment(int pullRequestId, int commentId);
}
}