コード例 #1
0
        public UpDownButton(string buttonLabel, string initialValue)
        {
            this.buttonLabel = buttonLabel;
            buttonValue = initialValue;

            Border buttonBorder = new Border();
            buttonBorder.SetMargin(5);
            buttonBorder.Background = new SolidColorBrush(GT.Color.White);
            buttonBorder.SetBorderThickness(1);
            buttonBorder.BorderBrush = new SolidColorBrush(GT.Color.Black);
            buttonBorder.Width = 95;

            StackPanel upDwnButtonPanel = new StackPanel(Orientation.Vertical);
            buttonText = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_14_Bold),
                TextAlignment = TextAlignment.Center,
                TextContent = buttonLabel,
                VerticalAlignment = VerticalAlignment.Center,
            };

            StackPanel buttonPanel = new StackPanel(Orientation.Vertical);
            buttonPanel.SetMargin(4);

            arrowUpImage = new Image(Resources.GetBitmap(Resources.BitmapResources.GlassRoundUpButtonSmall));
            arrowUpImage.HorizontalAlignment = HorizontalAlignment.Center;
            arrowUpImage.TouchDown += new TouchEventHandler(arrowUpImage_TouchDown);

            valueText = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_14_Bold),
                TextAlignment = TextAlignment.Center,
                TextContent = buttonValue,
                VerticalAlignment = VerticalAlignment.Center,
            };

            arrowDwnImage = new Image(Resources.GetBitmap(Resources.BitmapResources.GlassRoundDwnButtonSmall));
            arrowDwnImage.HorizontalAlignment = HorizontalAlignment.Center;
            arrowDwnImage.TouchDown += new TouchEventHandler(arrowDwnImage_TouchDown);

            buttonPanel.Children.Add(arrowUpImage);
            buttonPanel.Children.Add(valueText);
            buttonPanel.Children.Add(arrowDwnImage);

            upDwnButtonPanel.Children.Add(buttonText);
            upDwnButtonPanel.Children.Add(buttonPanel);

            buttonBorder.Child = upDwnButtonPanel;
            this.Child = buttonBorder;
        }
コード例 #2
0
        public void SetupWindow()
        {
            int BtnWidth = 90;
            int BtnHeight = 50;

            GT.Color selectedFronColor = GT.Color.White;

            Font font = Resources.GetFont(Resources.FontResources.NinaB);
            unselectedBackgroundBrush = new SolidColorBrush(GT.Color.FromRGB(89, 192, 255));
            selectedONAndLoadedBackgroundBrush = new SolidColorBrush(GT.Color.FromRGB(43, 255, 121));
            selectedOFFBackgroundBrush = new SolidColorBrush(GT.Color.FromRGB(240, 28, 126));
            window = display.WPFWindow;
            canvas = new Canvas();
            window.Child = canvas;

            StackPanel stack = new StackPanel(Orientation.Horizontal);

            // ON button
            onBtnBorder = new Border();
            onBtnBorder.SetBorderThickness(0);
            onBtnBorder.Width = BtnWidth;
            onBtnBorder.Height = BtnHeight;
            onBtnBorder.Background = unselectedBackgroundBrush;

            onBtnBorder.SetMargin(12, 10, 0, 0);
            onBtnBorder.TouchDown += new Microsoft.SPOT.Input.TouchEventHandler((s, e) =>
            {
                coffeeMachineOn();
            });

            tempText = new Text(font, "ON");
            tempText.Width = BtnWidth;
            tempText.ForeColor = selectedFronColor;
            tempText.TextAlignment = TextAlignment.Center;
            tempText.SetMargin(0, 15, 0, 0);

            onBtnBorder.Child = tempText;
            stack.Children.Add(onBtnBorder);

            // OFF button
            offBtnBorder = new Border();
            offBtnBorder.SetBorderThickness(0);
            offBtnBorder.Width = BtnWidth;
            offBtnBorder.Height = BtnHeight;

            offBtnBorder.Background = selectedOFFBackgroundBrush;

            offBtnBorder.SetMargin(12, 10, 0, 0);
            offBtnBorder.TouchDown += new Microsoft.SPOT.Input.TouchEventHandler((s, e) =>
            {
                coffeeMachineOff();
            });

            tempText = new Text(font, "OFF");
            tempText.Width = BtnWidth;
            tempText.ForeColor = selectedFronColor;
            tempText.TextAlignment = TextAlignment.Center;
            tempText.SetMargin(0, 15, 0, 0);

            offBtnBorder.Child = tempText;
            stack.Children.Add(offBtnBorder);

            // LOADED button
            loadedBtnBorder = new Border();
            loadedBtnBorder.SetBorderThickness(0);
            loadedBtnBorder.Width = BtnWidth;
            loadedBtnBorder.Height = BtnHeight;

            loadedBtnBorder.Background = unselectedBackgroundBrush;

            loadedBtnBorder.SetMargin(12, 10, 0, 0);
            loadedBtnBorder.TouchDown += new Microsoft.SPOT.Input.TouchEventHandler((s, e) =>
            {
                coffeeMachineLoaded();
            });

            tempText = new Text(font, "LOADED");
            tempText.Width = BtnWidth;
            tempText.ForeColor = selectedFronColor;
            tempText.TextAlignment = TextAlignment.Center;
            tempText.SetMargin(0, 15, 0, 0);

            loadedBtnBorder.Child = tempText;
            stack.Children.Add(loadedBtnBorder);

            StackPanel verticalStack = new StackPanel(Orientation.Vertical);
            verticalStack.Children.Add(stack);

            Font ff = Resources.GetFont(Resources.FontResources.moireFonts);

            timerText = new Text(ff, "off");
            timerText.Width = 320;
            timerText.ForeColor = GT.Color.FromRGB(89, 192, 255);
            timerText.TextAlignment = TextAlignment.Center;
            timerText.SetMargin(0, 35, 0, 0);
            verticalStack.Children.Add(timerText);

            canvas.Children.Add(verticalStack);
        }
コード例 #3
0
        public void SetupUI()
        {
            #region Title Bar
            AddTitleBar("Settings", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.White, GT.Color.Blue, GT.Color.Gray);
            #endregion // Title Bar

            #region Main Display Window
            StackPanel mainPanel = new StackPanel(Orientation.Horizontal);
            mainPanel.SetMargin(4);

            #region SetPoint
            Border setPointBorder = new Border();
            setPointBorder.SetMargin(5);
            setPointBorder.Background = new SolidColorBrush(GT.Color.White);
            setPointBorder.SetBorderThickness(1);
            setPointBorder.BorderBrush = new SolidColorBrush(GT.Color.Black);
            setPointBorder.Width = 95;

            StackPanel setPointPanel = new StackPanel(Orientation.Vertical);
            Text setPointText = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_14_Bold),
                TextAlignment = TextAlignment.Center,
                TextContent = "Set Point",// + theModel.DesiredTemperature.ToString() + theModel.TemperatureDegreeSymbol,
                VerticalAlignment = VerticalAlignment.Center,
            };

            StackPanel setPointButtonPanel = new StackPanel(Orientation.Vertical);
            setPointButtonPanel.SetMargin(4);

            Image setPointUpImage = new Image(Resources.GetBitmap(Resources.BitmapResources.GlassRoundUpButtonSmall));
            setPointUpImage.HorizontalAlignment = HorizontalAlignment.Center;
            Text setPointValueText = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_14_Bold),
                TextAlignment = TextAlignment.Center,
                TextContent = theModel.DesiredTemperature.ToString() + theModel.TemperatureDegreeSymbol,
                VerticalAlignment = VerticalAlignment.Center,
            };
            Image setPointDwnImage = new Image(Resources.GetBitmap(Resources.BitmapResources.GlassRoundDwnButtonSmall));
            setPointDwnImage.HorizontalAlignment = HorizontalAlignment.Center;

            setPointButtonPanel.Children.Add(setPointUpImage);
            setPointButtonPanel.Children.Add(setPointValueText);
            setPointButtonPanel.Children.Add(setPointDwnImage);

            setPointPanel.Children.Add(setPointText);
            setPointPanel.Children.Add(setPointButtonPanel);

            setPointBorder.Child = setPointPanel;
            #endregion

            #region Units
            Border unitsBorder = new Border();
            unitsBorder.SetMargin(5);
            unitsBorder.Background = new SolidColorBrush(GT.Color.White);
            unitsBorder.SetBorderThickness(1);
            unitsBorder.BorderBrush = new SolidColorBrush(GT.Color.Black);
            unitsBorder.Width = 95;

            StackPanel unitsPanel = new StackPanel(Orientation.Vertical);
            Text unitsText = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_14_Bold),
                TextAlignment = TextAlignment.Center,
                TextContent = "Units",
                VerticalAlignment = VerticalAlignment.Center,
            };

            StackPanel unitsButtonPanel = new StackPanel(Orientation.Vertical);
            unitsButtonPanel.SetMargin(4);

            Image unitsUpImage = new Image(Resources.GetBitmap(Resources.BitmapResources.GlassRoundUpButtonSmall));
            unitsUpImage.HorizontalAlignment = HorizontalAlignment.Center;
            Text unitsValueText = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_14_Bold),
                TextAlignment = TextAlignment.Center,
                TextContent = theModel.TemperatureDegreeSymbol,
                VerticalAlignment = VerticalAlignment.Center,
            };
            Image unitsDwnImage = new Image(Resources.GetBitmap(Resources.BitmapResources.GlassRoundDwnButtonSmall));
            unitsDwnImage.HorizontalAlignment = HorizontalAlignment.Center;

            unitsButtonPanel.Children.Add(unitsUpImage);
            unitsButtonPanel.Children.Add(unitsValueText);
            unitsButtonPanel.Children.Add(unitsDwnImage);

            unitsPanel.Children.Add(unitsText);
            unitsPanel.Children.Add(unitsButtonPanel);

            unitsBorder.Child = unitsPanel;
            #endregion

            #region Mode
            Border modeBorder = new Border();
            modeBorder.SetMargin(5);
            modeBorder.Background = new SolidColorBrush(GT.Color.White);
            modeBorder.SetBorderThickness(1);
            modeBorder.BorderBrush = new SolidColorBrush(GT.Color.Black);
            modeBorder.Width = 95;

            StackPanel modePanel = new StackPanel(Orientation.Vertical);
            Text modeText = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_14_Bold),
                TextAlignment = TextAlignment.Center,
                TextContent = "Mode",
                VerticalAlignment = VerticalAlignment.Center,
            };

            StackPanel modeButtonPanel = new StackPanel(Orientation.Vertical);
            modeButtonPanel.SetMargin(4);

            Image modeUpImage = new Image(Resources.GetBitmap(Resources.BitmapResources.GlassRoundUpButtonSmall));
            modeUpImage.HorizontalAlignment = HorizontalAlignment.Center;
            Text modeValueText = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_14_Bold),
                TextAlignment = TextAlignment.Center,
                TextContent = theModel.ControllerModeString,
                VerticalAlignment = VerticalAlignment.Center,
            };
            Image modeDwnImage = new Image(Resources.GetBitmap(Resources.BitmapResources.GlassRoundDwnButtonSmall));
            modeDwnImage.HorizontalAlignment = HorizontalAlignment.Center;

            modeButtonPanel.Children.Add(modeUpImage);
            modeButtonPanel.Children.Add(modeValueText);
            modeButtonPanel.Children.Add(modeDwnImage);

            modePanel.Children.Add(modeText);
            modePanel.Children.Add(modeButtonPanel);

            modeBorder.Child = modePanel;
            #endregion

            mainPanel.Children.Add(setPointBorder);
            mainPanel.Children.Add(unitsBorder);
            mainPanel.Children.Add(modeBorder);

            this.AddChild(mainPanel, 0);
            #endregion

            #region Back Button
            Image image = new Image(Resources.GetBitmap(Resources.BitmapResources.BlueBackGlassSmall));
            image.TouchDown += new TouchEventHandler(controller.backButton_Click);
            image.SetMargin(5, 3, 0, 0);

            this.AddChild(image, displayHeight - 45, 0);
            #endregion
        }