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 RadioButton(Font font, string txt, bool isChecked)
        {
            Orientation = Orientation.Horizontal;

            this.isChecked = isChecked;

            image = new Image();
            image.VerticalAlignment = VerticalAlignment.Center;
            SetImage();
            Children.Add(image);

            text = new Text(font, txt);
            text.ForeColor = Color.White;
            text.VerticalAlignment = VerticalAlignment.Center;
            text.TextWrap = false;
            text.SetMargin(textMargin, 0, 0, 0);
            Children.Add(text);
        }
        ///// <summary>
        ///// Assigns the provided TouchEventHander to the settings button
        ///// </summary>
        ///// <param name="handler"></param>
        //public void AttachButtonTouchHandler(TouchEventHandler handler)
        //{
        //    backButton.TouchDown += handler;
        //}
        /// <summary>
        /// Creates the UI elements
        /// </summary>
        public void SetupUI()
        {
            #region Title Bar
            AddTitleBar(Resources.GetString(Resources.StringResources.settingsTitle), Resources.GetFont(Resources.FontResources.NinaB), GT.Color.White, GT.Color.Blue, GT.Color.Black);
            #endregion // Title Bar

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

            SetpointChangeButtons = new Controls.UpDownButton(Resources.GetString(Resources.StringResources.setpointLabel), theModel.TemperatureSetPoint + theModel.TemperatureDegreeSymbol);
            UnitsChangeButtons = new Controls.UpDownButton(Resources.GetString(Resources.StringResources.unitsLabel), theModel.TemperatureDegreeSymbol);
            ModeChangeButtons = new Controls.UpDownButton(Resources.GetString(Resources.StringResources.currentModeLabel), theModel.ControllerModeStringTable[(int)theModel.ControllerMode]);

            mainPanel.Children.Add(SetpointChangeButtons);
            mainPanel.Children.Add(UnitsChangeButtons);
            mainPanel.Children.Add(ModeChangeButtons);

            this.AddChild(mainPanel, 0);

            #region Back Button
            //C:\Users\user\Documents\Visual Studio 2010\Projects\TempControlV2\TempControlV2\View\Resources\
            backButton = new Image(Resources.GetBitmap(Resources.BitmapResources.BlueBackGlassSmall));
            //backImage.TouchDown += new TouchEventHandler(backButton_Click);
            backButton.SetMargin(5, 3, 0, 0);
            #endregion

            #region Ale Button
            Image aleImage = new Image(Resources.GetBitmap(Resources.BitmapResources.BlueGlassAleSmall));
            aleImage.TouchDown += new TouchEventHandler(aleImage_TouchDown);
            aleImage.SetMargin(5, 3, 0, 0);
            #endregion

            #region Lager Button
            Image lagerImage = new Image(Resources.GetBitmap(Resources.BitmapResources.BlueGlassLagerSmall));
            lagerImage.TouchDown += new TouchEventHandler(lagerImage_TouchDown);
            lagerImage.SetMargin(5, 3, 0, 0);
            #endregion

            this.AddChild(backButton, displayHeight - 45, 0);
            this.AddChild(aleImage, displayHeight - 45, 150);
            this.AddChild(lagerImage, displayHeight - 45, 230);
            #endregion // Main Display Window

            #region Assign Handlers
            SetpointChangeButtons.UpButtonTouchDown += new TouchEventHandler(SetpointChangeButtons_UpButtonTouchDown);
            SetpointChangeButtons.DownButtonTouchDown += new TouchEventHandler(SetpointChangeButtons_DownButtonTouchDown);

            UnitsChangeButtons.UpButtonTouchDown += new TouchEventHandler(UnitsChangeButtons_ButtonTouchDown);
            UnitsChangeButtons.DownButtonTouchDown += new TouchEventHandler(UnitsChangeButtons_ButtonTouchDown);

            ModeChangeButtons.UpButtonTouchDown += new TouchEventHandler(ModeChangeButtons_UpButtonTouchDown);
            ModeChangeButtons.DownButtonTouchDown += new TouchEventHandler(ModeChangeButtons_DownButtonTouchDown);
            #endregion // Assign Handlers
        }
        ///// <summary>
        ///// Assigns the provided TouchEventHander to the settings button
        ///// </summary>
        ///// <param name="handler"></param>
        //public void AttachButtonTouchHandler(TouchEventHandler handler)
        //{
        //    settingsButton.TouchDown += handler;
        //}
        /// <summary>
        /// Creates the UI elements
        /// </summary>
        public void SetupUI()
        {
            #region Title Bar
            AddTitleBar(Resources.GetString(Resources.StringResources.appTitle), Resources.GetFont(Resources.FontResources.NinaB), GT.Color.White, GT.Color.Blue, GT.Color.Black);
            #endregion // Title Bar

            #region Main Display Window
            StackPanel dashboardPanel = new StackPanel(Orientation.Vertical);
            // Current Temp Label
            currentTempLabel = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_16_Bold),
                TextContent = Resources.GetString(Resources.StringResources.currentTempLabel) + theModel.AverageTemperature.ToString() + theModel.TemperatureDegreeSymbol,
                TextAlignment = TextAlignment.Left,
                VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center
            };
            currentTempLabel.SetMargin(0, 8, 0, 8);
            dashboardPanel.Children.Add(currentTempLabel);

            // Set Point Label
            setPointLabel = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_16_Bold),
                TextContent = Resources.GetString(Resources.StringResources.setpointLabel) + theModel.AverageTemperature.ToString() + theModel.TemperatureDegreeSymbol,
                TextAlignment = TextAlignment.Left,
                VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center
            };
            setPointLabel.SetMargin(0, 8, 0, 8);
            dashboardPanel.Children.Add(setPointLabel);

            // State Label
            stateLabel = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_16_Bold),
                TextContent = Resources.GetString(Resources.StringResources.statusLabel) + theModel.CurrentStateStringTable[(int)theModel.CurrentState],
                TextAlignment = TextAlignment.Left,
                VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center
            };
            stateLabel.SetMargin(0, 8, 0, 8);
            dashboardPanel.Children.Add(stateLabel);

            // Mode Label
            modeLabel = new Text()
            {
                ForeColor = GT.Color.Black,
                Font = Resources.GetFont(Resources.FontResources.Arial_16_Bold),
                TextContent = Resources.GetString(Resources.StringResources.currentModeLabel) + theModel.ControllerModeStringTable[(int)theModel.ControllerMode],
                TextAlignment = TextAlignment.Left,
                VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center
            };
            modeLabel.SetMargin(0, 8, 0, 8);
            dashboardPanel.Children.Add(modeLabel);

            this.AddChild(dashboardPanel, 10);

            #region Settings Button
            settingsButton = new Image(Resources.GetBitmap(Resources.BitmapResources.BlueGlassSettingsSmall));
            settingsButton.SetMargin(5, 3, 0, 0);

            this.AddChild(settingsButton, displayHeight - 45, 0);
            #endregion // Settings Button
            #endregion // Main Display Window
        }