src/Misc/EFTools/DesignXmlCore/Common/RdtManager.cs
/// <summary>
///     Returns the window frame for our document window
/// </summary>
/// <returns>
///     The IWindowFrame for our open document.
/// </returns>
Returns the window frame for our document window
Returns the window frame for our document window
public VsShell.IVsWindowFrame GetWindowFrame(string fullFileName)
        {
            if (string.IsNullOrEmpty(fullFileName))
            {
                return null;
            }
            VsShell.IVsWindowFrame foundFrame = null;
            var rdt = Instance.GetRunningDocumentTable();
            if (rdt != null)
            {
                var uiShell = _uiShell;
                VsShell.IEnumWindowFrames windowFramesEnum;
                ErrorHandler.ThrowOnFailure(uiShell.GetDocumentWindowEnum(out windowFramesEnum));
                var windowFrames = new VsShell.IVsWindowFrame[1];
                uint fetched;
                var thisFilename = fullFileName;
                while (windowFramesEnum.Next(1, windowFrames, out fetched) == VSConstants.S_OK
                       && fetched == 1)
                {
                    var windowFrame = windowFrames[0];
                    object data;
                    ErrorHandler.ThrowOnFailure(windowFrame.GetProperty((int)VsShell.__VSFPROPID.VSFPROPID_DocData, out data));
                    var fileFormat = data as VsShell.IPersistFileFormat;
                    if (fileFormat != null)
                    {
                        string candidateFilename;
                        uint formatIndex;
                        NativeMethods.ThrowOnFailure(fileFormat.GetCurFile(out candidateFilename, out formatIndex));
                        if (string.IsNullOrEmpty(candidateFilename) == false
                            &&
                            (string.Compare(candidateFilename, thisFilename, true, CultureInfo.CurrentCulture) == 0 ||
                             FileUtils.IsSamePath(candidateFilename, thisFilename)))
                        {
                            foundFrame = windowFrame;
                            break;
                        }
                    }
                }
            }
            return foundFrame;
        }
public VsShell . IVsWindowFrame GetWindowFrame ( string fullFileName ) { if ( string . IsNullOrEmpty ( fullFileName ) ) { return null ; } VsShell . IVsWindowFrame foundFrame = null ; var rdt = Instance . GetRunningDocumentTable ( ) ; if ( rdt != null ) { var uiShell = _uiShell ; VsShell . IEnumWindowFrames windowFramesEnum ; ErrorHandler . ThrowOnFailure ( uiShell . GetDocumentWindowEnum ( out windowFramesEnum ) ) ; var windowFrames = new VsShell . IVsWindowFrame [ 1 ] ; uint fetched ; var thisFilename = fullFileName ; while ( windowFramesEnum . Next ( 1 , windowFrames , out fetched ) == VSConstants . S_OK && fetched == 1 ) { var windowFrame = windowFrames [ 0 ] ; object data ; ErrorHandler . ThrowOnFailure ( windowFrame . GetProperty ( ( int ) VsShell . __VSFPROPID . VSFPROPID_DocData , out data ) ) ; var fileFormat = data as VsShell . IPersistFileFormat ; if ( fileFormat != null ) { string candidateFilename ; uint formatIndex ; NativeMethods . ThrowOnFailure ( fileFormat . GetCurFile ( out candidateFilename , out formatIndex ) ) ; if ( string . IsNullOrEmpty ( candidateFilename ) == false && ( string . Compare ( candidateFilename , thisFilename , true , CultureInfo . CurrentCulture ) == 0 || FileUtils . IsSamePath ( candidateFilename , thisFilename ) ) ) { foundFrame = windowFrame ; break ; } } } } return foundFrame ; }
Returns the window frame for our document window
Returns the window frame for our document window
// Get the UI Shell // Go through the open documents and find it // Found it
The IWindowFrame for our open document.
The IWindowFrame for our open document .
fullFileName
string