当前位置: 首页>>代码示例>>C#>>正文


C# IVsWindowFrame.GetGuidProperty方法代码示例

本文整理汇总了C#中IVsWindowFrame.GetGuidProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IVsWindowFrame.GetGuidProperty方法的具体用法?C# IVsWindowFrame.GetGuidProperty怎么用?C# IVsWindowFrame.GetGuidProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVsWindowFrame的用法示例。


在下文中一共展示了IVsWindowFrame.GetGuidProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetComponent

        private IInteractiveWindowVisualComponent GetComponent(IVsWindowFrame frame) {
            if (frame == null) {
                return null;
            }

            Guid property;
            if (ErrorHandler.Failed(frame.GetGuidProperty((int)__VSFPROPID.VSFPROPID_GuidPersistenceSlot, out property)) || property != RGuidList.ReplInteractiveWindowProviderGuid) {
                return null;
            }

            object docView;
            if (ErrorHandler.Failed(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out docView))) {
                return null;
            }

            var interactiveWindow = (docView as IVsInteractiveWindow)?.InteractiveWindow;
            if (interactiveWindow == null) {
                return null;
            }

            IInteractiveWindowVisualComponent component;
            return interactiveWindow.Properties.TryGetProperty(typeof(IInteractiveWindowVisualComponent), out component) ? component : null;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:23,代码来源:VsActiveRInteractiveWindowTracker.cs

示例2: GetEditorTypeId

        /// <summary>
        /// Gets the editor type id from a window frame.
        /// </summary>
        /// <param name="window">Window frame.</param>
        /// <returns>Editor type id.</returns>
        public static Guid GetEditorTypeId(IVsWindowFrame window)
        {
            Guid guid;
            window.GetGuidProperty((int)__VSFPROPID.VSFPROPID_guidEditorType, out guid);

            return guid;
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:12,代码来源:ModelPackage.cs

示例3: GetPersistenceSlot

        /// <summary>
        /// Gets the persistence slot id from a window frame.
        /// </summary>
        /// <param name="window">Window frame.</param>
        /// <returns>Persistence slot id.</returns>
        public static Guid GetPersistenceSlot(IVsWindowFrame window)
        {
            Guid guid;
            window.GetGuidProperty((int)__VSFPROPID.VSFPROPID_GuidPersistenceSlot, out guid);

            return guid;
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:12,代码来源:ModelPackage.cs

示例4: GetGuidProperty

 internal Guid GetGuidProperty(IVsWindowFrame frame, int propertyID)
 {
     Guid result = Guid.Empty;
     ErrorHandler.ThrowOnFailure(frame.GetGuidProperty(propertyID, out result));
     return result;
 }
开发者ID:Konctantin,项目名称:VS_SDK_samples,代码行数:6,代码来源:WindowList.cs

示例5: OpenDocumentWithSpecificEditor

 public static void OpenDocumentWithSpecificEditor(IServiceProvider provider, string fullPath, Guid editorType, string physicalView, Guid logicalView, out IVsUIHierarchy hierarchy, uint[] itemID, out IVsWindowFrame windowFrame) {
   windowFrame = null;
   hierarchy = null;
   //open document
   IVsUIShellOpenDocument shellOpenDoc = provider.GetService(typeof(IVsUIShellOpenDocument)) as IVsUIShellOpenDocument;
   IVsRunningDocumentTable pRDT = provider.GetService(typeof(IVsRunningDocumentTable)) as IVsRunningDocumentTable;
   if (pRDT != null) {
     IntPtr punkDocData;
     uint docCookie;
     uint pitemid;
     IVsHierarchy ppIVsHierarchy;
     pRDT.FindAndLockDocument((uint)_VSRDTFLAGS.RDT_NoLock, fullPath, out ppIVsHierarchy, out pitemid, out punkDocData, out docCookie);
     if (punkDocData != IntPtr.Zero) {
       Marshal.Release(punkDocData);
       int pfOpen;
       shellOpenDoc.IsDocumentOpen((IVsUIHierarchy)ppIVsHierarchy, pitemid, fullPath, ref logicalView, (uint)__VSIDOFLAGS.IDO_IgnoreLogicalView, out hierarchy, itemID, out windowFrame, out pfOpen);
       hierarchy = null;
       if (windowFrame != null) {
         Guid currentEditor;
         windowFrame.GetGuidProperty((int)__VSFPROPID.VSFPROPID_guidEditorType, out currentEditor);
         object currentView;
         windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_pszPhysicalView, out currentView);
         if (currentEditor == editorType && currentView != null && physicalView == currentView.ToString()) {
           windowFrame.Show();
           return;
         }
       }
       //windowFrame.CloseFrame((uint)__FRAMECLOSE.FRAMECLOSE_PromptSave);
       windowFrame = null;
     } 
     IOleServiceProvider psp;
     uint itemid;
     uint editorFlags = (uint)__VSSPECIFICEDITORFLAGS.VSSPECIFICEDITOR_UseEditor;
     shellOpenDoc.OpenDocumentViaProjectWithSpecific(fullPath, editorFlags, ref editorType, physicalView, ref logicalView, out psp, out hierarchy, out itemid, out windowFrame);
     if (windowFrame != null)
       windowFrame.Show();
     psp = null;
   }
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:39,代码来源:Utilities.cs

示例6: OpenItem

    public static void OpenItem(IServiceProvider site, bool newFile, bool openWith, uint editorFlags, ref Guid editorType, string physicalView, ref Guid logicalView, IntPtr punkDocDataExisting, IVsHierarchy pHierarchy, uint hierarchyId, out IVsWindowFrame windowFrame) {
      windowFrame = null;
      IntPtr docData = punkDocDataExisting;
      try {
        uint itemid = hierarchyId;

        object pvar;        
        pHierarchy.GetProperty(hierarchyId, (int)__VSHPROPID.VSHPROPID_Caption, out pvar);
        string caption = (string)pvar;

        string fullPath = null;
        
        if (punkDocDataExisting != IntPtr.Zero && punkDocDataExisting.ToInt64() != -1L) {
          fullPath = VsShell.GetFilePath(punkDocDataExisting);
        } 
        if (fullPath == null) {
          string dir;
          pHierarchy.GetProperty((uint)VsConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ProjectDir, out pvar);
          dir = (string)pvar;
          pHierarchy.GetProperty(hierarchyId, (int)__VSHPROPID.VSHPROPID_SaveName, out pvar);          
          // todo: what if the path is a URL?
          fullPath = dir != null ? Path.Combine(dir,(string)pvar) : (string)pvar;
        }

        HierarchyNode node = pHierarchy as HierarchyNode;
        IVsUIHierarchy pRootHierarchy = node == null ? (IVsUIHierarchy) pHierarchy : node.projectMgr;
        IVsUIHierarchy pVsUIHierarchy = pRootHierarchy;

				IVsUIShellOpenDocument doc = site.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument;
        const uint   OSE_ChooseBestStdEditor  = 0x20000000;
        const uint OSE_UseOpenWithDialog  = 0x10000000;
        const uint OSE_OpenAsNewFile  = 0x40000000;

        if (openWith) {          
					IOleServiceProvider psp = site.GetService(typeof(IOleServiceProvider)) as IOleServiceProvider;
					doc.OpenStandardEditor(OSE_UseOpenWithDialog, fullPath, ref logicalView, caption, pVsUIHierarchy, itemid, docData, psp, out windowFrame);
        } else {
          // First we see if someone else has opened the requested view of the file.
					IVsRunningDocumentTable pRDT = site.GetService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;
          if (pRDT != null) {
            uint docCookie;
            IVsHierarchy ppIVsHierarchy;
            pRDT.FindAndLockDocument((uint)_VSRDTFLAGS.RDT_NoLock, fullPath, out ppIVsHierarchy, out itemid, out docData, out docCookie);
            if (ppIVsHierarchy != null && docCookie != VsConstants.VSDOCCOOKIE_NIL && pHierarchy != ppIVsHierarchy && pVsUIHierarchy != ppIVsHierarchy) {
              // not opened by us, so call IsDocumentOpen with the right IVsUIHierarchy so we avoid the
              // annoying "This document is opened by another project" message prompt.
              pVsUIHierarchy = (IVsUIHierarchy)ppIVsHierarchy;
              itemid = (uint)VsConstants.VSITEMID_SELECTION;
            }
            ppIVsHierarchy = null;
          }
          IVsUIHierarchy ppHierOpen;
          uint[] pitemidOpen = new uint[1];
          int pfOpen;      
          doc.IsDocumentOpen(pVsUIHierarchy, itemid, fullPath, ref logicalView, (uint)__VSIDOFLAGS.IDO_ActivateIfOpen, out ppHierOpen, pitemidOpen, out windowFrame, out pfOpen);
          if (pfOpen == 1 && editorType != Guid.Empty) {
            if (windowFrame != null) {
              Guid currentEditor;
              windowFrame.GetGuidProperty((int)__VSFPROPID.VSFPROPID_guidEditorType, out currentEditor);
              if (currentEditor == editorType) {
                goto done;
              }
            }
            windowFrame.CloseFrame((uint)__FRAMECLOSE.FRAMECLOSE_PromptSave);
            windowFrame = null;
            pfOpen = 0;
          }
          if (pfOpen != 1) {
            uint openFlags = 0;
            if (newFile) openFlags |= OSE_OpenAsNewFile;

            //NOTE: we MUST pass the IVsProject in pVsUIHierarchy and the itemid
            // of the node being opened, otherwise the debugger doesn't work.
            IOleServiceProvider psp = site.GetService(typeof(IOleServiceProvider)) as IOleServiceProvider;
            if (editorType != Guid.Empty) {
              doc.OpenSpecificEditor(editorFlags, fullPath, ref editorType, physicalView, ref logicalView, caption, pRootHierarchy, hierarchyId, docData, psp, out windowFrame);
            } else {
              openFlags |= OSE_ChooseBestStdEditor;
              doc.OpenStandardEditor(openFlags, fullPath, ref logicalView, caption, pRootHierarchy, hierarchyId, docData, psp, out windowFrame);
            }
            if (windowFrame != null) {
              if (newFile) {
                object var;
                windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocData, out var);
                IVsPersistDocData ppd = (IVsPersistDocData)var;
                ppd.SetUntitledDocPath(fullPath);
              }
            }
          }
        }
      done:
        if (windowFrame != null)
          windowFrame.Show();        

      } catch (COMException e) {
        if ((uint)e.ErrorCode != (uint)OleErrors.OLE_E_PROMPTSAVECANCELLED) {
#if DEBUG
          MessageBox.Show(e.Message);
#endif
        }
//.........这里部分代码省略.........
开发者ID:hesam,项目名称:SketchSharp,代码行数:101,代码来源:Utilities.cs


注:本文中的IVsWindowFrame.GetGuidProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。