Ejemplo n.º 1
0
        public static void TouchscreenAlphanumericDialogTest(
            NwazetGoImaging.VirtualCanvas canvas)
        {
            canvas.SetOrientation(NwazetGoImaging.Orientation.Landscape);
            var response = canvas.TouchscreenShowDialog(NwazetGoImaging.DialogType.Alphanumeric);

            Debug.Print("User Input: " + response);
            canvas.SetOrientation(NwazetGoImaging.Orientation.Portrait);
            response = canvas.TouchscreenShowDialog(NwazetGoImaging.DialogType.Alphanumeric);
            Debug.Print("User Input: " + response);
        }
Ejemplo n.º 2
0
        public static void InitializeHerdRider(NwazetGoImaging.VirtualCanvas canvas)
        {
            canvas.SetOrientation(NwazetGoImaging.Orientation.Portrait);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(35, 10, (ushort)NwazetGoImaging.BasicColor.Black, NwazetGoFonts.DejaVuSansBold9.ID, "Herd Rider by Larouex");

            var fontInfo = new NwazetGoFonts.DejaVuSans9().GetFontInfo();

            var button = new NwazetGoDisplayTouchScreen.ButtonWidget(10, 30, 220, 50, fontInfo, "Configure WiFi");

            button.FillColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            button.FontColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(0, 255, 0);
            button.FillColor        = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(0, 0, 255);
            canvas.RegisterWidget(button);
            canvas.RenderWidgets();

            while (!button.Clicked)
            {
                canvas.ActivateWidgets(true);
                canvas.RenderWidgets();
                canvas.Execute();

                canvas.TouchscreenWaitForEvent();

                canvas.RenderWidgets(NwazetGoImaging.Render.All);
                canvas.Execute();
            }
        }
Ejemplo n.º 3
0
        public static void BasicUITest(
            NwazetGoImaging.VirtualCanvas canvas)
        {
            canvas.SetOrientation(NwazetGoImaging.Orientation.Portrait);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(35, 10, (ushort)NwazetGoImaging.BasicColor.Black, NwazetGoFonts.DejaVuSansBold9.ID, "Herd Rider by Larouex");
            canvas.Execute();

            /*
             * canvas.DrawString(5, 30, (ushort)BasicColor.Black, DejaVuSans9.ID, "DejaVu Sans 9");
             * canvas.DrawString(5, 50, (ushort)BasicColor.Black, DejaVuSansMono8.ID, "DejaVu Sans Mono 8");
             * canvas.SetOrientation(Orientation.Landscape);
             * canvas.DrawString(5, 10, (ushort)BasicColor.Black, DejaVuSans9.ID, "DejaVu Sans 9 (Rotated)");
             * canvas.SetOrientation(Orientation.Portrait);
             * RenderPrimitiveShapes(canvas);
             *
             * var fontInfo = new DejaVuSans9().GetFontInfo();
             *
             * RenderCompoundShapes(canvas, fontInfo);
             * RenderIcons(canvas);
             *
             * var button = new ButtonWidget(20, 285, 200, 25, fontInfo, "Continue Demo");
             * canvas.RegisterWidget(button);
             * canvas.RenderWidgets();
             * while (!button.Clicked) {
             *  canvas.TouchscreenWaitForEvent();
             * }
             * button.Dirty = true;
             * canvas.RenderWidgets();
             * canvas.Execute();
             * canvas.UnRegisterWidget(button);
             * */
        }
Ejemplo n.º 4
0
        public static void MultiWidgetTest(NwazetGoImaging.VirtualCanvas canvas)
        {
            canvas.SetOrientation(NwazetGoImaging.Orientation.Landscape);
            canvas.DrawFill(NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(255, 255, 255));

            var fontInfo = new NwazetGoFonts.DejaVuSans9().GetFontInfo();

            var redButton = new NwazetGoDisplayTouchScreen.ButtonWidget(10, 204, 44, 22, fontInfo, "Red");

            redButton.FillColor        = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(255, 0, 0);
            redButton.FillColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            redButton.FontColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(255, 0, 0);

            var greenButton = new NwazetGoDisplayTouchScreen.ButtonWidget(60, 204, 44, 22, fontInfo, "Green");

            greenButton.FillColor        = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(0, 255, 0);
            greenButton.FillColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            greenButton.FontColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(0, 255, 0);

            var blueButton = new NwazetGoDisplayTouchScreen.ButtonWidget(110, 204, 44, 22, fontInfo, "Blue");

            blueButton.FillColor        = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(0, 0, 255);
            blueButton.FillColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            blueButton.FontColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(0, 0, 255);

            var continueButton = new NwazetGoDisplayTouchScreen.ButtonWidget(247, 204, 64, 22, fontInfo, "Continue");

            continueButton.FillColor        = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            continueButton.FontColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(0, 0, 0);

            canvas.RegisterWidget(redButton);
            canvas.RegisterWidget(greenButton);
            canvas.RegisterWidget(blueButton);
            canvas.RegisterWidget(continueButton);

            canvas.WidgetClicked += ColorButtonsClickedHandler;

            canvas.RenderWidgets();

            while (!continueButton.Clicked)
            {
                canvas.ActivateWidgets(true);
                canvas.RenderWidgets();
                canvas.Execute();

                canvas.TouchscreenWaitForEvent();

                canvas.RenderWidgets(NwazetGoImaging.Render.All);
                canvas.Execute();
            }

            canvas.WidgetClicked -= ColorButtonsClickedHandler;

            continueButton.Dirty = true;
            continueButton.Draw(canvas);
            canvas.Execute();

            canvas.UnRegisterAllWidgets();
        }
Ejemplo n.º 5
0
 public static void BmpImageTest(NwazetGoImaging.VirtualCanvas canvas)
 {
     try {
         var sd = new NwazetGoSD.SDCardReader();
         sd.Initialize(GoSockets.Socket8);
         DisplayBmpPicture(canvas, @"Nwazet\03.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\05.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\09.bmp");
         canvas.SetOrientation(NwazetGoImaging.Orientation.Landscape);
         DisplayBmpPicture(canvas, @"Nwazet\00.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\01.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\02.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\04.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\06.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\07.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\08.bmp");
         sd.Dispose();
     }catch (Exception e) {
         Debug.Print(e.Message);
         Debug.Print("You need an SD card loaded with the demo photos to run this part of the demo.");
     }
 }
Ejemplo n.º 6
0
        public static void MultiWidgetTest(VirtualCanvas canvas) {
            canvas.SetOrientation(Orientation.Landscape);
            canvas.DrawFill(ColorHelpers.GetRGB24toRGB565(255, 255, 255));

            var fontInfo = new DejaVuSans9().GetFontInfo();

            var redButton = new ButtonWidget(10, 204, 44, 22, fontInfo, "Red");
            redButton.FillColor = ColorHelpers.GetRGB24toRGB565(255, 0, 0);
            redButton.FillColorClicked = ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            redButton.FontColorClicked = ColorHelpers.GetRGB24toRGB565(255, 0, 0);

            var greenButton = new ButtonWidget(60, 204, 44, 22, fontInfo, "Green");
            greenButton.FillColor = ColorHelpers.GetRGB24toRGB565(0, 255, 0);
            greenButton.FillColorClicked = ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            greenButton.FontColorClicked = ColorHelpers.GetRGB24toRGB565(0, 255, 0);

            var blueButton = new ButtonWidget(110, 204, 44, 22, fontInfo, "Blue");
            blueButton.FillColor = ColorHelpers.GetRGB24toRGB565(0, 0, 255);
            blueButton.FillColorClicked = ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            blueButton.FontColorClicked = ColorHelpers.GetRGB24toRGB565(0, 0, 255);

            var continueButton = new ButtonWidget(247, 204, 64, 22, fontInfo, "Continue");
            continueButton.FillColor = ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            continueButton.FontColorClicked = ColorHelpers.GetRGB24toRGB565(0, 0, 0);

            canvas.RegisterWidget(redButton);
            canvas.RegisterWidget(greenButton);
            canvas.RegisterWidget(blueButton);
            canvas.RegisterWidget(continueButton);

            canvas.WidgetClicked += ColorButtonsClickedHandler;

            canvas.RenderWidgets();

            while (!continueButton.Clicked) {
                canvas.ActivateWidgets(true);
                canvas.RenderWidgets();
                canvas.Execute();

                canvas.TouchscreenWaitForEvent();

                canvas.RenderWidgets(Render.All);
                canvas.Execute();
            }

            canvas.WidgetClicked -= ColorButtonsClickedHandler;

            continueButton.Dirty = true;
            continueButton.Draw(canvas);
            canvas.Execute();

            canvas.UnRegisterAllWidgets();
        }
Ejemplo n.º 7
0
        public static void BasicUITest(VirtualCanvas canvas) {
            canvas.SetOrientation(Orientation.Portrait);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(5, 10, (ushort)BasicColor.Black, DejaVuSansBold9.ID, "DejaVu Sans 9 Bold");
            canvas.DrawString(5, 30, (ushort)BasicColor.Black, DejaVuSans9.ID, "DejaVu Sans 9");
            canvas.DrawString(5, 50, (ushort)BasicColor.Black, DejaVuSansMono8.ID, "DejaVu Sans Mono 8");
            canvas.SetOrientation(Orientation.Landscape);
            canvas.DrawString(5, 10, (ushort)BasicColor.Black, DejaVuSans9.ID, "DejaVu Sans 9 (Rotated)");
            canvas.SetOrientation(Orientation.Portrait);
            RenderPrimitiveShapes(canvas);

            var fontInfo = new DejaVuSans9().GetFontInfo();

            RenderCompoundShapes(canvas, fontInfo);
            RenderIcons(canvas);

            var button = new ButtonWidget(20, 285, 200, 25, fontInfo, "Continue Demo");
            canvas.RegisterWidget(button);
            canvas.RenderWidgets();
            while (!button.Clicked) {
                canvas.TouchscreenWaitForEvent();
            }
            button.Dirty = true;
            canvas.RenderWidgets();
            canvas.Execute();
            canvas.UnRegisterWidget(button);
        }
Ejemplo n.º 8
0
 public static void TouchscreenAlphanumericDialogTest(VirtualCanvas canvas) {
     canvas.SetOrientation(Orientation.Landscape);
     var response = canvas.TouchscreenShowDialog(DialogType.Alphanumeric);
     Debug.Print("User Input: " + response);
     canvas.SetOrientation(Orientation.Portrait);
     response = canvas.TouchscreenShowDialog(DialogType.Alphanumeric);
     Debug.Print("User Input: " + response);
 }
Ejemplo n.º 9
0
        public static void BasicTouchEventTest(VirtualCanvas canvas) {
            var message = "Touch Event Test";
            var fontInfo = new DejaVuSansBold9().GetFontInfo();
            var stringLength = fontInfo.GetStringWidth(message);
            canvas.SetOrientation(Orientation.Portrait);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(
                (canvas.Width - stringLength) / 2, 150,
                (ushort)BasicColor.Black, fontInfo.ID, message);

            canvas.TouchscreenWaitForEvent();

            canvas.DrawCircleFilled(lastTouchX, lastTouchY, 4, (ushort)BasicColor.Red);
            canvas.Execute();

            Thread.Sleep(1000);
        }
Ejemplo n.º 10
0
 public static void BmpImageTest(VirtualCanvas canvas) {
     try {
         //var sd = new SDCardReader();
         //sd.Initialize(SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10);
         DisplayBmpPicture(canvas, @"Nwazet\03.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\05.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\09.bmp");
         canvas.SetOrientation(Orientation.Landscape);
         DisplayBmpPicture(canvas, @"Nwazet\00.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\01.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\02.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\04.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\06.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\07.bmp");
         DisplayBmpPicture(canvas, @"Nwazet\08.bmp");
         //sd.Dispose();
     } catch (Exception e) {
         Debug.Print(e.Message);
         Debug.Print("You need an SD card loaded with the demo photos to run this part of the demo.");
     }
 }