Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit dd6d3f8

Browse files
committed
Added/updated view model XML docs.
And removed unused classes and members.
1 parent aa85e58 commit dd6d3f8

File tree

9 files changed

+139
-40
lines changed

9 files changed

+139
-40
lines changed

src/GitHub.App/SampleData/PullRequestListItemViewModelDesigner.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public class PullRequestListItemViewModelDesigner : ViewModelBase, IPullRequestL
1313
public IActorViewModel Author { get; set; }
1414
public int CommentCount { get; set; }
1515
public bool IsCurrent { get; set; }
16-
public IReadOnlyList<ILabelViewModel> Labels { get; set; }
1716
public int Number { get; set; }
1817
public string Title { get; set; }
1918
public DateTimeOffset UpdatedAt { get; set; }

src/GitHub.App/ViewModels/GitHubPane/IssueListViewModelBase.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
namespace GitHub.ViewModels.GitHubPane
1818
{
19+
/// <summary>
20+
/// A view model which implements the functionality common to issue and pull request lists.
21+
/// </summary>
1922
public abstract class IssueListViewModelBase : PanePageViewModelBase, IIssueListViewModelBase
2023
{
2124
readonly IRepositoryService repositoryService;
@@ -31,66 +34,82 @@ public abstract class IssueListViewModelBase : PanePageViewModelBase, IIssueList
3134
int numberFilter;
3235
IUserFilterViewModel authorFilter;
3336

37+
/// <summary>
38+
/// Initializes a new instance of the <see cref="IssueListViewModelBase"/> class.
39+
/// </summary>
40+
/// <param name="repositoryService">The repository service.</param>
3441
public IssueListViewModelBase(IRepositoryService repositoryService)
3542
{
3643
this.repositoryService = repositoryService;
3744
OpenItem = ReactiveCommand.CreateAsyncTask(OpenItemImpl);
3845
}
3946

47+
/// <inheritdoc/>
4048
public IUserFilterViewModel AuthorFilter
4149
{
4250
get { return authorFilter; }
4351
private set { this.RaiseAndSetIfChanged(ref authorFilter, value); }
4452
}
4553

54+
/// <inheritdoc/>
4655
public IReadOnlyList<IRepositoryModel> Forks
4756
{
4857
get { return forks; }
4958
set { this.RaiseAndSetIfChanged(ref forks, value); }
5059
}
5160

61+
/// <inheritdoc/>
5262
public IReadOnlyList<IIssueListItemViewModelBase> Items
5363
{
5464
get { return items; }
5565
private set { this.RaiseAndSetIfChanged(ref items, value); }
5666
}
5767

68+
/// <inheritdoc/>
5869
public ICollectionView ItemsView
5970
{
6071
get { return itemsView; }
6172
private set { this.RaiseAndSetIfChanged(ref itemsView, value); }
6273
}
6374

75+
/// <inheritdoc/>
6476
public ILocalRepositoryModel LocalRepository { get; private set; }
6577

78+
/// <inheritdoc/>
6679
public IssueListMessage Message
6780
{
6881
get { return message; }
6982
private set { this.RaiseAndSetIfChanged(ref message, value); }
7083
}
7184

85+
/// <inheritdoc/>
7286
public IRepositoryModel RemoteRepository
7387
{
7488
get { return remoteRepository; }
7589
set { this.RaiseAndSetIfChanged(ref remoteRepository, value); }
7690
}
7791

92+
/// <inheritdoc/>
7893
public string SearchQuery
7994
{
8095
get { return searchQuery; }
8196
set { this.RaiseAndSetIfChanged(ref searchQuery, value); }
8297
}
8398

99+
/// <inheritdoc/>
84100
public string SelectedState
85101
{
86102
get { return selectedState; }
87103
set { this.RaiseAndSetIfChanged(ref selectedState, value); }
88104
}
89105

106+
/// <inheritdoc/>
90107
public abstract IReadOnlyList<string> States { get; }
91108

109+
/// <inheritdoc/>
92110
public ReactiveCommand<Unit> OpenItem { get; }
93111

112+
/// <inheritdoc/>
94113
public async Task InitializeAsync(ILocalRepositoryModel repository, IConnection connection)
95114
{
96115
LocalRepository = repository;
@@ -132,6 +151,10 @@ public async Task InitializeAsync(ILocalRepositoryModel repository, IConnection
132151
await Refresh();
133152
}
134153

154+
/// <summary>
155+
/// Refreshes the view model.
156+
/// </summary>
157+
/// <returns>A task tracking the operation.</returns>
135158
public override Task Refresh()
136159
{
137160
subscription?.Dispose();
@@ -157,8 +180,24 @@ public override Task Refresh()
157180
return Task.CompletedTask;
158181
}
159182

183+
/// <summary>
184+
/// When overridden in a derived class, creates the <see cref="IVirtualizingListSource{T}"/>
185+
/// that will act as the source for <see cref="Items"/>.
186+
/// </summary>
160187
protected abstract IVirtualizingListSource<IIssueListItemViewModelBase> CreateItemSource();
188+
189+
/// <summary>
190+
/// When overridden in a derived class, navigates to the specified item.
191+
/// </summary>
192+
/// <param name="item">The item.</param>
193+
/// <returns>A task tracking the operation.</returns>
161194
protected abstract Task DoOpenItem(IIssueListItemViewModelBase item);
195+
196+
/// <summary>
197+
/// Loads a page of authors for the <see cref="AuthorFilter"/>.
198+
/// </summary>
199+
/// <param name="after">The GraphQL "after" cursor.</param>
200+
/// <returns>A task that returns a page of authors.</returns>
162201
protected abstract Task<Page<ActorModel>> LoadAuthors(string after);
163202

164203
void FilterChanged()
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
using System;
2-
using System.Collections.Generic;
32
using GitHub.Models;
43
using ReactiveUI;
54

65
namespace GitHub.ViewModels.GitHubPane
76
{
7+
/// <summary>
8+
/// A view model which displays an item in a <see cref="PullRequestListViewModel"/>.
9+
/// </summary>
810
public class PullRequestListItemViewModel : ViewModelBase, IPullRequestListItemViewModel
911
{
1012
bool isCurrent;
1113

14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="PullRequestListItemViewModel"/> class.
16+
/// </summary>
17+
/// <param name="model">The underlying pull request item model.</param>
1218
public PullRequestListItemViewModel(PullRequestListItemModel model)
1319
{
1420
Id = model.Id;
@@ -19,24 +25,29 @@ public PullRequestListItemViewModel(PullRequestListItemModel model)
1925
UpdatedAt = model.UpdatedAt;
2026
}
2127

28+
/// <inheritdoc/>
2229
public string Id { get; protected set; }
2330

31+
/// <inheritdoc/>
2432
public IActorViewModel Author { get; protected set; }
2533

34+
/// <inheritdoc/>
2635
public int CommentCount { get; protected set; }
2736

37+
/// <inheritdoc/>
2838
public bool IsCurrent
2939
{
3040
get { return isCurrent; }
3141
internal set { this.RaiseAndSetIfChanged(ref isCurrent, value); }
3242
}
3343

34-
public IReadOnlyList<ILabelViewModel> Labels { get; protected set; }
35-
44+
/// <inheritdoc/>
3645
public int Number { get; protected set; }
3746

47+
/// <inheritdoc/>
3848
public string Title { get; protected set; }
3949

50+
/// <inheritdoc/>
4051
public DateTimeOffset UpdatedAt { get; protected set; }
4152
}
4253
}

src/GitHub.App/ViewModels/GitHubPane/PullRequestListViewModel.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
namespace GitHub.ViewModels.GitHubPane
1515
{
16+
/// <summary>
17+
/// A view model which displays a pull request list.
18+
/// </summary>
1619
[Export(typeof(IPullRequestListViewModel))]
1720
[PartCreationPolicy(CreationPolicy.NonShared)]
1821
public class PullRequestListViewModel : IssueListViewModelBase, IPullRequestListViewModel
@@ -22,6 +25,12 @@ public class PullRequestListViewModel : IssueListViewModelBase, IPullRequestList
2225
readonly IPullRequestService service;
2326
readonly IDisposable subscription;
2427

28+
/// <summary>
29+
/// Initializes a new instance of the <see cref="PullRequestListViewModel"/> class.
30+
/// </summary>
31+
/// <param name="sessionManager">The session manager.</param>
32+
/// <param name="repositoryService">The repository service.</param>
33+
/// <param name="service">The pull request service.</param>
2534
[ImportingConstructor]
2635
public PullRequestListViewModel(
2736
IPullRequestSessionManager sessionManager,
@@ -39,22 +48,27 @@ public PullRequestListViewModel(
3948
CreatePullRequest = ReactiveCommand.Create().OnExecuteCompleted(_ => NavigateTo("pull/new"));
4049
}
4150

51+
/// <inheritdoc/>
4252
public override IReadOnlyList<string> States => states;
4353

54+
/// <inheritdoc/>
4455
public ReactiveCommand<object> CreatePullRequest { get; }
4556

57+
/// <inheritdoc/>
4658
protected override IVirtualizingListSource<IIssueListItemViewModelBase> CreateItemSource()
4759
{
4860
return new ItemSource(this);
4961
}
5062

63+
/// <inheritdoc/>
5164
protected override Task DoOpenItem(IIssueListItemViewModelBase item)
5265
{
5366
var i = (IPullRequestListItemViewModel)item;
5467
NavigateTo(Invariant($"{RemoteRepository.Owner}/{RemoteRepository.Name}/pull/{i.Number}"));
5568
return Task.CompletedTask;
5669
}
5770

71+
/// <inheritdoc/>
5872
protected override Task<Page<ActorModel>> LoadAuthors(string after)
5973
{
6074
return service.ReadAssignableUsers(

src/GitHub.Exports.Reactive/ViewModels/GitHubPane/IIssueListViewModelBase.cs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,98 @@
88

99
namespace GitHub.ViewModels.GitHubPane
1010
{
11+
/// <summary>
12+
/// Describes a message that should be displayed in place of a list of items in
13+
/// an <see cref="IIssueListItemViewModelBase"/>.
14+
/// </summary>
1115
public enum IssueListMessage
1216
{
17+
/// <summary>
18+
/// No message should be displayed; the items should be displayed.
19+
/// </summary>
1320
None,
21+
22+
/// <summary>
23+
/// A "No Open Items" message should be displayed.
24+
/// </summary>
1425
NoOpenItems,
26+
27+
/// <summary>
28+
/// A "No Items Match Search Criteria" message should be displayed.
29+
/// </summary>
1530
NoItemsMatchCriteria,
1631
}
1732

33+
/// <summary>
34+
/// Represents a view model which displays an issue or pull request list.
35+
/// </summary>
1836
public interface IIssueListViewModelBase : ISearchablePageViewModel
1937
{
38+
/// <summary>
39+
/// Gets the filter view model.
40+
/// </summary>
2041
IUserFilterViewModel AuthorFilter { get; }
2142

43+
/// <summary>
44+
/// Gets a list consisting of the fork and parent repositories if the current repository is
45+
/// a fork.
46+
/// </summary>
47+
/// <remarks>
48+
/// Returns null if the current repository is not a fork.
49+
/// </remarks>
2250
IReadOnlyList<IRepositoryModel> Forks { get; }
2351

52+
/// <summary>
53+
/// Gets the list of issues or pull requests.
54+
/// </summary>
2455
IReadOnlyList<IIssueListItemViewModelBase> Items { get; }
2556

57+
/// <summary>
58+
/// Gets a filtered view of <see cref="Items"/> based on <see cref="SearchQuery"/> and
59+
/// <see cref="AuthorFilter"/>.
60+
/// </summary>
2661
ICollectionView ItemsView { get; }
2762

63+
/// <summary>
64+
/// Gets the local repository.
65+
/// </summary>
2866
ILocalRepositoryModel LocalRepository { get; }
2967

68+
/// <summary>
69+
/// Gets an enum indicating a message that should be displayed in place of a list of items.
70+
/// </summary>
3071
IssueListMessage Message { get; }
3172

73+
/// <summary>
74+
/// Gets the remote repository.
75+
/// </summary>
76+
/// <remarks>
77+
/// This may differ from <see cref="LocalRepository"/> if <see cref="LocalRepository"/> is
78+
/// a fork.
79+
/// </remarks>
3280
IRepositoryModel RemoteRepository { get; set; }
3381

82+
/// <summary>
83+
/// Gets the currently selected item in <see cref="States"/>.
84+
/// </summary>
3485
string SelectedState { get; set; }
3586

87+
/// <summary>
88+
/// Gets a list of the available states (e.g. Open, Closed, All).
89+
/// </summary>
3690
IReadOnlyList<string> States { get; }
3791

92+
/// <summary>
93+
/// Gets a command which opens the item passed as a parameter.
94+
/// </summary>
3895
ReactiveCommand<Unit> OpenItem { get; }
3996

97+
/// <summary>
98+
/// Initializes the view model.
99+
/// </summary>
100+
/// <param name="repository">The local repository.</param>
101+
/// <param name="connection">The connection/</param>
102+
/// <returns>A task tracking the operation.</returns>
40103
Task InitializeAsync(ILocalRepositoryModel repository, IConnection connection);
41104
}
42105
}

src/GitHub.Exports.Reactive/ViewModels/GitHubPane/IPullRequestListItemViewModel.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32

43
namespace GitHub.ViewModels.GitHubPane
54
{
@@ -9,12 +8,12 @@ namespace GitHub.ViewModels.GitHubPane
98
public interface IPullRequestListItemViewModel : IIssueListItemViewModelBase
109
{
1110
/// <summary>
12-
/// Gets the ID of the issue or pull request.
11+
/// Gets the ID of the pull request.
1312
/// </summary>
1413
string Id { get; }
1514

1615
/// <summary>
17-
/// Gets the number of comments in the issue or pull request.
16+
/// Gets the number of comments in the pull request.
1817
/// </summary>
1918
int CommentCount { get; }
2019

@@ -25,12 +24,7 @@ public interface IPullRequestListItemViewModel : IIssueListItemViewModelBase
2524
bool IsCurrent { get; }
2625

2726
/// <summary>
28-
/// Gets the labels applied to the issue or pull request.
29-
/// </summary>
30-
IReadOnlyList<ILabelViewModel> Labels { get; }
31-
32-
/// <summary>
33-
/// Gets the last updated time of the issue or pull request.
27+
/// Gets the last updated time of the pull request.
3428
/// </summary>
3529
DateTimeOffset UpdatedAt { get; }
3630
}
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
using System;
2-
using System.Reactive;
32
using ReactiveUI;
43

54
namespace GitHub.ViewModels.GitHubPane
65
{
6+
/// <summary>
7+
/// Represents a view model which displays a pull request list.
8+
/// </summary>
79
public interface IPullRequestListViewModel : IIssueListViewModelBase
810
{
11+
/// <summary>
12+
/// Gets a command which navigates to the "Create Pull Request" view.
13+
/// </summary>
914
ReactiveCommand<object> CreatePullRequest { get; }
1015
}
1116
}

0 commit comments

Comments
 (0)