First GadgeteerApp Event handler issue


I so hope that I post here in the correct section for my lill issue…
Probably most of you will laugh when you see my problem >.<

I work actually on my very first GadgeteerApp. Sofar I just have good Java knowledge… i expanded it to c# with a short crashcourse.

I installed all needed Programms and connected my FEZ Hydra (but Button1.4 and a LED7R)
The setup did work quiet well… i followed the tutorial on the FEZSpider Kit Guide.
Just somehow i don’t the the Button Event handling to work.
By typing “button.” I should get the selection to get “ButtonPressed” and so on… but somehow the button. is unknown to my program. do i have to initialize it manual somewhere or so?

Thx for a small tip to a beginner.

using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace GadgeteerApp1
    public partial class Program
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.

            Debug.Print("Program Started");

There is a quirk with the current SDK.
Build your solution then your button will appear…

1 Like

oh… that was simple… thank you very much.
… learning by doing…

Usually the way…

Have fun :slight_smile: