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

Commit 2f6b7d9

Browse files
committed
Added RepositoryOrigin.Unknown
Make the `RepositoryOrigin` property non-nullable and use `RepositoryOrigin.Unknown` as the unknown value.
1 parent ef3c597 commit 2f6b7d9

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/GitHub.VisualStudio.UI/RepositoryOrigin.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
public enum RepositoryOrigin
44
{
5+
Unknown,
56
DotCom,
67
Enterprise,
78
Other,

src/GitHub.VisualStudio/UI/Views/GitHubPaneViewModel.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected override void RepoChanged(bool changed)
110110
return;
111111

112112
Stop();
113-
RepositoryOrigin = null;
113+
RepositoryOrigin = RepositoryOrigin.Unknown;
114114
Reload().Forget();
115115
}
116116

@@ -130,7 +130,7 @@ async Task Reload([AllowNull] ViewWithData data = null, bool navigating = false)
130130

131131
navigatingViaArrows = navigating;
132132

133-
if (!RepositoryOrigin.HasValue)
133+
if (RepositoryOrigin == RepositoryOrigin.Unknown)
134134
{
135135
var origin = await GetRepositoryOrigin();
136136
if (reloadCallId != latestReloadCallId)
@@ -154,11 +154,11 @@ async Task Reload([AllowNull] ViewWithData data = null, bool navigating = false)
154154
IsLoggedIn = isLoggedIn;
155155
}
156156

157-
if (RepositoryOrigin.Value == UI.RepositoryOrigin.NonGitRepository)
157+
if (RepositoryOrigin == UI.RepositoryOrigin.NonGitRepository)
158158
{
159159
LoadView(UIViewType.NotAGitRepository);
160160
}
161-
else if (RepositoryOrigin.Value == UI.RepositoryOrigin.Other)
161+
else if (RepositoryOrigin == UI.RepositoryOrigin.Other)
162162
{
163163
LoadView(UIViewType.NotAGitHubRepository);
164164
}
@@ -340,8 +340,8 @@ public bool IsLoggedIn
340340
set { isLoggedIn = value; this.RaisePropertyChange(); }
341341
}
342342

343-
RepositoryOrigin? repositoryOrigin;
344-
public RepositoryOrigin? RepositoryOrigin
343+
RepositoryOrigin repositoryOrigin;
344+
public RepositoryOrigin RepositoryOrigin
345345
{
346346
get { return repositoryOrigin; }
347347
private set { repositoryOrigin = value; }
@@ -351,10 +351,10 @@ public bool? IsGitHubRepo
351351
{
352352
get
353353
{
354-
return repositoryOrigin.HasValue ?
355-
repositoryOrigin.Value == UI.RepositoryOrigin.DotCom ||
356-
repositoryOrigin.Value == UI.RepositoryOrigin.Enterprise :
357-
(bool?)null;
354+
return repositoryOrigin == RepositoryOrigin.Unknown ?
355+
(bool?)null :
356+
repositoryOrigin == UI.RepositoryOrigin.DotCom ||
357+
repositoryOrigin == UI.RepositoryOrigin.Enterprise;
358358
}
359359
}
360360

0 commit comments

Comments
 (0)