コード例 #1
0
        private UIElement CreatePage()
        {
            var dateText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.font, DateTime.Now.Day + " / " + DateTime.Now.Month + " / " + DateTime.Now.Year)
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(dateText, 390);
            Canvas.SetTop(dateText, 10);
            this.canvas.Children.Add(dateText);

            var addressText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.font, this.address)
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(addressText, 10);
            Canvas.SetTop(addressText, 10);
            this.canvas.Children.Add(addressText);

            var connectedText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "CONNECTED")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(connectedText, 160);
            Canvas.SetTop(connectedText, 115);
            this.canvas.Children.Add(connectedText);

            return(this.canvas);
        }
コード例 #2
0
        private UIElement CreatePage()
        {
            var ghiLogo = new GHIElectronics.TinyCLR.UI.Controls.Image()
            {
                Source = BitmapImage.FromGraphics(Graphics.FromImage(Resources.GetBitmap(Resources.BitmapResources.logo)))
            };

            Canvas.SetLeft(ghiLogo, 0);
            Canvas.SetTop(ghiLogo, 0);
            this.canvas.Children.Add(ghiLogo);

            var buttonText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.font, "Enter")
            {
                ForeColor           = Colors.Black,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };
            var enterButton = new Button()
            {
                Child  = buttonText,
                Width  = 65,
                Height = 40,
            };

            Canvas.SetLeft(enterButton, 200);
            Canvas.SetTop(enterButton, 230);
            this.canvas.Children.Add(enterButton);

            enterButton.Click += this.EnterButton_Click;

            return(this.canvas);
        }
コード例 #3
0
        private void CreateWindow()
        {
            var startX  = 10;
            var startY  = 20;
            var offsetY = 10;
            var font    = Resources.GetFont(Resources.FontResources.droid_reg08);

            this.canvas.Children.Clear();

            var devText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "Device: " + GHIElectronics.TinyCLR.Native.DeviceInformation.DeviceName)
            {
                ForeColor = Colors.White,
            };

            var clockText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "Clock: 480MHz")
            {
                ForeColor = Colors.White,
            };

            var osText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "OS: TinyCLR OS v2.0.0")
            {
                ForeColor = Colors.White,
            };
            var mText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "Manufacture: GHI Electronics, LLC")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(devText, startX); Canvas.SetTop(devText, startY); startY     += offsetY;
            Canvas.SetLeft(clockText, startX); Canvas.SetTop(clockText, startY); startY += offsetY;
            Canvas.SetLeft(osText, startX); Canvas.SetTop(osText, startY); startY       += offsetY;
            Canvas.SetLeft(mText, startX); Canvas.SetTop(mText, startY); startY         += offsetY;

            this.canvas.Children.Add(devText);
            this.canvas.Children.Add(clockText);
            this.canvas.Children.Add(osText);
            this.canvas.Children.Add(mText);

            // Enable TopBar
            Canvas.SetLeft(this.TopBar, 0); Canvas.SetTop(this.TopBar, 0);
            this.canvas.Children.Add(this.TopBar);

            // Enable BottomBar
            Canvas.SetLeft(this.BottomBar, 2); Canvas.SetTop(this.BottomBar, this.Height - this.BottomBar.Height);
            this.canvas.Children.Add(this.BottomBar);

            this.OnBottomBarButtonUpEvent += this.SystemWindow_OnBottomBarButtonUpEvent;
        }
コード例 #4
0
ファイル: LoadingPage.cs プロジェクト: valoni/TinyCLR-Samples
        private UIElement CreatePage()
        {
            this.canvas.Children.Clear();

            var loadingText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Processing your payment...")
            {
                ForeColor           = Colors.White,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            Canvas.SetLeft(loadingText, 140);
            Canvas.SetTop(loadingText, 220);

            this.canvas.Children.Add(loadingText);

            Canvas.SetLeft(this.progressBar, 140);
            Canvas.SetTop(this.progressBar, 240);

            this.canvas.Children.Add(this.progressBar);

            return(this.canvas);
        }
コード例 #5
0
ファイル: CarWashPage.cs プロジェクト: valoni/TinyCLR-Samples
        private UIElement CreatePage()
        {
            this.canvas.Children.Clear();

            var washCarText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Washing your car...")
            {
                ForeColor           = Colors.White,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            Canvas.SetLeft(washCarText, 140);
            Canvas.SetTop(washCarText, 60);

            this.canvas.Children.Add(washCarText);

            Canvas.SetLeft(this.progressBar, 90);
            Canvas.SetTop(this.progressBar, 80);

            this.canvas.Children.Add(this.progressBar);

            return(this.canvas);
        }
コード例 #6
0
        private UIElement CreatePage()
        {
            this.canvas.Children.Clear();

            var creditCardText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Input your credit card number :")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(creditCardText, 10);
            Canvas.SetTop(creditCardText, 20);

            this.canvas.Children.Add(creditCardText);

            var expireText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Expire date :")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(expireText, 132);
            Canvas.SetTop(expireText, 50);

            this.canvas.Children.Add(expireText);

            var pinTex = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Pin :")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(pinTex, 187);
            Canvas.SetTop(pinTex, 80);

            this.canvas.Children.Add(pinTex);


            var creditCardTextBox = new TextBox()
            {
                Text   = "#########",
                Font   = fontB,
                Width  = 120,
                Height = 25,
            };

            Canvas.SetLeft(creditCardTextBox, 250);
            Canvas.SetTop(creditCardTextBox, 15);

            this.canvas.Children.Add(creditCardTextBox);

            var exprireTexBox = new TextBox()
            {
                Text   = "01/01/2020",
                Font   = fontB,
                Width  = 120,
                Height = 25,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            Canvas.SetLeft(exprireTexBox, 250);
            Canvas.SetTop(exprireTexBox, 45);

            this.canvas.Children.Add(exprireTexBox);

            var pinTexBox = new TextBox()
            {
                Text   = "0000",
                Font   = fontB,
                Width  = 120,
                Height = 25,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            Canvas.SetLeft(pinTexBox, 250);
            Canvas.SetTop(pinTexBox, 75);

            this.canvas.Children.Add(pinTexBox);

            var backButton = new Button()
            {
                Child = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Back")
                {
                    ForeColor           = Colors.Black,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                },
                Width  = 100,
                Height = 40,
            };

            var goButton = new Button()
            {
                Child = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Next")
                {
                    ForeColor           = Colors.Black,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                },
                Width  = 100,
                Height = 40,
            };

            Canvas.SetLeft(backButton, 10);
            Canvas.SetTop(backButton, 220);

            this.canvas.Children.Add(backButton);

            Canvas.SetLeft(goButton, 370);
            Canvas.SetTop(goButton, 220);

            this.canvas.Children.Add(goButton);

            Canvas.SetLeft(this.messageBox, 50);
            Canvas.SetTop(this.messageBox, 50);

            this.messageBox.Visibility = Visibility.Hidden;

            this.canvas.Children.Add(this.messageBox);

            backButton.Click += this.BackButton_Click;
            goButton.Click   += this.GoButton_Click;

            return(this.canvas);
        }
コード例 #7
0
        public BottomBar(int width, bool enableButtonBack, bool enableButtonNext)
        {
            this.font             = Resources.GetFont(Resources.FontResources.droid_reg08);
            this.buttonWidth      = 40;
            this.buttonHeight     = this.font.Height + 8;
            this.enableButtonBack = enableButtonBack;
            this.enableButtonNext = enableButtonNext;

            this.Width  = width;
            this.Height = this.buttonHeight;

            this.canvas = new Canvas {
                Width  = this.Width,
                Height = this.buttonHeight
            };

            if (this.enableButtonBack)
            {
                var backText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.font, "Back")
                {
                    ForeColor           = Colors.Black,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center
                };

                GC.Collect();
                Debug.WriteLine("" + GHIElectronics.TinyCLR.Native.Memory.ManagedMemory.FreeBytes / 1024);

                this.ButtonBack = new Button()
                {
                    Child  = backText,
                    Width  = this.buttonWidth,
                    Height = this.buttonHeight,
                };

                Canvas.SetLeft(this.ButtonBack, 0);
                Canvas.SetTop(this.ButtonBack, 0);

                this.canvas.Children.Add(this.ButtonBack);
            }

            if (this.enableButtonNext)
            {
                var nextText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.font, "Next")
                {
                    ForeColor           = Colors.Black,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center
                };

                this.ButtonNext = new Button()
                {
                    Child  = nextText,
                    Width  = this.buttonWidth,
                    Height = this.buttonHeight,
                };

                Canvas.SetRight(this.ButtonNext, 0);
                Canvas.SetTop(this.ButtonNext, 0);

                this.canvas.Children.Add(this.ButtonNext);
            }

            this.Child = this.canvas;
        }
コード例 #8
0
ファイル: SelectPage.cs プロジェクト: valoni/TinyCLR-Samples
        private UIElement CreatePage()
        {
            this.canvas.Children.Clear();

            //Label SSID
            var ssidText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.font, "SSID:")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(ssidText, 150);
            Canvas.SetTop(ssidText, 75);
            this.canvas.Children.Add(ssidText);
            //TextBox SSID
            this.ssidTextBox = new TextBox()
            {
                Text   = "",
                Font   = font,
                Width  = 200,
                Height = 25,
            };
            Canvas.SetLeft(this.ssidTextBox, 150);
            Canvas.SetTop(this.ssidTextBox, 90);
            this.canvas.Children.Add(this.ssidTextBox);

            //Label password
            var passwordText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.font, "Password:"******"",
                Font   = font,
                Width  = 200,
                Height = 25,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };
            Canvas.SetLeft(this.passwordTextBox, 150);
            Canvas.SetTop(this.passwordTextBox, 145);
            this.canvas.Children.Add(this.passwordTextBox);
            //Connect Button
            var buttonText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.font, "Connect")
            {
                ForeColor           = Colors.Black,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };
            var connectButton = new Button()
            {
                Child  = buttonText,
                Width  = 100,
                Height = 40,
            };

            Canvas.SetLeft(connectButton, 200);
            Canvas.SetTop(connectButton, 220);
            this.canvas.Children.Add(connectButton);

            connectButton.Click += this.ConnectButton_Click;

            return(this.canvas);
        }
コード例 #9
0
ファイル: EndPage.cs プロジェクト: valoni/TinyCLR-Samples
        private UIElement CreatePage()
        {
            this.canvas.Children.Clear();

            var willYouText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Will you:")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(willYouText, 10);
            Canvas.SetTop(willYouText, 10);

            this.canvas.Children.Add(willYouText);


            var checkbox = new CheckBox();

            Canvas.SetTop(checkbox, 50);
            Canvas.SetLeft(checkbox, 50);

            this.canvas.Children.Add(checkbox);

            var backtousText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Back to us.")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(backtousText, 50 + checkbox.Width + 5);
            Canvas.SetTop(backtousText, 50);

            this.canvas.Children.Add(backtousText);

            var radioButton = new RadioButton()
            {
                Name = "radio1",
            };

            Canvas.SetTop(radioButton, 100);
            Canvas.SetLeft(radioButton, 50);

            this.canvas.Children.Add(radioButton);

            var sellyourverhicleText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Sell your vehicle.")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(sellyourverhicleText, 50 + radioButton.Width + 5);
            Canvas.SetTop(sellyourverhicleText, 100);

            this.canvas.Children.Add(sellyourverhicleText);

            var radioButton2 = new RadioButton()
            {
                Name = "radio2",
            };

            Canvas.SetTop(radioButton2, 150);
            Canvas.SetLeft(radioButton2, 50);

            this.canvas.Children.Add(radioButton2);

            var donateyourverhicleText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Donate your vehicle.")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(donateyourverhicleText, 50 + radioButton2.Width + 5);
            Canvas.SetTop(donateyourverhicleText, 150);

            this.canvas.Children.Add(donateyourverhicleText);

            var radioButton3 = new RadioButton()
            {
                Name = "radio3",
            };

            Canvas.SetTop(radioButton3, 200);
            Canvas.SetLeft(radioButton3, 50);

            this.canvas.Children.Add(radioButton3);

            var notsureText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Not sure yet.")
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(notsureText, 50 + radioButton3.Width + 5);
            Canvas.SetTop(notsureText, 200);

            this.canvas.Children.Add(notsureText);

            var doneText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Done!")
            {
                ForeColor           = Colors.Black,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            var doneButton = new Button()
            {
                Child  = doneText,
                Width  = 100,
                Height = 40,
            };

            Canvas.SetLeft(doneButton, 370);
            Canvas.SetTop(doneButton, 220);

            this.canvas.Children.Add(doneButton);

            doneButton.Click += this.DoneButton_Click;

            return(this.canvas);
        }
コード例 #10
0
        private UIElement CreatePage()
        {
            int xButton = 300, yButton = 15, yOffsetButton = 60;
            int xPriceText = 420, yPriceText = 25, yOffsetPriceText = 60;
            var xLine = 280;

            this.canvas.Children.Clear();

            var premiumText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontDroid12, "Premium")
            {
                ForeColor           = Colors.Black,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            var standardText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontDroid12, "Standard")
            {
                ForeColor           = Colors.Black,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            var basicText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontDroid12, "Basic")
            {
                ForeColor           = Colors.Black,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            var freeText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontDroid12, "Free")
            {
                ForeColor           = Colors.Black,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };

            var premiumButton = new Button()
            {
                Child  = premiumText,
                Width  = 100,
                Height = 40,
            };

            var standardButton = new Button()
            {
                Child  = standardText,
                Width  = 100,
                Height = 40,
            };

            var basicButton = new Button()
            {
                Child  = basicText,
                Width  = 100,
                Height = 40,
            };

            var freeButton = new Button()
            {
                Child  = freeText,
                Width  = 100,
                Height = 40,
            };

            Canvas.SetLeft(premiumButton, xButton);
            Canvas.SetTop(premiumButton, yButton + yOffsetButton * 0);

            Canvas.SetLeft(standardButton, xButton);
            Canvas.SetTop(standardButton, yButton + yOffsetButton * 1);

            Canvas.SetLeft(basicButton, xButton);
            Canvas.SetTop(basicButton, yButton + yOffsetButton * 2);

            Canvas.SetLeft(freeButton, xButton);
            Canvas.SetTop(freeButton, yButton + yOffsetButton * 3);

            var premiumPriceText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontDroid14, "4.99$")
            {
                ForeColor = Colors.White,
            };

            var standardPriceText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontDroid14, "3.99$")
            {
                ForeColor = Colors.White,
            };

            var basicPriceText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontDroid14, "2.99$")
            {
                ForeColor = Colors.White,
            };

            var freePriceText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontDroid14, "0.00$")
            {
                ForeColor = Colors.White,
            };


            Canvas.SetLeft(premiumPriceText, xPriceText);
            Canvas.SetLeft(standardPriceText, xPriceText);
            Canvas.SetLeft(basicPriceText, xPriceText);
            Canvas.SetLeft(freePriceText, xPriceText);

            Canvas.SetTop(premiumPriceText, yPriceText + yOffsetPriceText * 0);
            Canvas.SetTop(standardPriceText, yPriceText + yOffsetPriceText * 1);
            Canvas.SetTop(basicPriceText, yPriceText + yOffsetPriceText * 2);
            Canvas.SetTop(freePriceText, yPriceText + yOffsetPriceText * 3);


            this.canvas.Children.Add(premiumButton);
            this.canvas.Children.Add(standardButton);
            this.canvas.Children.Add(basicButton);
            this.canvas.Children.Add(freeButton);

            this.canvas.Children.Add(premiumPriceText);
            this.canvas.Children.Add(standardPriceText);
            this.canvas.Children.Add(basicPriceText);
            this.canvas.Children.Add(freePriceText);

            // line
            var line = new GHIElectronics.TinyCLR.UI.Shapes.Line(0, 250)
            {
                Stroke = new GHIElectronics.TinyCLR.UI.Media.Pen(Colors.Yellow)
            };

            Canvas.SetLeft(line, xLine);
            Canvas.SetTop(line, 10);

            this.canvas.Children.Add(line);

            // Timer
            var timerText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, DateTime.Now.Day + " / " + DateTime.Now.Month + " / " + DateTime.Now.Year)
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(timerText, 100);
            Canvas.SetTop(timerText, 250);

            this.canvas.Children.Add(timerText);

            var selectVehicleText = new GHIElectronics.TinyCLR.UI.Controls.Text(this.fontB, "Select Vehicle Type:")
            {
                ForeColor = Colors.White,
            };


            Canvas.SetLeft(selectVehicleText, 10);
            Canvas.SetTop(selectVehicleText, yPriceText);

            this.canvas.Children.Add(selectVehicleText);

            var listBox = new ListBox();

            listBox.Items.Add(new ListBoxItemHighlightable("Truck", this.fontB, 4, GHIElectronics.TinyCLR.UI.Media.Colors.Blue, GHIElectronics.TinyCLR.UI.Media.Colors.White, GHIElectronics.TinyCLR.UI.Media.Colors.White));
            listBox.Items.Add(new ListBoxItemHighlightable("Van", this.fontB, 4, GHIElectronics.TinyCLR.UI.Media.Colors.Blue, GHIElectronics.TinyCLR.UI.Media.Colors.White, GHIElectronics.TinyCLR.UI.Media.Colors.White));
            listBox.Items.Add(new ListBoxItemHighlightable("SUV", this.fontB, 4, GHIElectronics.TinyCLR.UI.Media.Colors.Blue, GHIElectronics.TinyCLR.UI.Media.Colors.White, GHIElectronics.TinyCLR.UI.Media.Colors.White));
            listBox.Items.Add(new ListBoxItemHighlightable("Sedan", this.fontB, 4, GHIElectronics.TinyCLR.UI.Media.Colors.Blue, GHIElectronics.TinyCLR.UI.Media.Colors.White, GHIElectronics.TinyCLR.UI.Media.Colors.White));
            listBox.Items.Add(new ListBoxItemHighlightable("Other", this.fontB, 4, GHIElectronics.TinyCLR.UI.Media.Colors.Blue, GHIElectronics.TinyCLR.UI.Media.Colors.White, GHIElectronics.TinyCLR.UI.Media.Colors.White));

            listBox.SelectedIndex = 0;

            Canvas.SetLeft(listBox, 160);
            Canvas.SetTop(listBox, yPriceText);

            this.canvas.Children.Add(listBox);


            var dropDown = new Dropdown()
            {
                Width  = 100,
                Height = 20,
                Font   = fontB
            };

            //var option = new ArrayList();

            //option.Add("text 1");
            //option.Add("text 2");
            //option.Add("text 3");
            //option.Add("text 4");
            //option.Add("text 5");
            //option.Add("text 6");
            //option.Add("text 7");

            //dropDown.Options = option;

            //Canvas.SetLeft(dropDown, 160);
            //Canvas.SetTop(dropDown, yPriceText);

            //this.canvas.Children.Add(dropDown);

            var imageVisa = new GHIElectronics.TinyCLR.UI.Controls.Image()
            {
                Source = BitmapImage.FromGraphics(Graphics.FromImage(Resources.GetBitmap(Resources.BitmapResources.visa)))
            };

            var imageMaster = new GHIElectronics.TinyCLR.UI.Controls.Image()
            {
                Source = BitmapImage.FromGraphics(Graphics.FromImage(Resources.GetBitmap(Resources.BitmapResources.master)))
            };

            var imagePaypal = new GHIElectronics.TinyCLR.UI.Controls.Image()
            {
                Source = BitmapImage.FromGraphics(Graphics.FromImage(Resources.GetBitmap(Resources.BitmapResources.paypal)))
            };

            Canvas.SetLeft(imageVisa, 20);
            Canvas.SetTop(imageVisa, yPriceText + 150);

            this.canvas.Children.Add(imageVisa);

            Canvas.SetLeft(imageMaster, 100);
            Canvas.SetTop(imageMaster, yPriceText + 150);

            this.canvas.Children.Add(imageMaster);

            Canvas.SetLeft(imagePaypal, 180);
            Canvas.SetTop(imagePaypal, yPriceText + 150);

            this.canvas.Children.Add(imagePaypal);


            // Add event
            premiumButton.Click  += this.Button_Click;
            standardButton.Click += this.Button_Click;
            basicButton.Click    += this.Button_Click;
            freeButton.Click     += this.Button_Click;

            return(this.canvas);
        }
コード例 #11
0
        private void CreateWindow()
        {
            var startX  = 20;
            var startY  = 40;
            var offsetY = 30;
            var font    = Resources.GetFont(Resources.FontResources.droid_reg12);

            this.canvas.Children.Clear();

            var devText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "Device: " + GHIElectronics.TinyCLR.Native.DeviceInformation.DeviceName)
            {
                ForeColor = Colors.White,
            };

            var speed = Power.GetSystemClock() == SystemClock.High ? "Clock: 480MHz" : "Clock: 240MHz";

            var clockText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, speed)
            {
                ForeColor = Colors.White,
            };

            var ramText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "Memory: 512KB Total")
            {
                ForeColor = Colors.White,
            };

            var ramExtText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "External Memory: 32MB Total")
            {
                ForeColor = Colors.White,
            };

            var osText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "OS: TinyCLR OS v2.0.0")
            {
                ForeColor = Colors.White,
            };
            var mText = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "Manufacture: GHI Electronics, LLC")
            {
                ForeColor = Colors.White,
            };

            var mVesion = new GHIElectronics.TinyCLR.UI.Controls.Text(font, "Demo version: " + DemoVersion)
            {
                ForeColor = Colors.White,
            };

            Canvas.SetLeft(devText, startX); Canvas.SetTop(devText, startY); startY       += offsetY;
            Canvas.SetLeft(clockText, startX); Canvas.SetTop(clockText, startY); startY   += offsetY;
            Canvas.SetLeft(ramText, startX); Canvas.SetTop(ramText, startY); startY       += offsetY;
            Canvas.SetLeft(ramExtText, startX); Canvas.SetTop(ramExtText, startY); startY += offsetY;
            Canvas.SetLeft(osText, startX); Canvas.SetTop(osText, startY); startY         += offsetY;
            Canvas.SetLeft(mText, startX); Canvas.SetTop(mText, startY); startY           += offsetY;
            Canvas.SetLeft(mVesion, startX); Canvas.SetTop(mVesion, startY); startY       += offsetY;

            this.canvas.Children.Add(devText);
            this.canvas.Children.Add(clockText);
            this.canvas.Children.Add(ramText);
            this.canvas.Children.Add(ramExtText);
            this.canvas.Children.Add(osText);
            this.canvas.Children.Add(mText);
            this.canvas.Children.Add(mVesion);

            // Enable TopBar
            Canvas.SetLeft(this.TopBar, 0); Canvas.SetTop(this.TopBar, 0);
            this.canvas.Children.Add(this.TopBar);
        }