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

Commit 9200a9a

Browse files
committed
move CanShow to base class, document wait functionality
1 parent 7d6a11e commit 9200a9a

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

src/GitHub.VisualStudio/Menus/BlameLink.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,5 @@ public async void Activate([AllowNull]object data = null)
3131

3232
await UsageTracker.IncrementOpenInGitHubCount();
3333
}
34-
35-
public bool CanShow()
36-
{
37-
var githubRepoCheckTask = IsGitHubRepo();
38-
return githubRepoCheckTask.Wait(250) ? githubRepoCheckTask.Result : false;
39-
}
4034
}
4135
}

src/GitHub.VisualStudio/Menus/CopyLink.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,5 @@ public async void Activate([AllowNull]object data = null)
4040
ns?.ShowMessage(Resources.Error_FailedToCopyToClipboard);
4141
}
4242
}
43-
44-
public bool CanShow()
45-
{
46-
var githubRepoCheckTask = IsGitHubRepo();
47-
return githubRepoCheckTask.Wait(250) ? githubRepoCheckTask.Result : false;
48-
}
49-
5043
}
5144
}

src/GitHub.VisualStudio/Menus/LinkMenuBase.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,12 @@ protected Task<UriString> GenerateLink(LinkType linkType)
2626
return null;
2727
return repo.GenerateUrl(linkType, activeDocument.Name, activeDocument.StartLine, activeDocument.EndLine);
2828
}
29+
30+
public bool CanShow()
31+
{
32+
var githubRepoCheckTask = IsGitHubRepo();
33+
//Set max of 250ms wait time to prevent UI blocking
34+
return githubRepoCheckTask.Wait(250) ? githubRepoCheckTask.Result : false;
35+
}
2936
}
3037
}

src/GitHub.VisualStudio/Menus/OpenLink.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,5 @@ public async void Activate([AllowNull]object data = null)
2929

3030
await UsageTracker.IncrementOpenInGitHubCount();
3131
}
32-
33-
public bool CanShow()
34-
{
35-
var githubRepoCheckTask = IsGitHubRepo();
36-
return githubRepoCheckTask.Wait(250) ? githubRepoCheckTask.Result : false;
37-
}
3832
}
3933
}

0 commit comments

Comments
 (0)