How to update / refresh glyphs programmatically in Solution Explorer?
See the question and my original answer on StackOverflowIf you have a package, you are supposed to implement the IVsHierarchy interface. When you do so, you must implement the AdviseHiearchyEvents method. In this method, you must add the passed in sink to a collection you keep, something like this:
int IVsUIHierarchy.AdviseHierarchyEvents(IVsHierarchyEvents eventSink, out uint cookie)
{
cookie = _sinkCookie++; // come up with some unique cookie
_eventSinks.Add(cookie, eventSink); // remember this sink
return VSConstants.S_OK;
}
int IVsUIHierarchy.UnadviseHierarchyEvents(uint cookie)
{
_eventSinks.Remove(cookie);
return VSConstants.S_OK;
}
And now, you can raise property changed events when you need, like this:
private void NotifySccChange()
{
foreach (sink in _eventSinks)
{
try
{
sink.OnPropertyChanged(MyId, (int)__VSHPROPID.VSHPROPID_StateIconIndex, 0);
}
catch (Exception e)
{
SinkIsDead(sink);
}
}
}