public async Task QuickRefreshNodesGlyphs(IVsSccProject2 project, List<string> files)
{
try
{
if (files.Count > 0)
{
string[] rgpszFullPaths = new string[files.Count];
for (int i = 0; i < files.Count; i++)
rgpszFullPaths[i] = files[i];
VsStateIcon[] rgsiGlyphs = new VsStateIcon[files.Count];
uint[] rgdwSccStatus = new uint[files.Count];
GetSccGlyph(files.Count, rgpszFullPaths, rgsiGlyphs, rgdwSccStatus);
uint[] rguiAffectedNodes = new uint[files.Count];
//TODO We could/Should cache this mapping !!!!
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
IList<uint> subnodes = await SolutionExtensions.GetProjectItems((IVsHierarchy)project, VSConstants.VSITEMID_ROOT);
var dict = new Dictionary<string, uint>();
var proj = project as IVsProject2;
foreach (var id in subnodes)
{
string docname;
var res = proj.GetMkDocument(id, out docname);
if (res == VSConstants.S_OK && !string.IsNullOrEmpty(docname))
dict[docname] = id;
}
for (int i = 0; i < files.Count; ++i)
{
uint id;
if (dict.TryGetValue(files[i], out id))
{
rguiAffectedNodes[i] = id;
}
}
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
project.SccGlyphChanged(files.Count, rguiAffectedNodes, rgsiGlyphs, rgdwSccStatus);
}
}
catch (Exception ex)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
IVsActivityLog log = _sccProvider.GetService(typeof(SVsActivityLog)) as IVsActivityLog;
if (log == null) return;
int hr = log.LogEntry((UInt32)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR,
ex.StackTrace,
string.Format(CultureInfo.CurrentCulture,
"Called for: {0}", this.ToString()));
}
}