提交 c553f212 编写于 作者: C CyrusNajmabadi

Use patterns in more places.

上级 c9c199a1
...@@ -291,9 +291,8 @@ int IVsDropdownBarClient3.GetEntryImage(int iCombo, int iIndex, out int piImageI ...@@ -291,9 +291,8 @@ int IVsDropdownBarClient3.GetEntryImage(int iCombo, int iIndex, out int piImageI
// represents. That way the icon will always look right no matter which type of project // represents. That way the icon will always look right no matter which type of project
// it is. For example, if phone/Windows projects have different icons, then this can // it is. For example, if phone/Windows projects have different icons, then this can
// ensure we get the right icon, and not just a hardcoded C#/VB icon. // ensure we get the right icon, and not just a hardcoded C#/VB icon.
if (item is NavigationBarProjectItem) if (item is NavigationBarProjectItem projectItem)
{ {
var projectItem = (NavigationBarProjectItem)item;
if (_workspace.TryGetImageListAndIndex(_imageService, projectItem.DocumentId.ProjectId, out phImageList, out piImageIndex)) if (_workspace.TryGetImageListAndIndex(_imageService, projectItem.DocumentId.ProjectId, out phImageList, out piImageIndex))
{ {
return VSConstants.S_OK; return VSConstants.S_OK;
......
...@@ -219,9 +219,9 @@ internal override void GetDisplayData(VSTREEDISPLAYDATA[] pData) ...@@ -219,9 +219,9 @@ internal override void GetDisplayData(VSTREEDISPLAYDATA[] pData)
// If these are documents from a VS workspace, then attempt to get the right display // If these are documents from a VS workspace, then attempt to get the right display
// data from the underlying VSHierarchy and itemids for the document. // data from the underlying VSHierarchy and itemids for the document.
var workspace = document.Project.Solution.Workspace; var workspace = document.Project.Solution.Workspace;
if (workspace is VisualStudioWorkspaceImpl) if (workspace is VisualStudioWorkspaceImpl vsWorkspace)
{ {
if (((VisualStudioWorkspaceImpl)workspace).TryGetImageListAndIndex(_imageService, document.Id, out pData[0].hImageList, out pData[0].Image)) if (vsWorkspace.TryGetImageListAndIndex(_imageService, document.Id, out pData[0].hImageList, out pData[0].Image))
{ {
pData[0].SelectedImage = pData[0].Image; pData[0].SelectedImage = pData[0].Image;
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册