private object CreateService(IServiceContainer container, Type serviceType) { if (typeof(SAutoShelveService) == serviceType) { if (_autoShelve == null) _autoShelve = new TfsAutoShelve(this); return _autoShelve; } //if (typeof(SMyLocalService) == serviceType) // return new MyLocalService(this); return null; }
/// <summary> /// /// </summary> /// <remarks> /// Register your own package service) /// http://technet.microsoft.com/en-us/office/bb164693(v=vs.71).aspx /// http://blogs.msdn.com/b/aaronmar/archive/2004/03/12/88646.aspx /// http://social.msdn.microsoft.com/Forums/vstudio/en-US/be755076-6e07-4025-93e7-514cd4019dcb/register-own-service?forum=vsx /// IVsRunningDocumentTable rdt = Package.GetGlobalService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable; /// rdt.AdviseRunningDocTableEvents(new YourRunningDocTableEvents()); /// rdt.GetDocumentInfo(docCookie, ...) /// One of the out params is RDT_ProjSlnDocument; this will be set for your solution file. Note this flag also covers projects. Once you have sufficiently determined it is your solution you're set. /// /// http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsrunningdoctableevents.onaftersave.aspx /// http://social.msdn.microsoft.com/Forums/vstudio/it-IT/fd513e71-bb23-4de0-b631-35bfbdfdd4f5/visual-studio-isolated-shell-onsolutionsaved-event?forum=vsx /// </remarks> private void InitializeAutoShelve() { _autoShelve = GetGlobalService(typeof(SAutoShelveService)) as TfsAutoShelve; if (_autoShelve != null) { // Property Initialization _autoShelve.MaximumShelvesets = _options.MaximumShelvesets; _autoShelve.ShelvesetName = _options.ShelvesetName; _autoShelve.TimerInterval = _options.TimerSaveInterval; } AttachEvents(); }
/// <summary> /// /// </summary> /// <remarks> /// Register your own package service) /// http://technet.microsoft.com/en-us/office/bb164693(v=vs.71).aspx /// http://blogs.msdn.com/b/aaronmar/archive/2004/03/12/88646.aspx /// http://social.msdn.microsoft.com/Forums/vstudio/en-US/be755076-6e07-4025-93e7-514cd4019dcb/register-own-service?forum=vsx /// IVsRunningDocumentTable rdt = Package.GetGlobalService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable; /// rdt.AdviseRunningDocTableEvents(new YourRunningDocTableEvents()); /// rdt.GetDocumentInfo(docCookie, ...) /// One of the out params is RDT_ProjSlnDocument; this will be set for your solution file. Note this flag also covers projects. Once you have sufficiently determined it is your solution you're set. /// /// http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsrunningdoctableevents.onaftersave.aspx /// http://social.msdn.microsoft.com/Forums/vstudio/it-IT/fd513e71-bb23-4de0-b631-35bfbdfdd4f5/visual-studio-isolated-shell-onsolutionsaved-event?forum=vsx /// </remarks> private void InitializeAutoShelve() { try { _autoShelve = GetGlobalService(typeof(SAutoShelveService)) as TfsAutoShelve; if (_autoShelve != null) { // Property Initialization _autoShelve.MaximumShelvesets = _options.MaximumShelvesets; _autoShelve.ShelvesetName = _options.ShelvesetName; _autoShelve.TimerInterval = _options.TimerSaveInterval; } AttachEvents(); } catch (Exception ex) { WriteException(ex); } }