Пример #1
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();
            }
        }
Пример #2
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();
        }
Пример #3
0
        public static void BasicTouchEventTest(
            NwazetGoImaging.VirtualCanvas canvas)
        {
            var message      = "Touch Event Test";
            var fontInfo     = new NwazetGoFonts.DejaVuSansBold9().GetFontInfo();
            var stringLength = fontInfo.GetStringWidth(message);

            canvas.DrawFill(ColorBackground);
            canvas.DrawString(
                (canvas.Width - stringLength) / 2, 150,
                (ushort)NwazetGoImaging.BasicColor.Black, fontInfo.ID, message);

            canvas.TouchscreenWaitForEvent();

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

            Thread.Sleep(1000);
        }
Пример #4
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();
        }
Пример #5
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);
        }
Пример #6
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);
        }
Пример #7
0
        public static void NonBlockingTouchEventTest(VirtualCanvas canvas) {
            var message = "Touch To Continue";
            var fontInfo = new DejaVuSansBold9().GetFontInfo();
            var stringLength = fontInfo.GetStringWidth(message);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(
                (canvas.Width - stringLength) / 2, 150,
                (ushort)BasicColor.Black, fontInfo.ID, message);

            var random = new Random(lastTouchX * lastTouchY);
            lastTouchIsValid = 0;
            while (lastTouchIsValid == 0) {
                canvas.DrawCircleFilled(random.Next(canvas.Width), random.Next(canvas.Height), 4, (ushort)BasicColor.Red);
                canvas.Execute();
                canvas.TouchscreenWaitForEvent(TouchScreenEventMode.NonBlocking);
            }
        }
Пример #8
0
 private static void DisplayBmpPicture(VirtualCanvas canvas, string pictureName) {
     canvas.DrawBitmapImage(0, 0, @"SD\" + pictureName);
     canvas.TouchscreenWaitForEvent();
 }
Пример #9
0
 private static void DisplayBmpPicture(NwazetGoImaging.VirtualCanvas canvas, string pictureName)
 {
     canvas.DrawBitmapImage(0, 0, @"SD\" + pictureName);
     canvas.TouchscreenWaitForEvent();
 }