forked from rubberduck-vba/Rubberduck
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Implemented ICommand - removed existing RD menu."
This reverts commit 910309a.
- Loading branch information
1 parent
6fffafb
commit 53d9ddc
Showing
15 changed files
with
286 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,41 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.Linq; | ||
using Microsoft.Office.Core; | ||
using Microsoft.Vbe.Interop; | ||
|
||
namespace Rubberduck.UI.Commands | ||
{ | ||
public class AboutCommand : ICommand | ||
/// <summary> | ||
/// A command that displays the "About" dialog. | ||
/// </summary> | ||
public class AboutCommand : RubberduckCommandBase | ||
{ | ||
public void Execute() | ||
private readonly VBE _vbe; | ||
|
||
public AboutCommand(IRubberduckMenuCommand command, VBE vbe) | ||
: base(command) | ||
{ | ||
using (var window = new _AboutWindow()) | ||
_vbe = vbe; | ||
} | ||
|
||
public override void Initialize() | ||
{ | ||
var parent = _vbe.CommandBars[1].Controls.OfType<CommandBarPopup>() | ||
.SingleOrDefault(control => control.Caption == RubberduckUI.RubberduckMenu); | ||
|
||
if (parent == null) | ||
{ | ||
window.ShowDialog(); | ||
throw new ParentMenuNotFoundException(RubberduckUI.RubberduckMenu); | ||
} | ||
|
||
Command.AddCommandBarButton(parent.Controls, RubberduckUI.RubberduckMenu_About, true); | ||
} | ||
} | ||
|
||
public class AboutCommandMenuItem : CommandMenuItemBase | ||
{ | ||
public AboutCommandMenuItem(ICommand command) | ||
: base(command) | ||
public override void ExecuteAction() | ||
{ | ||
using (var window = new _AboutWindow()) | ||
{ | ||
window.ShowDialog(); | ||
} | ||
} | ||
|
||
public override string Key { get { return "RubberduckMenu_About"; } } | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Drawing; | ||
using Microsoft.Office.Core; | ||
|
||
namespace Rubberduck.UI.Commands | ||
{ | ||
/// <summary> | ||
/// An object that encapsulates the logic to wire up a number of CommandBarControl instances to a specific command. | ||
/// </summary> | ||
public interface IRubberduckMenuCommand | ||
{ | ||
/// <summary> | ||
/// Associates a new <see cref="CommandBarButton"/> to the command. | ||
/// </summary> | ||
/// <param name="parent">The parent control collection to add the button to.</param> | ||
/// <param name="caption">The localized caption for the command.</param> | ||
/// <param name="beginGroup">Optionally specifies that the UI element begins a command group.</param> | ||
/// <param name="beforeIndex">Optionally specifies the index of the UI element in the parent collection.</param> | ||
/// <param name="image">An optional icon to represent the command.</param> | ||
/// <param name="mask">A transparency mask for the command's icon. Required if <see cref="image"/> is not null.</param> | ||
void AddCommandBarButton(CommandBarControls parent, string caption, bool beginGroup = false, int? beforeIndex = null, Image image = null, Image mask = null); | ||
|
||
/// <summary> | ||
/// Destroys all UI elements associated to the command. | ||
/// </summary> | ||
void Release(); | ||
|
||
/// <summary> | ||
/// Requests execution of the command. | ||
/// </summary> | ||
event EventHandler RequestExecute; | ||
} | ||
} |
Oops, something went wrong.