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


C# IVsWindowFrame.SetProperty方法代码示例

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


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

示例1: WindowFrame

    // --------------------------------------------------------------------------------------------
    /// <summary>
    /// Creates a new instance of the class 
    /// </summary>
    /// <param name="frame"></param>
    // --------------------------------------------------------------------------------------------
    public WindowFrame(IVsWindowFrame frame)
    {
      if (frame == null)
      {
        throw new ArgumentNullException("frame");
      }
      _Frame = frame;

      // --- Set up event handlers
      ErrorHandler.ThrowOnFailure(_Frame.SetProperty((int)__VSFPROPID.VSFPROPID_ViewHelper, this));
    }
开发者ID:sunpander,项目名称:VSDT,代码行数:17,代码来源:WindowFrame.cs

示例2: TransferItem

        /// <summary>
        /// Implements IVsProject3::TransferItem
        /// This function is called when an open miscellaneous file is being transferred
        /// to our project. The sequence is for the shell to call AddItemWithSpecific and
        /// then use TransferItem to transfer the open document to our project.
        /// </summary>
        /// <param name="oldMkDoc">Old document name</param>
        /// <param name="newMkDoc">New document name</param>
        /// <param name="frame">Optional frame if the document is open</param>
        /// <returns></returns>
        public virtual int TransferItem(string oldMkDoc, string newMkDoc, IVsWindowFrame frame)
        {
            // Fail if hierarchy already closed
            if (this.ProjectMgr == null || this.ProjectMgr.IsClosed)
            {
                return VSConstants.E_FAIL;
            }
            //Fail if the document names passed are null.
            if (oldMkDoc == null || newMkDoc == null)
                return VSConstants.E_INVALIDARG;

            int hr = VSConstants.S_OK;
            VSDOCUMENTPRIORITY[] priority = new VSDOCUMENTPRIORITY[1];
            uint itemid = VSConstants.VSITEMID_NIL;
            uint cookie = 0;
            uint grfFlags = 0;

            IVsRunningDocumentTable pRdt = GetService(typeof(IVsRunningDocumentTable)) as IVsRunningDocumentTable;
            if (pRdt == null)
                return VSConstants.E_ABORT;

            string doc;
            int found;
            IVsHierarchy pHier;
            uint id, readLocks, editLocks;
            IntPtr docdataForCookiePtr = IntPtr.Zero;
            IntPtr docDataPtr = IntPtr.Zero;
            IntPtr hierPtr = IntPtr.Zero;

            // We get the document from the running doc table so that we can see if it is transient
            try
            {
                ErrorHandler.ThrowOnFailure(pRdt.FindAndLockDocument((uint)_VSRDTFLAGS.RDT_NoLock, oldMkDoc, out pHier, out id, out docdataForCookiePtr, out cookie));
            }
            finally
            {
                if (docdataForCookiePtr != IntPtr.Zero)
                    Marshal.Release(docdataForCookiePtr);
            }

            //Get the document info
            try
            {
                ErrorHandler.ThrowOnFailure(pRdt.GetDocumentInfo(cookie, out grfFlags, out readLocks, out editLocks, out doc, out pHier, out id, out docDataPtr));
            }
            finally
            {
                if (docDataPtr != IntPtr.Zero)
                    Marshal.Release(docDataPtr);
            }

            // Now see if the document is in the project. If not, we fail
            try
            {
                ErrorHandler.ThrowOnFailure(IsDocumentInProject(newMkDoc, out found, priority, out itemid));
                Debug.Assert(itemid != VSConstants.VSITEMID_NIL && itemid != VSConstants.VSITEMID_ROOT);
                hierPtr = Marshal.GetComInterfaceForObject(this, typeof(IVsUIHierarchy));
                // Now rename the document
                ErrorHandler.ThrowOnFailure(pRdt.RenameDocument(oldMkDoc, newMkDoc, hierPtr, itemid));
            }
            finally
            {
                if (hierPtr != IntPtr.Zero)
                    Marshal.Release(hierPtr);
            }

            //Change the caption if we are passed a window frame
            if (frame != null)
            {
                string caption = "%2";
                hr = frame.SetProperty((int)(__VSFPROPID.VSFPROPID_OwnerCaption), caption);
            }
            return hr;
        }
开发者ID:IntelliTect,项目名称:PowerStudio,代码行数:84,代码来源:ProjectNode.cs

示例3: DockWindowIfFloating

        /// <summary>
        /// Docks the specified frame window if it is currently floating.
        /// </summary>
        /// <remarks>Works in VS2010, does not appear to work in VS2008.</remarks>
        /// <param name="frame">The frame.</param>
        private static void DockWindowIfFloating(IVsWindowFrame frame)
        {
            // Get the current tool window frame mode.
            object currentFrameMode;
            frame.GetProperty((int)__VSFPROPID.VSFPROPID_FrameMode, out currentFrameMode);

            // If currently floating, switch to dock mode.
            if ((VSFRAMEMODE)currentFrameMode == VSFRAMEMODE.VSFM_Float)
            {
                frame.SetProperty((int)__VSFPROPID.VSFPROPID_FrameMode, VSFRAMEMODE.VSFM_Dock);
            }
        }
开发者ID:adontz,项目名称:codemaid,代码行数:17,代码来源:BuildProgressToolWindowCommand.cs


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