Skip to content

Commit

Permalink
Remove-the-Disable-commands-feature
Browse files Browse the repository at this point in the history
remove the calls to CommandController
  • Loading branch information
Enache-Ionut authored Oct 19, 2017
2 parents 50c0c0e + 8e1c011 commit 2155508
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions ClangPowerTools/ClangPowerTools/ClangPowerTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System.Design" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions ClangPowerTools/ClangPowerTools/CommandsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Windows.Interop;
using System.Windows.Threading;

Expand Down Expand Up @@ -48,6 +49,7 @@ public void QueryCommandHandler(object sender, EventArgs e)
{
if (sender is OleMenuCommand command)
{
//MessageBox.Show(command.CommandID.ID.ToString());
command.Enabled = !Running;
command.Visible = true;
}
Expand Down
10 changes: 5 additions & 5 deletions ClangPowerTools/ClangPowerTools/CompileCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ private CompileCommand(Package aPackage, DTE2 aDte, string aEdition,
if (this.ServiceProvider.GetService(typeof(IMenuCommandService)) is OleMenuCommandService commandService)
{
var menuCommandID = new CommandID(CommandSet, CommandId);
var menuItem = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
menuItem.BeforeQueryStatus += mCommandsController.QueryCommandHandler;
commandService.AddCommand(menuItem);
var menuCommand = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
//menuCommand.BeforeQueryStatus += mCommandsController.QueryCommandHandler;
commandService.AddCommand(menuCommand);
}
}

Expand Down Expand Up @@ -109,7 +109,7 @@ public static void Initialize(Package aPackage, DTE2 aDte, string aEdition,
/// <param name="e">Event args.</param>
private void MenuItemCallback(object sender, EventArgs e)
{
mCommandsController.Running = true;
//mCommandsController.Running = true;
var task = System.Threading.Tasks.Task.Run(() =>
{
GeneralOptions generalOptions = (GeneralOptions)mPackage.GetDialogPage(typeof(GeneralOptions));
Expand Down Expand Up @@ -162,7 +162,7 @@ private void MenuItemCallback(object sender, EventArgs e)
VsShellUtilities.ShowMessageBox(mPackage, exception.Message, "Error",
OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
}).ContinueWith(tsk => mCommandsController.AfterExecute());
});//.ContinueWith(tsk => mCommandsController.AfterExecute());
}

#endregion
Expand Down
12 changes: 6 additions & 6 deletions ClangPowerTools/ClangPowerTools/TidyCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ private TidyCommand(Package aPackage, DTE2 aDte, string aEdition,
if (this.ServiceProvider.GetService(typeof(IMenuCommandService)) is OleMenuCommandService commandService)
{
var menuCommandID = new CommandID(CommandSet, CommandId);
var menuItem = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
menuItem.BeforeQueryStatus += mCommandsController.QueryCommandHandler;
commandService.AddCommand(menuItem);
var menuCommand = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
//menuCommand.BeforeQueryStatus += mCommandsController.QueryCommandHandler;
commandService.AddCommand(menuCommand);
}
}

Expand Down Expand Up @@ -116,7 +116,7 @@ public static void Initialize(Package aPackage, DTE2 aDte, string aEdition,
/// <param name="e">Event args.</param>
private void MenuItemCallback(object sender, EventArgs e)
{
mCommandsController.Running = true;
//mCommandsController.Running = true;
System.Threading.Tasks.Task.Run(() =>
{
GeneralOptions generalOptions = (GeneralOptions)mPackage.GetDialogPage(typeof(GeneralOptions));
Expand Down Expand Up @@ -145,7 +145,7 @@ private void MenuItemCallback(object sender, EventArgs e)
}
using (var guard = new SilentFileChangerGuard())
{
if(tidyPage.Fix)
if (tidyPage.Fix)
{
WatchFiles();
SilentFiles(guard);
Expand Down Expand Up @@ -180,7 +180,7 @@ private void MenuItemCallback(object sender, EventArgs e)
VsShellUtilities.ShowMessageBox(mPackage, exception.Message, "Error",
OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
}).ContinueWith(tsk => mCommandsController.AfterExecute()); ;
});//.ContinueWith(tsk => mCommandsController.AfterExecute()); ;
}

#endregion
Expand Down

0 comments on commit 2155508

Please sign in to comment.