本文整理汇总了C#中IVsHierarchy.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# IVsHierarchy.Equals方法的具体用法?C# IVsHierarchy.Equals怎么用?C# IVsHierarchy.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsHierarchy
的用法示例。
在下文中一共展示了IVsHierarchy.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnregisterHierarchy
public void UnregisterHierarchy(IVsHierarchy hierarchy)
{
if ((null == hierarchy) || !_hierarchies.ContainsKey(hierarchy))
return;
HierarchyListener listener = _hierarchies[hierarchy];
if (null != listener)
listener.Dispose();
_hierarchies.Remove(hierarchy);
if (0 == _hierarchies.Count)
UnregisterRDTEvents();
lock (_files)
{
ModuleID[] keys = new ModuleID[_files.Keys.Count];
_files.Keys.CopyTo(keys, 0);
foreach (ModuleID id in keys)
{
if (hierarchy.Equals(id.Hierarchy))
{
_library.RemoveNode(_files[id]);
_files.Remove(id);
}
}
}
// Remove the document listeners.
//
uint[] docKeys = new uint[_documents.Keys.Count];
_documents.Keys.CopyTo(docKeys, 0);
foreach (uint id in docKeys)
{
TextLineEventListener docListener = _documents[id];
if (hierarchy.Equals(docListener.FileID.Hierarchy))
{
_documents.Remove(id);
docListener.Dispose();
}
}
}
示例2:
/// <summary>
/// Monitor for changes to the active project and notify the topic previewer user control when a
/// new SHFB project is selected as the active project.
/// </summary>
/// <param name="pHierOld">The hierarchy for the previously selected item</param>
/// <param name="itemidOld">Project item identifier for the previously selected item</param>
/// <param name="pMISOld">Interface for previous multi-selection items</param>
/// <param name="pSCOld">Interface for the previous selection container</param>
/// <param name="pHierNew">The hierarchy for the new selection</param>
/// <param name="itemidNew">Project item identifier for the new selection</param>
/// <param name="pMISNew">Interface for new multi-selection items</param>
/// <param name="pSCNew">Interface for the new selection container</param>
/// <returns></returns>
int IVsSelectionEvents.OnSelectionChanged(IVsHierarchy pHierOld, uint itemidOld,
IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld, IVsHierarchy pHierNew, uint itemidNew,
IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew)
{
SandcastleProject shfbProject = null;
object project;
if(pHierOld == null || !pHierOld.Equals(pHierNew))
{
if(ucTopicPreviewer != null)
{
if(pHierNew != null)
{
ErrorHandler.ThrowOnFailure(pHierNew.GetProperty(VSConstants.VSITEMID_ROOT,
(int)__VSHPROPID.VSHPROPID_ExtObject, out project));
EnvDTE.Project envDTEProject = project as EnvDTE.Project;
if(envDTEProject != null)
{
SandcastleBuilderProjectNode projectNode =
envDTEProject.Object as SandcastleBuilderProjectNode;
if(projectNode != null)
shfbProject = projectNode.SandcastleProject;
}
}
// We'll keep the existing reference unless it changes or the project is closed
if((shfbProject == null && pHierNew == null && ucTopicPreviewer.CurrentProject != null) ||
(shfbProject != null && (ucTopicPreviewer.CurrentProject == null ||
ucTopicPreviewer.CurrentProject.Filename != shfbProject.Filename)))
ucTopicPreviewer.CurrentProject = shfbProject;
}
}
return VSConstants.S_OK;
}
示例3: UnregisterHierarchy
public void UnregisterHierarchy(IVsHierarchy hierarchy)
{
if ((null == hierarchy) || !hierarchies.ContainsKey(hierarchy)) {
return;
}
HierarchyListener listener = hierarchies[hierarchy];
if (null != listener) {
listener.Dispose();
}
hierarchies.Remove(hierarchy);
if (0 == hierarchies.Count) {
UnregisterRDTEvents();
}
lock (files) {
ModuleId[] keys = new ModuleId[files.Keys.Count];
files.Keys.CopyTo(keys, 0);
foreach (ModuleId id in keys) {
if (hierarchy.Equals(id.Hierarchy)) {
library.RemoveNode(files[id]);
files.Remove(id);
}
}
}
// Remove the document listeners.
uint[] docKeys = new uint[documents.Keys.Count];
documents.Keys.CopyTo(docKeys, 0);
foreach (uint id in docKeys) {
TextLineEventListener docListener = documents[id];
if (hierarchy.Equals(docListener.FileID.Hierarchy)) {
documents.Remove(id);
docListener.Dispose();
}
}
}