Main Site Documentation

Getting started with gadgeteer forms?


#1

Anybody have some pointers on starting a windows forms-like project on spider?

I seem to be having a hard time figuring out if Glide is best for this or WCF or something else or what… Is there an obvious answer here?

Little help, please?


#2

Glide is the way to go


#3

…and 2 minutes later, I’ve got it working. Crazy-easy once you know where to start.

Thanks, Gus!


#4

More info added http://tinyclr.com/forum/21/4383/


#5

Hi,

For future reference, below is an example of using a WPF window with Gadgeteer. The key trick is to use the WPFWindow property from the Display_T35 object (named “display” in the example below).

The example assumes that you have an image called “hello.jpg” loaded into the resources. It also shows how to use the TouchUp and TouchDown events associated witht this WPF object.

Hope this helps,

Nic


using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;

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

namespace GadgeteerApp1
{
    public partial class Program
    {
        void ProgramStarted()
        {
            /******************************************************************************************
            Access modules defined in the designer by typing their name:                            
            
            e.g.  button
                  camera1

            Initialize event handlers here.
            e.g. button.ButtonPressed += new GTM.MSR.Button.ButtonEventHandler(button_ButtonPressed);             
            ***************************************************************************************** */
            SetupWindow();

            // Do one-time tasks here
            Debug.Print("Program Started");
        }

        Window window;
        Canvas canvas;
        Image image;
        Text text;

        void SetupWindow()
        {
            window = display.WPFWindow;
            canvas = new Canvas();

            window.Child = canvas;

            image = new Image(Resources.GetBitmap(Resources.BitmapResources.hello));

            canvas.Children.Add(image);

            Canvas.SetLeft(image, 50);
            Canvas.SetTop(image, 40);

            text = new Text(Resources.GetFont(Resources.FontResources.NinaB), "hello");

            canvas.Children.Add(text);

            Canvas.SetTop(text, 100);
            Canvas.SetRight(text, 100);

            image.TouchDown += new Microsoft.SPOT.Input.TouchEventHandler(image_TouchDown);
            image.TouchUp += new Microsoft.SPOT.Input.TouchEventHandler(image_TouchUp);

        }

        void image_TouchUp(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            text.TextContent = "touch up";
        }

        void image_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            text.TextContent = "touch down";
        }
    }
}
]