Suchen Sie eine IVsTextView oder IWpfTextView für ein bestimmtes ProjectItem in der VS 2010 RC-Erweiterung

Ich habe das ProjectItem und möchte das IWPFTextView abrufen, das ihm zugeordnet ist, falls vorhanden.

Ich habe versucht, einen IVsTextManager abzurufen und dann die Ansichten zu durchlaufen, aber iVsTextManager.EnumViews gibt immer nichts zurück.

Folgendes habe ich bisher:

var txtMgr = (IVsTextManager)Package.GetGlobalService(typeof(SVsTextManager));

if (txtMgr != null)
{
    IVsEnumTextViews iVsEnumTextViews;
    IVsTextView[] views = null;

    // Passing null will return all available views, at least according to the documentation
    // unfortunately, this returns a 0x80070057 error (invalid parameter)
    var errorValue = txtMgr.EnumViews(null, out iVsEnumTextViews);

    if (errorValue == VSConstants.S_OK)
    {
        // enumerate, find the IVsTextView with a matching filename.

Sicher gibt es einen anderen / besseren Weg?

Danke im Voraus

~ Cameron

Antworten auf die Frage(3)

Ihre Antwort auf die Frage