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


C# IVsWindowFrame.GetProperty方法代码示例

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


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

示例1: CreateInfoBar

        private void CreateInfoBar(IVsInfoBarUIFactory factory, IVsWindowFrame frame, string message, ErrorReportingUI[] items)
        {
            if (ErrorHandler.Failed(frame.GetProperty((int)__VSFPROPID7.VSFPROPID_InfoBarHost, out var unknown)))
            {
                return;
            }

            var textSpans = new List<IVsInfoBarTextSpan>()
            {
                new InfoBarTextSpan(message)
            };

            // create action item list
            var actionItems = new List<IVsInfoBarActionItem>();

            foreach (var item in items)
            {
                switch (item.Kind)
                {
                    case ErrorReportingUI.UIKind.Button:
                        actionItems.Add(new InfoBarButton(item.Title));
                        break;
                    case ErrorReportingUI.UIKind.HyperLink:
                        actionItems.Add(new InfoBarHyperlink(item.Title));
                        break;
                    case ErrorReportingUI.UIKind.Close:
                        break;
                    default:
                        throw ExceptionUtilities.UnexpectedValue(item.Kind);
                }
            }

            var infoBarModel = new InfoBarModel(
                textSpans,
                actionItems.ToArray(),
                KnownMonikers.StatusInformation,
                isCloseButtonVisible: true);
            if (!TryCreateInfoBarUI(factory, infoBarModel, out var infoBarUI))
            {
                return;
            }

            uint? infoBarCookie = null;
            var eventSink = new InfoBarEvents(items, () =>
            {
                // run given onClose action if there is one.
                items.FirstOrDefault(i => i.Kind == ErrorReportingUI.UIKind.Close).Action?.Invoke();

                if (infoBarCookie.HasValue)
                {
                    infoBarUI.Unadvise(infoBarCookie.Value);
                }
            });
            infoBarUI.Advise(eventSink, out var cookie);
            infoBarCookie = cookie;

            var host = (IVsInfoBarHost)unknown;
            host.AddInfoBar(infoBarUI);
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:59,代码来源:VisualStudioErrorReportingService.cs

示例2: InitializeEditor

        public void InitializeEditor(VSEditorControl form, IVsUIHierarchy hier, IVsWindowFrame frame, uint docid)
        {
            VSDocumentFormPane pane = null;
            object value;
            if (ErrorHandler.Succeeded(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out value)))
            {
                pane = value as VSDocumentFormPane;
            }

            if (pane != null)
                ((IVSEditorControlInit)form).InitializedForm(hier, docid, frame, pane.Host);
        }
开发者ID:pvginkel,项目名称:VisualGit,代码行数:12,代码来源:VSDocumentHostService.cs

示例3: PartViewHelper

        public PartViewHelper(PackageEditorPane editor, IVsWindowFrame windowFrame)
        {
            this.windowFrame = windowFrame;
            this.editor = editor;
            justOpened = true;

            object data;
            ErrorHandler.ThrowOnFailure(windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocData, out data));
            textLines = (IVsTextLines)data;

            AdviseTextLinesEvents(true);

        }
开发者ID:VitorX,项目名称:Open-XML-Package-Editor-Power-Tool-for-Visual-Studio,代码行数:13,代码来源:PartViewHelper.cs

示例4: CreateInfoBar

        private void CreateInfoBar(IVsInfoBarUIFactory factory, IVsWindowFrame frame, string title, Action onClose, Action onEnableClicked = null, Action onEnableAndIgnoreClicked = null)
        {
            object unknown;
            if (frame.GetProperty((int)__VSFPROPID7.VSFPROPID_InfoBarHost, out unknown) == VSConstants.S_OK)
            {
                var textSpans = new List<IVsInfoBarTextSpan>()
                {
                    new InfoBarTextSpan(title)
                };

                // create action item list
                var actionItems = new List<IVsInfoBarActionItem>();
                if (onEnableClicked != null)
                {
                    actionItems.Add(s_enableItem);
                }

                if (onEnableAndIgnoreClicked != null)
                {
                    actionItems.Add(s_enableAndIgnoreItem);
                }

                var infoBarModel = new InfoBarModel(
                    textSpans,
                    actionItems.ToArray(),
                    KnownMonikers.StatusInformation,
                    isCloseButtonVisible: true);

                IVsInfoBarUIElement infoBarUI;
                if (TryCreateInfoBarUI(factory, infoBarModel, out infoBarUI))
                {
                    uint? infoBarCookie = null;
                    InfoBarEvents eventSink = new InfoBarEvents(() =>
                    {
                        onClose();
                        if (infoBarCookie.HasValue)
                        {
                            infoBarUI.Unadvise(infoBarCookie.Value);
                        }
                    }, onEnableClicked, onEnableAndIgnoreClicked);

                    uint cookie;
                    infoBarUI.Advise(eventSink, out cookie);
                    infoBarCookie = cookie;

                    IVsInfoBarHost host = (IVsInfoBarHost)unknown;
                    host.AddInfoBar(infoBarUI);
                }
            }
        }
开发者ID:gnuhub,项目名称:roslyn,代码行数:50,代码来源:VisualStudioErrorReportingService.cs

示例5: GetPhysicalPathFromFrame

        private static bool GetPhysicalPathFromFrame(IVsWindowFrame frame, out string frameFilePath)
        {
            object propertyValue;

            int hr = frame.GetProperty((int)__VSFPROPID.VSFPROPID_pszMkDocument, out propertyValue);
            if (hr == VSConstants.S_OK && propertyValue != null)
            {
                frameFilePath = propertyValue.ToString();
                return true;
            }

            frameFilePath = null;
            return false;
        }
开发者ID:yannduran,项目名称:NpmTaskRunner,代码行数:14,代码来源:TextViewUtil.cs

示例6: GetDeployConfigurationControl

        // Gets the package manager control hosted in the window frame.
        public static Control GetDeployConfigurationControl(IVsWindowFrame windowFrame)
        {
            object property;
            var hr = windowFrame.GetProperty(
                (int)__VSFPROPID.VSFPROPID_DocView,
                out property);

            var windowPane = property as WindowPane;
            if (windowPane == null)
            {
                return null;
            }

            var packageManagerControl = windowPane.Content as Control;
            return packageManagerControl;
        }
开发者ID:jkoritzinsky,项目名称:Kerbal-Space-Program-For-Visual-Studio,代码行数:17,代码来源:VsUtility.cs

示例7: OnBeforeDocumentWindowShow

        public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame)
        {
            var currentDoc = CurrentDoc;

            if (CookieDocumentMap.ContainsKey(docCookie))
            {
                CurrentDoc = CookieDocumentMap[docCookie];
                MonitorSelection.SetCmdUIContext(MarkdownModeUIContextCookie, 1);
                CommandsEnabled = true;
            }
            else
            {
                string fullname = GetDocFullname(docCookie);
                if (IsUDNDocument(fullname))
                {
                    object codeWindow;
                    pFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out codeWindow);

                    IVsTextView view;
                    (codeWindow as IVsCodeWindow).GetPrimaryView(out view);

                    var wpfView = EditorAdaptersFactoryService.GetWpfTextView(view);

                    var docView = new UDNDocView(fullname, wpfView, pFrame, package, UIShell);
                    CookieDocumentMap[docCookie] = docView;
                    docView.ParsingResultsCache.AfterParsingEvent += PassResultsToChangedEvent;

                    CurrentDoc = CookieDocumentMap[docCookie];

                    MonitorSelection.SetCmdUIContext(MarkdownModeUIContextCookie, 1);
                    CommandsEnabled = true;
                }
                else
                {
                    MonitorSelection.SetCmdUIContext(MarkdownModeUIContextCookie, 0);
                    CommandsEnabled = false;
                }
            }

            if (currentDoc != CurrentDoc)
            {
                CurrentUDNDocView.ParsingResultsCache.AsyncReparseIfDirty();
            }

            return VSConstants.S_OK;
        }
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:46,代码来源:UDNDocRunningTableMonitor.cs

示例8: GetActiveView

        private static IVsTextView GetActiveView(IVsWindowFrame windowFrame)
        {
            if (windowFrame == null)
                throw new ArgumentNullException("windowFrame");

            object pvar;
            ErrorHandler.ThrowOnFailure(windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out pvar));

            var textView = pvar as IVsTextView;
            if (textView == null)
            {
                var codeWin = pvar as IVsCodeWindow;
                if (codeWin != null)
                    ErrorHandler.ThrowOnFailure(codeWin.GetLastActiveView(out textView));
            }

            return textView;
        }
开发者ID:nekresh,项目名称:NavigationExtension,代码行数:18,代码来源:GoToImplementationCommand.cs

示例9: CreateInfoBar

        private void CreateInfoBar(string name, Action onEnableClicked, Action onEnableAndIgnoreClicked, Action onClose, IVsWindowFrame frame, IVsInfoBarUIFactory factory)
        {
            object unknown;
            if (frame.GetProperty((int)__VSFPROPID7.VSFPROPID_InfoBarHost, out unknown) == VSConstants.S_OK)
            {
                var textSpans = new List<IVsInfoBarTextSpan>()
                {
                    new InfoBarTextSpan(string.Format(ServicesVSResources.CodefixOrRefactoringEncounteredError, name)),
                };

                var infoBarModel = new InfoBarModel(
                    textSpans,
                    new IVsInfoBarActionItem[]
                        {
                            s_enableItem,
                            s_enableAndIgnoreItem
                        },
                    KnownMonikers.StatusInformation,
                    isCloseButtonVisible: true);

                IVsInfoBarUIElement infoBarUI;
                if (TryCreateInfoBarUI(factory, infoBarModel, out infoBarUI))
                {
                    uint? infoBarCookie = null;
                    InfoBarEvents eventSink = new InfoBarEvents(onEnableClicked, onEnableAndIgnoreClicked, () =>
                    {
                        onClose();
                        if (infoBarCookie.HasValue)
                        {
                            infoBarUI.Unadvise(infoBarCookie.Value);
                        }
                    });

                    uint cookie;
                    infoBarUI.Advise(eventSink, out cookie);
                    infoBarCookie = cookie;

                    IVsInfoBarHost host = (IVsInfoBarHost)unknown;
                    host.AddInfoBar(infoBarUI);
                }
            }
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:42,代码来源:VisualStudioErrorReportingService.cs

示例10: GetVsTextView

        private static IVsTextView GetVsTextView(IVsWindowFrame windowFrame)
        {
            if (windowFrame == null)
            throw new ArgumentNullException("windowFrame");

              object obj;
              if (ErrorHandler.Failed(windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out obj)))
            return null;

              var vsTextView = obj as IVsTextView;
              if (vsTextView != null)
            return vsTextView;

              var vsCodeWindow = obj as IVsCodeWindow;
              if (vsCodeWindow == null)
            return null;

              if (ErrorHandler.Failed(vsCodeWindow.GetPrimaryView(out vsTextView)))
            return null;

              return vsTextView;
        }
开发者ID:nick-chromium,项目名称:vs-chromium,代码行数:22,代码来源:OpenDocumentHelper.cs

示例11: 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

示例12: GetWindowObject

        /// <include file='doc\VsShellUtilities.uex' path='docs/doc[@for="VsShellUtilities.GetWindowObject"]/*' />
        /// <devdoc>
        /// Get Window interface for the window frame.
        /// </devdoc>
        /// <param name="windowFrame">The window frame.</param>
        /// <returns>A reference to the Window interaface if succesfull. Otherwise null.</returns>
        public static EnvDTE.Window GetWindowObject(IVsWindowFrame windowFrame)
        {
            if (windowFrame == null)
            {
                throw new ArgumentException("windowFrame");
            }

            EnvDTE.Window window = null;
            object pvar;
            ErrorHandler.ThrowOnFailure(windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_ExtWindowObject, out pvar));
            if (pvar is EnvDTE.Window)
            {
                window = (EnvDTE.Window)pvar;
            }
            return window;
        }
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:22,代码来源:VsShellUtilities.cs

示例13: GetTextView

        /// <include file='doc\VsShellUtilities.uex' path='docs/doc[@for="VsShellUtilities.GetTextView"]/*' />
        /// <devdoc>
        /// Get primary view for a window frame.
        /// </devdoc>
        /// <param name="windowFrame">The window frame</param>
        /// <returns>A reference to an IVsTextView if successful. Otherwise null.</returns>
        public static IVsTextView GetTextView(IVsWindowFrame windowFrame)
        {
            if (windowFrame == null)
            {
                throw new ArgumentException("windowFrame");
            }

            object pvar;
            ErrorHandler.ThrowOnFailure(windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out pvar));

            IVsTextView textView = pvar as IVsTextView;

            if (textView == null)
            {
                IVsCodeWindow codeWin = pvar as IVsCodeWindow;
                if (codeWin != null)
                {
                    ErrorHandler.ThrowOnFailure(codeWin.GetPrimaryView(out textView));
                }
            }
            return textView;
        }
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:28,代码来源:VsShellUtilities.cs

示例14: IsToolWindow

 private bool IsToolWindow(IVsWindowFrame frame)
 {
   object obj2;
   int num = 0;
   NativeMethods.ThrowOnFailure(frame.GetProperty(-3000, out obj2));
   if (obj2 is int)
   {
     num = (int) obj2;
   }
   return (num == 2);
 }
开发者ID:sunpander,项目名称:VSDT,代码行数:11,代码来源:HelpService.cs

示例15: GetProperty

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


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