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


C# IMenuItemContext类代码示例

本文整理汇总了C#中IMenuItemContext的典型用法代码示例。如果您正苦于以下问题:C# IMenuItemContext类的具体用法?C# IMenuItemContext怎么用?C# IMenuItemContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: IsVisible

 public override bool IsVisible(IMenuItemContext context)
 {
     if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_TEXTEDITORCONTROL_GUID))
         return false;
     var uiContext = context.Find<ITextEditorUIContext>();
     return uiContext != null && uiContext.HasSelectedText;
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:7,代码来源:Commands.cs

示例2: Execute

 public override void Execute(IMenuItemContext context)
 {
     var res = GetReference(context);
     if (res == null)
         return;
     searchManager.Value.FollowResult(res, newTab);
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:7,代码来源:Commands.cs

示例3: Execute

        public override void Execute(IMenuItemContext context)
        {
            var modules = GetModules();
            if (modules.Length == 0)
                return;

            var lang = languageManager.Language;
            if (lang.ProjectFileExtension == null) {
                lang = languageManager.AllLanguages.FirstOrDefault(a => a.ProjectFileExtension != null);
                Debug.Assert(lang != null);
                if (lang == null)
                    return;
            }

            var task = new ExportTask(this, modules);
            var vm = new ExportToProjectVM(new PickDirectory(), languageManager, task, bamlDecompiler != null);
            task.vm = vm;
            vm.ProjectVersion = exportToProjectSettings.ProjectVersion;
            vm.CreateResX = fileTreeViewSettings.DeserializeResources;
            vm.DontReferenceStdLib = modules.Any(a => a.Assembly.IsCorLib());
            vm.Language = lang;
            vm.SolutionFilename = GetSolutionFilename(modules);
            vm.FilesToExportMessage = CreateFilesToExportMessage(modules);

            var win = new ExportToProjectDlg();
            task.dlg = win;
            win.DataContext = vm;
            win.Owner = appWindow.MainWindow;
            using (fileTreeView.FileManager.DisableAssemblyLoad())
                win.ShowDialog();
            if (vm.IsComplete)
                exportToProjectSettings.ProjectVersion = vm.ProjectVersion;
        }
开发者ID:n017,项目名称:dnSpy,代码行数:33,代码来源:SaveCommands.cs

示例4: Execute

			public override void Execute(IMenuItemContext context) {
				var type = GetTypeRef(context, guid)?.ResolveTypeDef();
				if (type == null)
					return;
				foreach (var method in type.Methods)
					breakpointService.Value.Add(method);
			}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:CtxMenuCommands.cs

示例5: Create

		public IEnumerable<CreatedMenuItem> Create(IMenuItemContext context) {
			foreach (var theme in themeService.VisibleThemes) {
				var attr = new ExportMenuItemAttribute { Header = theme.GetMenuName() };
				var tmp = theme;
				var item = new MyMenuItem(ctx => themeService.Theme = tmp, theme == themeService.Theme);
				yield return new CreatedMenuItem(attr, item);
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:ThemesMenu.cs

示例6: GetEntryPoint

			static MethodDef GetEntryPoint(IMenuItemContext context) {
				if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_DOCUMENTS_TREEVIEW_GUID))
					return null;
				var nodes = context.Find<TreeNodeData[]>();
				var node = nodes == null || nodes.Length == 0 ? null : nodes[0];
				var module = node.GetModule();
				return module == null ? null : module.EntryPoint as MethodDef;
			}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:EntryPointCommands.cs

示例7: IsVisible

		public override bool IsVisible(IMenuItemContext context) {
			if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_TEXTEDITORCONTROL_GUID))
				return false;
			var uiContext = context.Find<ITextEditorUIContext>();
			if (uiContext == null)
				return false;
			var nodes = uiContext.FileTab.Content.Nodes.ToArray();
			return nodes.Length == 1 && nodes[0] is BamlResourceElementNode;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:9,代码来源:MenuCommands.cs

示例8: Execute

		public override void Execute(IMenuItemContext context) {
			var md = GetTokenObj(context);
			if (md != null) {
				try {
					Clipboard.SetText(string.Format("{0:X8}", md.MDToken.Raw));
				}
				catch (ExternalException) { }
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:CodeCtxMenus.cs

示例9: IsVisible

		public override bool IsVisible(IMenuItemContext context) {
			if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_DOCUMENTVIEWERCONTROL_GUID))
				return false;
			var uiContext = context.Find<IDocumentViewer>();
			if (uiContext == null)
				return false;
			var nodes = uiContext.DocumentTab.Content.Nodes.ToArray();
			return nodes.Length == 1 && nodes[0] is BamlResourceElementNode;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:MenuCommands.cs

示例10: GetReference

			internal static uint? GetReference(IMenuItemContext context, string guid) {
				if (context.CreatorObject.Guid != new Guid(guid))
					return null;
				var @ref = context.Find<CodeReference>();
				if (@ref != null && @ref.Reference is IMDTokenProvider)
					return ((IMDTokenProvider)@ref.Reference).MDToken.Raw;
				if (@ref != null && @ref.Reference is TokenReference)
					return ((TokenReference)@ref.Reference).Token;
				return null;
			}
开发者ID:levisre,项目名称:dnSpy,代码行数:10,代码来源:CopyTokenCommand.cs

示例11: Create

 public IEnumerable<CreatedMenuItem> Create(IMenuItemContext context)
 {
     foreach (var theme in themeManager.AllThemesSorted) {
         if (!themeManager.Settings.ShowAllThemes && !themeManager.IsHighContrast && theme.IsHighContrast)
             continue;
         var attr = new ExportMenuItemAttribute { Header = GetThemeHeaderName(theme) };
         var tmp = theme;
         var item = new MyMenuItem(ctx => themeManager.Theme = tmp, theme == themeManager.Theme);
         yield return new CreatedMenuItem(attr, item);
     }
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:11,代码来源:ThemesMenu.cs

示例12: GetStatements

		public static IList<MethodSourceStatement> GetStatements(IMenuItemContext context) {
			if (context == null)
				return null;
			if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_DOCUMENTVIEWERCONTROL_GUID))
				return null;
			var uiContext = context.Find<IDocumentViewer>();
			if (uiContext == null)
				return null;
			var pos = context.Find<TextEditorPosition>();
			if (pos == null)
				return null;
			return GetStatements(uiContext, pos.Position);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:13,代码来源:BodyCommandUtils.cs

示例13: Execute

 public override void Execute(IMenuItemContext context)
 {
     var tabs = tabCreators.SelectMany(a => a.Value.Create()).OrderBy(a => a.Order).ToArray();
     var dlg = new AppSettingsDlg(tabs);
     dlg.Owner = appWindow.MainWindow;
     bool saveSettings = dlg.ShowDialog() == true;
     var appRefreshSettings = new AppRefreshSettings();
     foreach (var tab in tabs)
         tab.OnClosed(saveSettings, appRefreshSettings);
     if (saveSettings) {
         foreach (var listener in listeners)
             listener.Value.OnSettingsModified(appRefreshSettings);
     }
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:14,代码来源:ShowAppSettings.cs

示例14: Execute

		public override void Execute(IMenuItemContext context) {
			if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_FILES_TREEVIEW_GUID))
				return;
			var asms = new List<IDnSpyFile>();
			foreach (var node in (context.Find<ITreeNodeData[]>() ?? new ITreeNodeData[0])) {
				var file = GetDnSpyFile(node);
				if (file != null)
					asms.Add(file);
			}
			foreach (var asm in asms) {
				var peImage = asm.PEImage;
				if (peImage != null)
					peImage.UnsafeDisableMemoryMappedIO();
			}
		}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:15,代码来源:AssemblyCommands.cs

示例15: Execute

		public override void Execute(IMenuItemContext context) {
			if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_DOCUMENTS_TREEVIEW_GUID))
				return;
			var asms = new List<IDsDocument>();
			foreach (var node in (context.Find<TreeNodeData[]>() ?? Array.Empty<TreeNodeData>())) {
				var file = GetDocument(node);
				if (file != null)
					asms.Add(file);
			}
			foreach (var asm in asms) {
				var peImage = asm.PEImage;
				if (peImage != null)
					peImage.UnsafeDisableMemoryMappedIO();
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:15,代码来源:AssemblyCommands.cs


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