You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: src/GitHub.App/SampleData/PullRequestDetailViewModelDesigner.cs
+65Lines changed: 65 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
+
usingSystem;
1
2
usingSystem.Diagnostics.CodeAnalysis;
3
+
usingSystem.Reactive;
4
+
usingGitHub.Models;
2
5
usingGitHub.ViewModels;
6
+
usingReactiveUI;
3
7
4
8
namespaceGitHub.SampleData
5
9
{
@@ -8,7 +12,68 @@ public class PullRequestDetailViewModelDesigner : BaseViewModel, IPullRequestDet
8
12
{
9
13
publicPullRequestDetailViewModelDesigner()
10
14
{
15
+
Model=newPullRequestModel(419,
16
+
"Error handling/bubbling from viewmodels to views to viewhosts",
17
+
newAccountDesigner{Login="shana",IsUser=true},
18
+
DateTime.Now.Subtract(TimeSpan.FromDays(3)))
19
+
{
20
+
State=PullRequestStateEnum.Open,
21
+
CommitCount=9,
22
+
};
11
23
24
+
SourceBranchDisplayName="shana/error-handling";
25
+
TargetBranchDisplayName="master";
26
+
Body=@"Adds a way to surface errors from the view model to the view so that view hosts can get to them.
27
+
28
+
ViewModels are responsible for handling the UI on the view they control, but they shouldn't be handling UI for things outside of the view. In this case, we're showing errors in VS outside the view, and that should be handled by the section that is hosting the view.
29
+
30
+
This requires that errors be propagated from the viewmodel to the view and from there to the host via the IView interface, since hosts don't usually know what they're hosting.
0 commit comments