public int OnSelectionChanged(IVsHierarchy pHierOld, uint itemidOld, IVsMultiItemSelect pMisOld, ISelectionContainer pScOld, IVsHierarchy pHierNew, uint itemidNew, IVsMultiItemSelect pMisNew, ISelectionContainer pScNew) { uint count = 0; pScNew?.CountObjects((uint)Microsoft.VisualStudio.Shell.Interop.Constants.GETOBJS_SELECTED, out count); if (count == 1) { var obj = new object[1]; pScNew?.GetObjects((uint)Microsoft.VisualStudio.Shell.Interop.Constants.GETOBJS_SELECTED, 1, obj); var item = obj[0]; if (item != null && item.GetType().Name == "DynamicTypeBrowseObjectFolder") { _findSelectorModel.LoadSelectedFolder(); } } return(VSConstants.S_OK); }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void MenuItemCallback(object sender, EventArgs e) { _findSelectorModel.LoadSelectedFolder(); _findSelectorModel?.Load(); }