भाग 1.
अनिश्चित को
हाँ भाग 2. के बारे में
एक संक्षिप्त रूप में VS2008 स्वचालित रूप से खुला फ़ाइलें करने के लिए आप "Edit.CollapsetoDefinition" जब प्रत्येक चलाने के लिए एक ऐड बनाने की आवश्यकता होगी दस्तावेज़ खुलता है
यह अत्यधिक मुश्किल नहीं है - मुश्किल भागों को लगता है कि दस्तावेज़ को वास्तव में खोले जाने के बाद आपको कुछ मिलीसेकंड कोड चलाने होंगे, इसलिए आपको ऐसा करने के लिए लाल पूल का उपयोग करने की आवश्यकता है।
- वीएस 2008 के लिए एक एडिन परियोजना बनाएं।
- कनेक्ट क्लास के ऑनकनेक्शन विधि के अंत में यह कोड (निम्न देखें) जोड़ें।
switch (connectMode)
{
case ext_ConnectMode.ext_cm_UISetup:
case ext_ConnectMode.ext_cm_Startup:
//Do nothing OnStartup will be called once IDE is initialised.
break;
case ext_ConnectMode.ext_cm_AfterStartup:
//The addin was started post startup so we need to call its initialisation manually
InitialiseHandlers();
break;
}
- कनेक्ट वर्ग के लिए इस विधि जोड़ें
private void InitialiseHandlers()
{
this._openHandler = new OnOpenHandler(_applicationObject);
}
- InitialiseHandlers के लिए एक कॉल जोड़ें() कनेक्ट क्लास की ऑनस्टार्टअप पूर्ण विधि पर।
public void OnStartupComplete(ref Array custom)
{
InitialiseHandlers();
}
- परियोजना के लिए इस वर्ग जोड़ें।
using System;
using System.Collections.Generic;
using System.Text;
using EnvDTE80;
using EnvDTE;
using System.Threading;
namespace Collapser
{
internal class OnOpenHandler
{
DTE2 _application = null;
EnvDTE.Events events = null;
EnvDTE.DocumentEvents docEvents = null;
internal OnOpenHandler(DTE2 application)
{
_application = application;
events = _application.Events;
docEvents = events.get_DocumentEvents(null);
docEvents.DocumentOpened +=new _dispDocumentEvents_DocumentOpenedEventHandler(OnOpenHandler_DocumentOpened);
}
void OnOpenHandler_DocumentOpened(EnvDTE.Document document)
{
if (_application.Debugger.CurrentMode != dbgDebugMode.dbgBreakMode)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(Collapse));
}
}
private void Collapse(object o)
{
System.Threading.Thread.Sleep(150);
_application.ExecuteCommand("Edit.CollapsetoDefinitions", "");
}
}
}
और अब क्योंकि सभी खोला फ़ाइलों को पूरी तरह से ध्वस्त हो गई किया जाना चाहिए।
क्या आप कृपया यह स्पष्ट कर सकते हैं कि आप यह कैसे करेंगे? मैंने एक उत्तर जोड़ा (http://stackoverflow.com/questions/293806/is-there-a-way-to-specify-outlining-defaults-in-visual-studio-so-that-a-file-open/1050267 # 1050267) इस प्रश्न के लिए, लेकिन मेरे मैक्रो कोड को काम करने के लिए नहीं मिल सकता है। –