本文整理汇总了C#中IVsWindowFrame类的典型用法代码示例。如果您正苦于以下问题:C# IVsWindowFrame类的具体用法?C# IVsWindowFrame怎么用?C# IVsWindowFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVsWindowFrame类属于命名空间,在下文中一共展示了IVsWindowFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Open
public override int Open(ref Guid logicalView, IntPtr docDataExisting, out IVsWindowFrame windowFrame,
WindowFrameShowAction windowFrameAction)
{
var editorGuid = VSConstants.GUID_ProjectDesignerEditor;
return OpenWithSpecific(0, ref editorGuid, string.Empty, ref logicalView, docDataExisting, out windowFrame,
windowFrameAction);
}
示例2: OnBeforeDocumentWindowShow
public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame frame)
{
ThreadHelper.ThrowIfNotOnUIThread();
if (fFirstShow != 0)
{
var windowFrameInfo = new WindowFrameInfo(frame, this);
_windowFrames.Add(frame, windowFrameInfo);
}
//var path = frame.GetFilePath();
//int isOnScreen;
//frame.IsOnScreen(out isOnScreen);
//Debug.WriteLine($"tr: BeforeDocumentWindowShow(docCookie={docCookie}, fFirstShow='{fFirstShow != 0}', isOnScreen={isOnScreen}, path='{path}')");
//if (_activeFrames.Count == 0 || _activeFrames[0] != frame)
//{
// _activeFrames.Remove(frame);
// _activeFrames.Insert(0, frame);
//}
//
// посылаем сообщение активации
return VSConstants.S_OK;
}
示例3: GetToolWindowData
/// <summary>
/// Retrieves captions and positions of all active tool windows
/// </summary>
/// <returns></returns>
public static IEnumerable<ToolWindowData> GetToolWindowData(IVsUIShell shell) {
var data = new List<ToolWindowData>();
try {
IEnumWindowFrames e;
shell.GetToolWindowEnum(out e);
IVsWindowFrame[] frame = new IVsWindowFrame[1];
uint fetched = 0;
while (VSConstants.S_OK == e.Next(1, frame, out fetched) && fetched > 0) {
object objCaption;
frame[0].GetProperty((int)__VSFPROPID.VSFPROPID_Caption, out objCaption);
VSSETFRAMEPOS[] pos = new VSSETFRAMEPOS[1];
Guid relative;
int x, y, cx, cy;
frame[0].GetFramePos(pos, out relative, out x, out y, out cx, out cy);
var d = new ToolWindowData() {
Caption = objCaption as string,
X = x,
Y = y,
Width = cx,
Height = cy
};
data.Add(d);
}
} catch (Exception) { }
return data;
}
示例4: ShowSimpleOrmWindowSingleton
private ShowSimpleOrmWindowSingleton(
IVsWindowFrame vsWindowFrame,
SimpleOrmMappingWindow simpleOrmMappingWindow)
{
_vsWindowFrame = vsWindowFrame;
_simpleOrmMappingWindow = simpleOrmMappingWindow;
}
示例5: ContainsImmediateWindow
internal static bool ContainsImmediateWindow(this IEnumerable<IVsTextView> vsTextViews, IVsUIShell shellService, IVsEditorAdaptersFactoryService _editorAdaptersFactoryService)
{
IEnumWindowFrames windowEnum = null;
Marshal.ThrowExceptionForHR(shellService.GetToolWindowEnum(out windowEnum));
IVsWindowFrame[] frame = new IVsWindowFrame[1];
uint value;
var immediateWindowGuid = Guid.Parse(ToolWindowGuids80.ImmediateWindow);
while (windowEnum.Next(1, frame, out value) == VSConstants.S_OK)
{
Guid toolWindowGuid;
Marshal.ThrowExceptionForHR(frame[0].GetGuidProperty((int)__VSFPROPID.VSFPROPID_GuidPersistenceSlot, out toolWindowGuid));
if (toolWindowGuid == immediateWindowGuid)
{
IntPtr frameTextView;
Marshal.ThrowExceptionForHR(frame[0].QueryViewInterface(typeof(IVsTextView).GUID, out frameTextView));
try
{
var immediateWindowTextView = Marshal.GetObjectForIUnknown(frameTextView) as IVsTextView;
var immediateWindowWpfTextView = _editorAdaptersFactoryService.GetWpfTextView(immediateWindowTextView);
return vsTextViews.Any(vsTextView => _editorAdaptersFactoryService.GetWpfTextView(vsTextView) == immediateWindowWpfTextView);
}
finally
{
Marshal.Release(frameTextView);
}
}
}
return false;
}
示例6: OnAfterDocumentWindowHide
public virtual int OnAfterDocumentWindowHide(
uint docCookie,
IVsWindowFrame pFrame
)
{
return VSConstants.S_OK;
}
示例7: OpenWithSpecific
public override int OpenWithSpecific(uint editorFlags, ref Guid editorType, string physicalView, ref Guid logicalView, IntPtr docDataExisting, out IVsWindowFrame frame, WindowFrameShowAction windowFrameAction)
{
frame = null;
Debug.Assert(editorType == VSConstants.GUID_ProjectDesignerEditor, "Cannot open project designer with guid " + editorType.ToString());
if (this.Node == null || this.Node.ProjectMgr == null || this.Node.ProjectMgr.IsClosed)
{
return VSConstants.E_FAIL;
}
IVsUIShellOpenDocument uiShellOpenDocument = this.Node.ProjectMgr.Site.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument;
IOleServiceProvider serviceProvider = this.Node.ProjectMgr.Site.GetService(typeof(IOleServiceProvider)) as IOleServiceProvider;
if (serviceProvider != null && uiShellOpenDocument != null)
{
string fullPath = this.GetFullPathForDocument();
string caption = this.GetOwnerCaption();
IVsUIHierarchy parentHierarchy = this.Node.ProjectMgr.GetProperty((int)__VSHPROPID.VSHPROPID_ParentHierarchy) as IVsUIHierarchy;
IntPtr parentHierarchyItemId = (IntPtr)this.Node.ProjectMgr.GetProperty((int)__VSHPROPID.VSHPROPID_ParentHierarchyItemid);
ErrorHandler.ThrowOnFailure(uiShellOpenDocument.OpenSpecificEditor(editorFlags, fullPath, ref editorType, physicalView, ref logicalView, caption, parentHierarchy, (uint)(parentHierarchyItemId.ToInt32()), docDataExisting, serviceProvider, out frame));
if (frame != null)
{
if (windowFrameAction == WindowFrameShowAction.Show)
{
ErrorHandler.ThrowOnFailure(frame.Show());
}
}
}
return VSConstants.S_OK;
}
示例8: OnBeforeDocumentWindowShow
public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame)
{
if( VSGestureService.Current.VSGestureInfo.UserSettings.EnableVSGesture == false ) return VSConstants.S_OK;
var win = VsShellUtilities.GetWindowObject(pFrame);
if( win == null ) return VSConstants.S_OK;
var view = VsShellUtilities.GetTextView(pFrame);
if( view == null ) return VSConstants.S_OK;
IDesignerHost host = win.Object as IDesignerHost;
var handler = view.GetWindowHandle();
var hwnd = handler;
if (list.ContainsKey(hwnd) == true) return VSConstants.S_OK;
GestureNativeWindow window = new GestureNativeWindow(hwnd);
list.Add(hwnd, window);
if (VSGestureService.Current.VSGestureInfo.UserSettings.EnableVSGestureAlram == true)
{
// Welcome 메시지
VSGesture.Controls.frmWelcome frm = new Umc.Core.Tools.VSGesture.Controls.frmWelcome();
frm.ShowInTaskbar = false;
frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
frm.Show();
VSGestureService.Current.VSGestureInfo.UserSettings.EnableVSGestureAlram = false;
VSGestureService.Current.VSGestureInfo = VSGestureService.Current.VSGestureInfo;
}
return VSConstants.S_OK;
}
示例9: OpenWithSpecific
/// <summary>
/// Open a file with a specific editor
/// </summary>
/// <param name="editorFlags">Specifies actions to take when opening a specific editor. Possible editor flags are defined in the enumeration Microsoft.VisualStudio.Shell.Interop.__VSOSPEFLAGS</param>
/// <param name="editorType">Unique identifier of the editor type</param>
/// <param name="physicalView">Name of the physical view. If null, the environment calls MapLogicalView on the editor factory to determine the physical view that corresponds to the logical view. In this case, null does not specify the primary view, but rather indicates that you do not know which view corresponds to the logical view</param>
/// <param name="logicalView">In MultiView case determines view to be activated by IVsMultiViewDocumentView. For a list of logical view GUIDS, see constants starting with LOGVIEWID_ defined in NativeMethods class</param>
/// <param name="docDataExisting">IntPtr to the IUnknown interface of the existing document data object</param>
/// <param name="windowFrame">A reference to the window frame that is mapped to the file</param>
/// <param name="windowFrameAction">Determine the UI action on the document window</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public override int OpenWithSpecific(uint editorFlags, ref Guid editorType, string physicalView, ref Guid logicalView, IntPtr docDataExisting, out IVsWindowFrame windowFrame, WindowFrameShowAction windowFrameAction)
{
windowFrame = null;
bool newFile = false;
bool openWith = false;
return this.Open(newFile, openWith, editorFlags, ref editorType, physicalView, ref logicalView, docDataExisting, out windowFrame, windowFrameAction);
}
示例10: OnBeforeDocumentWindowShow
protected override void OnBeforeDocumentWindowShow(IVsWindowFrame frame, DocumentId id, bool firstShow)
{
if (_documentTrackingService != null)
{
_documentTrackingService.DocumentFrameShowing(frame, id, firstShow);
}
}
示例11: GetVsTextView
private static IVsTextView GetVsTextView(IVsWindowFrame windowFrame)
{
Validate.IsNotNull(windowFrame, nameof(windowFrame));
object docView;
int hresult = windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out docView);
if (ErrorHandler.Failed(hresult))
{
return null;
}
IVsTextView viewAdapter = docView as IVsTextView;
if (viewAdapter != null)
{
return viewAdapter;
}
IVsCodeWindow codeWindow = docView as IVsCodeWindow;
if (codeWindow != null)
{
IVsTextView codeView;
if (ErrorHandler.Succeeded(codeWindow.GetPrimaryView(out codeView)) && codeView != null)
{
return codeView;
}
}
return null;
}
示例12: 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);
}
示例13: OnBeforeDocumentWindowShow
public virtual int OnBeforeDocumentWindowShow(
uint docCookie,
int fFirstShow,
IVsWindowFrame pFrame
)
{
return VSConstants.S_OK;
}
示例14: OnBeforeDocumentWindowShow
public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame)
{
if (OnBeforeDocumentWindowShowEvent != null)
{
OnBeforeDocumentWindowShowEvent(docCookie,fFirstShow,pFrame);
}
return VSConstants.S_OK;
}
示例15: UDNDocView
public UDNDocView(string sourceFilePath, IWpfTextView textEditorView, IVsWindowFrame windowFrame, MarkdownPackage package, IVsUIShell uiShell)
{
SourceFilePath = sourceFilePath;
TextEditorView = textEditorView;
WindowFrame = windowFrame;
NavigateToComboData = new NavigateToComboData(textEditorView, uiShell);
ParsingResultsCache = new UDNParsingResultsCache(package, sourceFilePath, textEditorView);
}