加载项:在打开选项对话框时,Solution Explorer不会重绘SC字形 [英] Add-In: Solution Explorer doesn't redraw SC glyphs while options dialog is open

查看:51
本文介绍了加载项:在打开选项对话框时,Solution Explorer不会重绘SC字形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我正在为Visual Studio 2010/2012开发源代码控制插件.我的工作机上安装了Windows 7.我已经调试了我的开发,将vsix内容部署到Visual Studio 2012的实验实例中.

I'm developing source control plugin for Visual Studio 2010/2012. My work machine has Windows 7 installed on it. I've debug my development my deploying vsix content into experimental intance of Visual Studio 2012.

激活/停用插件后,它将为解决方案项设置自定义标志符号,以进行更改跟踪指示.为此,我列举了通过以下代码检索的IVsHierarchy:

When plugin is activated/deactivated, it set custom glyphs to solution items for changes tracking indication. To achieve that I enumerate IVsHierarchy which is retrieved by such code:

(IVsSolution)Package.GetGlobalService(typeof(SVsSolution))

每个节点字形刷新如下:

Each node glyph is refreshed as follows:

uint itemId = ...
uint fileStatus = ...
VsStateIcon glyph = ...
var project = hierarchy as IVsSccProject2;
if (project != null)
    project.SccGlyphChanged(1, new[] { itemId }, new[] { glyph }, new [] { fileStatus });
else
    hierarchy.SetProperty(itemId, (int)__VSHPROPID.VSHPROPID_StateIconIndex, glyph);

一切都很好,但是最近我遇到了一个问题,可以重现如下:

Everything is fine, but recently I've encountered a problem, that can be reproduced as following:

  1. 开始调试插件(确保不会显示解决方案资源管理器"窗口).
  2. 转到工具->".选项"
  3. 选择源代码控制"
  4. 选中我的插件源控件,然后取消选择它.
  5. 通过确定"按钮关闭选项对话框.
  6. 转到"查看->解决方案资源管理器"
  7. 解决方案资源管理器"窗口打开,并且没有自定义字形(这是预期的).
  8. 转到工具->选项"在主菜单中选择源代码控制"再次单击节点.
  9. 然后选择我的插件.此时,我的插件收到了Microsoft.VisualStudio.Shell.Interop.IVsSccProvider.SetActive()调用,并按前面所述分配了自定义字形.
  10. 关闭选项对话框.
  1. Start debugging of plugin (make sure that no Solution Explorer window will be displayed).
  2. Go to "Tools -> Options" main menu.
  3. Select "Source control" node in the tree to the left.
  4. My plugin source control is selected, then I deselect it.
  5. Close options dialog by OK button.
  6. Go to "View -> Solution Explorer" main menu.
  7. Solution explorer window opens and there is no custom glyphs (this is expected).
  8. Go to "Tools -> Options" main menu and select "Source control" node again.
  9. Then I select my plugin. At this time Microsoft.VisualStudio.Shell.Interop.IVsSccProvider.SetActive() call is received by my plugin and custom glyphs are assigned as was described before.
  10. Close options dialog.

现在,我希望我的自定义字形将显示在解决方案资源管理器中,但事实并非如此.如果我对SE感到有些困惑,请展开/折叠节点并前后滚动,字形就会开始出现在项目上.

Now I expect my custom glyphs to be displayed in Solution Explorer, but they aren't. If I mess a little with SE, expand/collapse nodes and scroll it down and forth, glyphs start appear on items.

但是,如果层次结构枚举延迟到关闭选项对话框的那一刻,字形就会按预期显示.但是,我无法以任何方式知道何时关闭选项对话框.

However if hierarchy enumeration is delayed to the moment when options dialog is closed, glyphs appear as expected. But I can't figure any way to know when options dialog is closed.

也许有人可以帮助我解决这个问题?

Maybe someone can help me with this issue?

推荐答案

我在解决方案资源管理器中遇到类似的问题,也无法解决.是众所周知的VS错误,还是我们做错了什么?任何可能的解决方法?
I have the similar issue with Solution Explorer and can't solve it as well. Is it a well known VS bug or we are doing something wrong? Any possible workarounds?


这篇关于加载项:在打开选项对话框时,Solution Explorer不会重绘SC字形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆