Skip to content

Commit 7215768

Browse files
committed
Adds preleminary support for a button to set the main robot project
Will allow teams to select which robot project is the main robot project. Will work together with the project changes made earlier. Might also add a direct deploy button, which should help some things too.
1 parent 3ed299c commit 7215768

File tree

5 files changed

+60
-0
lines changed

5 files changed

+60
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using EnvDTE;
8+
using EnvDTE80;
9+
using Microsoft.VisualStudio;
10+
using Microsoft.VisualStudio.Shell;
11+
using Microsoft.VisualStudio.Shell.Interop;
12+
using VSLangProj;
13+
14+
namespace RobotDotNet.FRC_Extension.Buttons
15+
{
16+
public class SetMainRobotButton : ButtonBase
17+
{
18+
public SetMainRobotButton(Frc_ExtensionPackage package) : base(package, true, GuidList.guidFRC_ExtensionCmdSet, (int)PkgCmdIDList.cmdidSetRobotProject)
19+
{
20+
}
21+
22+
public override void QueryCallback(object sender, EventArgs e)
23+
{
24+
var menuCommand = sender as OleMenuCommand;
25+
if (menuCommand != null)
26+
{
27+
menuCommand.Visible = false;
28+
menuCommand.Enabled = false;
29+
}
30+
}
31+
32+
public override void ButtonCallback(object sender, EventArgs e)
33+
{
34+
OutputWriter.Instance.WriteLine("Set Pressed");
35+
}
36+
}
37+
}

FRC-Extension/FRC-Extension.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
<Compile Include="Buttons\KillButton.cs" />
174174
<Compile Include="Buttons\NetConsoleButton.cs" />
175175
<Compile Include="Buttons\SaveMonoButton.cs" />
176+
<Compile Include="Buttons\SetMainRobotButton.cs" />
176177
<Compile Include="Buttons\SettingsButton.cs" />
177178
<Compile Include="MonoCode\MonoDeploy.cs" />
178179
<Compile Include="MonoCode\MonoFile.cs" />

FRC-Extension/FRC-Extension.vsct

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
<Parent guid ="guidFRC_ExtensionCmdSet" id="MonoSubMenu"/>
6767
</Group>
6868

69+
<Group guid="guidFRC_ExtensionCmdSet" id="MonoSetRobotProjectGroup" priority="0x0600">
70+
<Parent guid ="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/>
71+
</Group>
72+
6973
</Groups>
7074

7175
<!--Buttons section. -->
@@ -80,6 +84,16 @@
8084
<CommandFlag>DynamicVisibility</CommandFlag>
8185
If you do not want an image next to your command, remove the Icon node /> -->
8286

87+
<Button guid="guidFRC_ExtensionCmdSet" id="cmdidSetRobotProject" priority="0x0102" type="Button">
88+
<Parent guid="guidFRC_ExtensionCmdSet" id="MonoSetRobotProjectGroup"/>
89+
<CommandFlag>DynamicVisibility</CommandFlag>
90+
<CommandFlag>DefaultInvisible</CommandFlag>
91+
<Strings>
92+
<ButtonText>Set Main Robot Project</ButtonText>
93+
<CommandName>cmdidSetRobotProject</CommandName>
94+
</Strings>
95+
</Button>
96+
8397
<Button guid="guidFRC_ExtensionCmdSet" id="cmdidDeployCode" priority="0x0100" type="Button">
8498
<Parent guid="guidFRC_ExtensionCmdSet" id="FRCMainMenuGroup" />
8599
<CommandFlag>DynamicVisibility</CommandFlag>
@@ -207,6 +221,8 @@
207221
<IDSymbol name="MonoSubMenuGroup" value="0x1150"/>
208222
<IDSymbol name="cmdidDownloadMono" value="0x0104"/>
209223
<IDSymbol name="cmdidInstallMono" value="0x0105"/>
224+
<IDSymbol name="MonoSetRobotProjectGroup" value="0x2052"/>
225+
<IDSymbol name="cmdidSetRobotProject" value="0x2055"/>
210226
</GuidSymbol>
211227

212228

FRC-Extension/FRC-ExtensionPackage.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ internal DialogPage PublicGetDialogPage(Type dialogPageType)
8686
private NetConsoleButton m_netConsoleButton;
8787
private SettingsButton m_settingsButton;
8888

89+
private SetMainRobotButton m_setMainRobotButton;
90+
8991
/////////////////////////////////////////////////////////////////////////////
9092
// Overridden Package Implementation
9193
#region Package Members
@@ -123,6 +125,8 @@ protected override void Initialize()
123125
m_aboutButton = new AboutButton(this);
124126
m_netConsoleButton = new NetConsoleButton(this);
125127
m_settingsButton = new SettingsButton(this);
128+
129+
m_setMainRobotButton = new SetMainRobotButton(this);
126130

127131

128132
}

FRC-Extension/PkgCmdID.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ static class PkgCmdIDList
2525

2626
public const uint cmdidSaveMonoFile = 0x108;
2727

28+
public const uint cmdidSetRobotProject = 0x2055;
29+
2830
};
2931
}

0 commit comments

Comments
 (0)