/TestPlugin/MainMenuCommand.cs

http://github.com/icsharpcode/ILSpy · C# · 28 lines · 15 code · 2 blank · 11 comment · 0 complexity · cd3a103b9ac9c4b4aaefaf0b03093bfb MD5 · raw file

  1. // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
  2. // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
  3. using ICSharpCode.ILSpy;
  4. namespace TestPlugin
  5. {
  6. // Menu: menu into which the item is added
  7. // MenuIcon: optional, icon to use for the menu item. Must be embedded as "Resource" (WPF-style resource) in the same assembly as the command type.
  8. // Header: text on the menu item
  9. // MenuCategory: optional, used for grouping related menu items together. A separator is added between different groups.
  10. // MenuOrder: controls the order in which the items appear (items are sorted by this value)
  11. [ExportMainMenuCommand(Menu = "_File", MenuIcon = "Clear.png", Header = "_Clear List", MenuCategory = "Open", MenuOrder = 1.5)]
  12. // ToolTip: the tool tip
  13. // ToolbarIcon: The icon. Must be embedded as "Resource" (WPF-style resource) in the same assembly as the command type.
  14. // ToolbarCategory: optional, used for grouping related toolbar items together. A separator is added between different groups.
  15. // ToolbarOrder: controls the order in which the items appear (items are sorted by this value)
  16. [ExportToolbarCommand(ToolTip = "Clears the current assembly list", ToolbarIcon = "Clear.png", ToolbarCategory = "Open", ToolbarOrder = 1.5)]
  17. public class UnloadAllAssembliesCommand : SimpleCommand
  18. {
  19. public override void Execute(object parameter)
  20. {
  21. foreach (var loadedAssembly in MainWindow.Instance.CurrentAssemblyList.GetAssemblies()) {
  22. loadedAssembly.AssemblyList.Unload(loadedAssembly);
  23. }
  24. }
  25. }
  26. }