Inheritance: SAutoShelveService, IAutoShelveService, IDisposable
コード例 #1
0
 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);
 }
コード例 #2
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);
 }
コード例 #3
0
 // The bulk of the clean-up code is implemented in Dispose(bool)
 protected override void Dispose(bool disposeManaged)
 {
     if (disposeManaged)
     {
         // free managed resources
         if (_timer != null)
         {
             _timer.Enabled = false;
             _timer.Dispose();
             _timer = null;
         }
         if (_autoShelve != null)
         {
             _autoShelve.Dispose();
             _autoShelve = null;
         }
     }
     base.Dispose(disposeManaged);
 }
コード例 #4
0
        private void InitializeAutoShelve(string workingDirectory)
        {
            InitializeSolutionServiceEvents();
            try {
                _autoShelve = new TfsAutoShelve(_extName, _dte);

                // Tools->Options event wire-up
                _options.OnOptionsChanged += Options_OnOptionsChanged;

                // Event Wire-up
                _autoShelve.OnShelvesetCreated   += autoShelve_OnShelvesetCreated;
                _autoShelve.OnTfsConnectionError += autoShelve_OnTfsConnectionError;
                _autoShelve.OnTimerStart         += autoShelve_OnTimerStart;
                _autoShelve.OnTimerStop          += autoShelve_OnTimerStop;
                _autoShelve.OnWorkspaceChanged   += autoShelve_OnWorkspaceChanged;

                // Property Initialization
                _autoShelve.MaximumShelvesets = _options.MaximumShelvesets;
                _autoShelve.OutputPane        = _options.OutputPane;
                _autoShelve.ShelvesetName     = _options.ShelvesetName;
                _autoShelve.TimerInterval     = _options.TimerSaveInterval;
                _autoShelve.SuppressDialogs   = _options.SuppressDialogs;
                _autoShelve.WorkingDirectory  = workingDirectory;

                _autoShelve.StartTimer();
            } catch {
                if (_autoShelve != null)
                {
                    _options.OnOptionsChanged -= Options_OnOptionsChanged;

                    _autoShelve.OnShelvesetCreated   -= autoShelve_OnShelvesetCreated;
                    _autoShelve.OnTfsConnectionError -= autoShelve_OnTfsConnectionError;
                    _autoShelve.OnTimerStart         -= autoShelve_OnTimerStart;
                    _autoShelve.OnTimerStop          -= autoShelve_OnTimerStop;
                    _autoShelve.OnWorkspaceChanged   -= autoShelve_OnWorkspaceChanged;
                }
            }
        }