Пример #1
0
        public OptionSelectButton CreateOptionSelectButton(MfdMenuPage page, float positionNum, string labelText,
                                                           bool invertLabelText, int?triangleLegLengthPixels)
        {
            var button = new OptionSelectButton(page)
            {
                PositionNumber  = positionNum,
                LabelText       = labelText,
                InvertLabelText = invertLabelText
            };
            var boundingRectangle = _osbLabelSizeCalculator.CalculateOSBLabelBitmapRectangle(positionNum);

            button.LabelLocation = boundingRectangle.Location;
            button.LabelSize     = boundingRectangle.Size;
            if (triangleLegLengthPixels.HasValue)
            {
                button.TriangleLegLength = triangleLegLengthPixels.Value;
            }
            if (positionNum >= 1 && positionNum <= 5)
            {
                //TOP
                button.TextVAlignment = VAlignment.Top;
                button.TextHAlignment = HAlignment.Center;
            }
            else if (positionNum >= 6 && positionNum <= 13)
            {
                //RIGHT
                button.TextVAlignment = VAlignment.Center;
                button.TextHAlignment = HAlignment.Right;
            }
            else if (positionNum >= 14 && positionNum <= 18)
            {
                //BOTTOM
                button.TextVAlignment = VAlignment.Bottom;
                button.TextHAlignment = HAlignment.Center;
            }
            else if (positionNum >= 19 && positionNum <= 26)
            {
                //LEFT
                button.TextVAlignment = VAlignment.Center;
                button.TextHAlignment = HAlignment.Left;
            }

            if (labelText.Trim() == "^")
            {
                button.TextVAlignment = VAlignment.Center;
            }
            else if (labelText.Trim() == @"\/")
            {
                button.TextVAlignment = VAlignment.Center;
            }
            return(button);
        }
        public void HandleOptionSelectButtonPress(OptionSelectButton button)
        {
            var functionName = button.FunctionName;

            if (!String.IsNullOrEmpty(functionName))
            {
                switch (functionName)
                {
                case "CourseSelectIncrease":
                    _courseSelectIncreaseEventHandler.CourseSelectIncrease();
                    break;

                case "CourseSelectDecrease":
                    _courseSelectDecreaseEventHandler.CourseSelectDecrease();
                    break;

                case "HeadingSelectIncrease":
                    _headingSelectIncreaseEventHandler.HeadingSelectIncrease();
                    break;

                case "HeadingSelectDecrease":
                    _headingSelectDecreaseEventHandler.HeadingSelectDecrease();
                    break;

                case "BarometricPressureSettingIncrease":
                    _increaseBaroEventHandler.IncreaseBaro();
                    break;

                case "BarometricPressureSettingDecrease":
                    _decreaseBaroEventHandler.DecreaseBaro();
                    break;

                case "LowAltitudeWarningThresholdIncrease":
                    _increaseAlowEventHandler.IncreaseAlow();
                    break;

                case "LowAltitudeWarningThresholdDecrease":
                    _decreaseAlowEventHandler.DecreaseAlow();
                    break;

                case "AcknowledgeMessage":
                    //SendCallbackToFalcon("SimICPFAck");
                    break;
                }
            }
        }