mirror of https://github.com/icsharpcode/ILSpy.git
6 changed files with 144 additions and 13 deletions
@ -0,0 +1,53 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy |
||||||
|
{ |
||||||
|
[ExportToolbarCommand(ToolTip = "Back", Icon = "Images/Back.png", Category = "Navigation")] |
||||||
|
sealed class BrowseBackCommand : CommandWrapper { |
||||||
|
public BrowseBackCommand() : base(NavigationCommands.BrowseBack) {} |
||||||
|
} |
||||||
|
|
||||||
|
[ExportToolbarCommand(ToolTip = "Forward", Icon = "Images/Forward.png", Category = "Navigation", Order = 1)] |
||||||
|
sealed class BrowseForwardCommand : CommandWrapper { |
||||||
|
public BrowseForwardCommand() : base(NavigationCommands.BrowseForward) {} |
||||||
|
} |
||||||
|
|
||||||
|
[ExportToolbarCommand(ToolTip = "Open", Icon = "Images/Open.png", Category = "Open")] |
||||||
|
sealed class OpenCommand : CommandWrapper { |
||||||
|
public OpenCommand() : base(ApplicationCommands.Open) {} |
||||||
|
} |
||||||
|
|
||||||
|
[ExportToolbarCommand(ToolTip = "Reload all assemblies", Icon = "Images/Refresh.png", Category = "Open", Order = 1)] |
||||||
|
sealed class RefreshCommand : CommandWrapper { |
||||||
|
public RefreshCommand() : base(NavigationCommands.Refresh) {} |
||||||
|
} |
||||||
|
|
||||||
|
class CommandWrapper : ICommand |
||||||
|
{ |
||||||
|
ICommand wrappedCommand; |
||||||
|
|
||||||
|
public CommandWrapper(ICommand wrappedCommand) |
||||||
|
{ |
||||||
|
this.wrappedCommand = wrappedCommand; |
||||||
|
} |
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged { |
||||||
|
add { wrappedCommand.CanExecuteChanged += value; } |
||||||
|
remove { wrappedCommand.CanExecuteChanged -= value; } |
||||||
|
} |
||||||
|
|
||||||
|
public void Execute(object parameter) |
||||||
|
{ |
||||||
|
wrappedCommand.Execute(parameter); |
||||||
|
} |
||||||
|
|
||||||
|
public bool CanExecute(object parameter) |
||||||
|
{ |
||||||
|
return wrappedCommand.CanExecute(parameter); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.ComponentModel.Composition; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy |
||||||
|
{ |
||||||
|
#region Toolbar
|
||||||
|
public interface IToolbarCommandMetadata |
||||||
|
{ |
||||||
|
string Icon { get; } |
||||||
|
string ToolTip { get; } |
||||||
|
string Category { get; } |
||||||
|
|
||||||
|
double Order { get; } |
||||||
|
} |
||||||
|
|
||||||
|
[MetadataAttribute] |
||||||
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false)] |
||||||
|
public class ExportToolbarCommandAttribute : ExportAttribute |
||||||
|
{ |
||||||
|
public ExportToolbarCommandAttribute() |
||||||
|
: base(typeof(ICommand)) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public string ToolTip { get; set; } |
||||||
|
public string Icon { get; set; } |
||||||
|
public string Category { get; set; } |
||||||
|
public double Order { get; set; } |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
} |
Loading…
Reference in new issue