示例#1
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();
        }
示例#2
0
        public void Render(VirtualCanvas canvas, GoBus.GoSocket sdSocket)
        {
            Joystick.Initialize(GoSockets.Socket3, GoBusIRQHandler);
            Joystick.Get();
            while (true)
            {
                canvas.SetOrientation(Orientation.Landscape);
                canvas.DrawFill(ColorHelpers.GetRGB24toRGB565(255, 212, 42));
                canvas.DrawString(
                    10, 1,
                    ColorHelpers.GetRGB24toRGB565(0, 0, 0),
                    VerdanaBold14.ID,
                    "[Nwazet Playground");
                canvas.RenderWidgets(Nwazet.Go.Imaging.Render.All);

                canvas.WidgetClicked += new WidgetClickedHandler(OnWidgetClicked);
                canvas.TouchscreenWaitForEvent();
                canvas.WidgetClicked -= new WidgetClickedHandler(OnWidgetClicked);

                canvas.RenderWidgets(Nwazet.Go.Imaging.Render.Dirty);

                if (TemperatureAndRelayButton.Clicked)
                {
                    var tempRelay = new TempRelay();
                    tempRelay.Render(canvas);
                }
                else if (ImageGalleryButton.Clicked)
                {
                    var imageGallery = new ImageGallery();
                    imageGallery.Render(canvas, sdSocket);
                }
                else if (BasicUIButton.Clicked)
                {
                    var basicUI = new BasicUI();
                    basicUI.Render(canvas);
                }
                else if (LEDMarqueeButton.Clicked)
                {
                    var ledMarquee = new LEDMarquee();
                    ledMarquee.Render(canvas);
                }
                else if (LEDRGBArtButton.Clicked)
                {
                    var ledRgbArt = new LEDRGBArt();
                    ledRgbArt.Render(canvas);
                }
                else if (LEDCaptureTheDotButton.Clicked)
                {
                    var ledCaptureTheDot = new LEDCaptureTheDot();
                    ledCaptureTheDot.Render(canvas, Joystick);
                }
                else if (LEDSignShowcaseButton.Clicked)
                {
                    var ledSignShowcase = new LEDSignShowcase();
                    ledSignShowcase.Render();
                }
                canvas.ActivateWidgets(true);
            }
        }