本文整理汇总了C#中ContextMenuEntryContext类的典型用法代码示例。如果您正苦于以下问题:C# ContextMenuEntryContext类的具体用法?C# ContextMenuEntryContext怎么用?C# ContextMenuEntryContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContextMenuEntryContext类属于命名空间,在下文中一共展示了ContextMenuEntryContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextEditor_IsVisible
static bool TextEditor_IsVisible(ContextMenuEntryContext context) {
ModuleDef module;
return context.Element is DecompilerTextView &&
(module = GoToEntryPointCommand.GetModule()) != null &&
module.GlobalType != null &&
module.GlobalType.FindStaticConstructor() != null;
}
示例2: Initialize
public override void Initialize(ContextMenuEntryContext context, MenuItem menuItem)
{
var tokRef = GetTokenReference(context);
menuItem.Header = string.Format("Go to MD Table Row ({0:X8})", tokRef.Token);
if (context.Element == MainWindow.Instance.treeView || context.Element is DecompilerTextView)
menuItem.InputGestureText = "Shift+Alt+R";
}
示例3: TreeView_IsVisible
static bool TreeView_IsVisible(ContextMenuEntryContext context) {
ModuleDef module;
return context.Element == MainWindow.Instance.treeView &&
((module = ILSpyTreeNode.GetModule(context.SelectedTreeNodes)) != null) &&
module.GlobalType != null &&
module.GlobalType.FindStaticConstructor() != null;
}
示例4: Execute
public void Execute(ContextMenuEntryContext context) {
if (context.SelectedTreeNodes != null) {
foreach (var node in context.SelectedTreeNodes) {
node.Parent.Children.Remove(node);
}
}
}
示例5: GetTreeNode
static ILSpyTreeNode GetTreeNode(ContextMenuEntryContext context) {
if (context.Element is DecompilerTextView)
return MainWindow.Instance.treeView.SelectedItem as ILSpyTreeNode;
if (context.SelectedTreeNodes != null && context.SelectedTreeNodes.Length != 0)
return context.SelectedTreeNodes[0] as ILSpyTreeNode;
return null;
}
示例6: IsVisible
public bool IsVisible(ContextMenuEntryContext context) {
if (context.SelectedTreeNodes != null)
return context.SelectedTreeNodes.Length > 0 && context.SelectedTreeNodes.All(n => n is NamespaceTreeNode || n is IMemberTreeNode);
if (context.Reference != null && context.Reference.Reference is IMemberRef)
return IsPublic(context.Reference.Reference as IMemberRef);
return false;
}
示例7: GetFile
static MemoryModuleDefFile GetFile(ContextMenuEntryContext context) {
var modNode = ILSpyTreeNode.GetNode<AssemblyTreeNode>(GetTreeNode(context));
var mfile = modNode == null ? null : modNode.DnSpyFile as MemoryModuleDefFile;
if (mfile == null)
return null;
if (mfile.Process.HasExited || mfile.Process.Debugger.ProcessState == DebuggerProcessState.Terminated)
return null;
return mfile;
}
示例8: IsVisible
public bool IsVisible(ContextMenuEntryContext context) {
if (!CanExecute())
return false;
if (context.Element is DecompilerTextView)
return true;
if (context.SelectedTreeNodes == null || context.SelectedTreeNodes.Length == 0)
return false;
var elem = context.SelectedTreeNodes[0];
return elem is ILSpyTreeNode || elem is AnalyzerTreeNode;
}
示例9: GetReference
protected IMDTokenProvider GetReference(ContextMenuEntryContext context) {
if (context.Reference != null)
return context.Reference.Reference as IMDTokenProvider;
if (context.SelectedTreeNodes != null && context.SelectedTreeNodes.Length != 0 &&
context.SelectedTreeNodes[0] is ITokenTreeNode) {
return ((ITokenTreeNode)context.SelectedTreeNodes[0]).MDTokenProvider;
}
return null;
}
示例10: Execute
public override void Execute(ContextMenuEntryContext context) {
var obj = GetReference(context);
if (obj != null) {
var member = MainWindow.ResolveReference(obj);
if (member == null)
MainWindow.Instance.ShowMessageBox("Could not resolve member definition");
else
Execute(member);
}
}
示例11: Execute
public void Execute(ContextMenuEntryContext context) {
if (context.Element != MainWindow.Instance.treeView)
return;
var asms = new List<DnSpyFile>();
foreach (var node in context.SelectedTreeNodes) {
var file = GetDnSpyFile(node);
if (file != null)
asms.Add(file);
}
if (asms.Count > 0)
MainWindow.Instance.DisableMemoryMappedIO(asms);
}
示例12: IsEnabled
public bool IsEnabled(ContextMenuEntryContext context) {
if (context.Element is AnalyzerTreeView && context.SelectedTreeNodes != null && context.SelectedTreeNodes.Length > 0 && context.SelectedTreeNodes.All(n => n.Parent.IsRoot))
return false;
if (context.SelectedTreeNodes == null)
return context.Reference != null && MainWindow.ResolveReference(context.Reference.Reference) != null;
foreach (var node in context.SelectedTreeNodes) {
var mr = node as IMemberTreeNode;
if (mr != null && CanAnalyze(mr.Member))
return true;
}
return false;
}
示例13: Execute
public void Execute(ContextMenuEntryContext context) {
if (context.Element != MainWindow.Instance.treeView)
return;
var asms = new List<LoadedAssembly>();
foreach (var node in context.SelectedTreeNodes) {
var loadedAsm = GetLoadedAssembly(node);
if (loadedAsm != null)
asms.Add(loadedAsm);
}
if (asms.Count > 0)
MainWindow.Instance.DisableMemoryMappedIO(asms);
}
示例14: Execute
public void Execute(ContextMenuEntryContext context) {
// Known problem: explorer can't show files in the .NET 2.0 GAC.
var asmNode = (AssemblyTreeNode)context.SelectedTreeNodes[0];
var filename = asmNode.LoadedAssembly.FileName;
var args = string.Format("/select,{0}", filename);
try {
Process.Start(new ProcessStartInfo("explorer.exe", args));
}
catch (IOException) {
}
catch (Win32Exception) {
}
}
示例15: Execute
public void Execute(ContextMenuEntryContext context)
{
if (context.SelectedTreeNodes != null) {
foreach (var node in context.SelectedTreeNodes) {
var mr = node as IMemberTreeNode;
if (mr != null)
Analyze(mr.Member);
}
} else if (context.Reference != null && context.Reference.Reference is IMemberRef) {
if (context.Reference.Reference is IMemberRef)
Analyze((IMemberRef)context.Reference.Reference);
}
}