aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-05 15:26:01 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-05 15:26:01 +0300
commitb1b9ec165cc318caed1fc9b5919a03029b6cb29e (patch)
treef1acb7c17b4ac0f21a6572c837105a9fd581b0ae /Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs
parentac0a8a7715360263973fda940f9138cf7d5141d7 (diff)
downloadTango-b1b9ec165cc318caed1fc9b5919a03029b6cb29e.tar.gz
Tango-b1b9ec165cc318caed1fc9b5919a03029b6cb29e.zip
Completed Remote Debugger VSIX !!!
Added 2 dancer parameters. Refactored Tech Board to reset configuration when connected machine changes.
Diffstat (limited to 'Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs')
-rw-r--r--Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs38
1 files changed, 36 insertions, 2 deletions
diff --git a/Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs b/Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs
index 2acc25187..4bc972fbb 100644
--- a/Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs
+++ b/Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs
@@ -20,6 +20,7 @@ using Tango.Core.IO;
using Tango.PMR.IO;
using Google.Protobuf;
using EnvDTE;
+using System.Collections.Generic;
namespace Tango.BuildExtensions
{
@@ -32,6 +33,9 @@ namespace Tango.BuildExtensions
private ITransporter transporter;
private bool _attached;
private string processId;
+ private OleMenuCommand _menuCommand;
+ private IList<Project> _projects;
+
/// <summary>
/// Command ID.
@@ -64,14 +68,44 @@ namespace Tango.BuildExtensions
_dteDebuggerEvents.OnEnterDesignMode += _dteDebuggerEvents_OnEnterDesignMode;
+ DTE.Events.SolutionEvents.Opened += () =>
+ {
+ _projects = GetSolutionProjects().ToList();
+ };
+
this.package = package;
OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (commandService != null)
{
var menuCommandID = new CommandID(CommandSet, CommandId);
- var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID);
- commandService.AddCommand(menuItem);
+ _menuCommand = new OleMenuCommand(this.MenuItemCallback, menuCommandID);
+ _menuCommand.Visible = false;
+ _menuCommand.BeforeQueryStatus += _menuCommand_BeforeQueryStatus;
+ commandService.AddCommand(_menuCommand);
+ }
+ }
+
+ private void _menuCommand_BeforeQueryStatus(object sender, EventArgs e)
+ {
+ (sender as OleMenuCommand).Visible = false;
+
+ if (DTE.Debugger.CurrentMode == dbgDebugMode.dbgDesignMode
+ && DTE.Solution != null
+ && DTE.Solution.IsOpen)
+ {
+ String projectName = DTE.Solution.Properties.Item("StartupProject").Value.ToStringSafe();
+
+ if (projectName != null)
+ {
+ var project = _projects.SingleOrDefault(x => x.Name == projectName);
+ String path = GetProjectOutputFilePath(project);
+
+ if (Path.GetExtension(path.ToLower()) == ".exe")
+ {
+ (sender as OleMenuCommand).Visible = true;
+ }
+ }
}
}