public int OnAfterOpenSolution(object pUnkReserved, int fNewSolution)
 {
     if (!string.IsNullOrWhiteSpace(_dte.Solution.FullName))
     {
         var slnDirectory = Path.GetDirectoryName(_dte.Solution.FullName);
         if (TfsAutoShelve.IsValidWorkspace(slnDirectory))
         {
             InitializeAutoShelve(slnDirectory);
         }
     }
     return(0);
 }
 public int OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
 {
     if (_autoShelve == null || _autoShelve.Workspace == null)
     {
         object projectObj;
         pHierarchy.GetProperty(Microsoft.VisualStudio.VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out projectObj);
         var project = (Project)projectObj;
         if (project != null && !string.IsNullOrWhiteSpace(project.FullName))
         {
             var projDirectory = Path.GetDirectoryName(project.FullName);
             if (TfsAutoShelve.IsValidWorkspace(projDirectory))
             {
                 InitializeAutoShelve(projDirectory);
             }
         }
     }
     return(0);
 }