Windows MaestroExample SDK code

I am a pretty inexperienced programmer and this is my first endeavor into visual C#, which is most likely the reason that I am having trouble. I did, however, spend several hours making an effort toward not asking an incredibly stupid question. So, I hope that my time has paid off…

I’m interested in manipulating the MaestroExample code in the SDK for a robotics project, in which I will be setting the target of several servos based on keystroke input. So far I’m following the code behind the example without much trouble. The major source of confusion for me is that I’m not sure where to find the actions for the GUI elements. I see that these elements are declared in the MainWindow, but I can’t see where they are linked to actions.

In particular, the ActivateCheckBox definition is in the MainWindow.Designer.cs file, but where would I find the code that causes the servo response when it is run?

I see in another post that this command is used to set the target:

usc.setTarget(servoNumber, servoTarget);

One of the prerequisites for this command is given:

That’s where I’m having my problem. I don’t know where to see the code in MaestroExample. I’m sure I’m just lost in the unfamiliarities of C# and USB API code (I have a copy of Jan Axelson’s USB Complete on its way to help with that), and so it would be immensely appreciated if someone could get me pointed in the right direction.


Hi Dan,
It sounds like you just have not found the MainWindow.cs file. That is where all of the actions and graphical objects are linked together. This is a bit confusing, since double-clicking on MainWindow.cs in the Solution Explorer brings up the graphical designer. You can get to the actual code by right-clicking on the entry for that file and selecting “View code” or by selecting that option from the View menu within the designer. Other ways to get there are to double-click on events linked to functions in the designer properties window (double-clicking on an unassigned event will automatically create a function and connect it to the event), or to right click on a symbol in some code that you are looking at and select “find all references.”

I think that will clear a lot of things up for you! Good luck exploring the code and please let me know if you have more questions.


Thanks Paul! I see now, the MainWindow.cs is a Window Form with acutal content. I thought it was just a symbol that was there to designate a subsection, and never even thought to try to open it! That also helps explain where to get started on designing a GUI in visual c#, if I decide to. Awesome, and thanks again for the help!