Example #1
0
        protected internal TestWidget(IWidget parent) : base(parent, 0, 0, 150, 150)
        {
            //Text.Label(this, "Hello", 50, 10, 20, Width, 50, Align.Center, Palette.DarkSlateGray);

            //mPath = new VGPath(null, new VGSolidColor(Palette.Orange));
            mPath = new VGPath(null, new VGSolidColor(new Color(0xFFA5003F)));
            mPath.Move(30, 30);
            VGU.vguRoundRect(mPath.GetPath(), 0, 0, 100, 100, 35, 35);
        }
Example #2
0
        public override ModalWindow AddModal(string name)
        {
            var modal = base.AddModal("modal-" + name);

            var modalOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(modalOutline, 0, 0, 400, 230, 20, 20);

            var fill = new VGLinearGradient(0, 0, 0, 230);

            fill.AddColor(0, Palette.DarkGray);
            fill.AddColor(25, Palette.LightGrey);
            fill.AddColor(100, Palette.LightGrey);

            var outline = new VGPath(modalOutline,
                                     new VGSolidColor(Palette.DarkSlateGray),
                                     fill)
            {
                StrokeWidth = 2.0f
            };

            outline.Move(40, 25);
            modal.AddVGPath(outline);

            var textOutline = VGPath.OpenVGPath();

            VGU.vguRect(textOutline, 0, 0, 360, 160);
            var text = new VGPath(textOutline,
                                  new VGSolidColor(Palette.DarkSlateGray),
                                  new VGSolidColor(Palette.White))
            {
                StrokeWidth = 2.0f
            };

            text.Move(60, 85);
            modal.AddVGPath(text);

            switch (name)
            {
            case "yesno":
                ConfigureModalYesNo(modal);
                break;

            case "ok":
                ConfigureModalOk(modal);
                break;
            }

            return(modal);
        }
Example #3
0
        private void Init(int x, int y)
        {
            InitBackground();

            Text.Label(this, mDescription, 14, 0, 0, Width, 14);
            //Text.Label(this, "100%", 14, 0, 0, Width, 14);
            //Text.Label(this, "0%", 14, 0, 0, Width, 14);

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);

            Format      = "{0:0}";
            mActiveArea = new TextArea(this, Width - 40, (int)(Height * 0.45f), 40, 30);//
            SetValue(0);

            mActiveArea.SetAlign(Align.Left, new GfxPoint(0, 5));
            mActiveArea.SetFont(Palette.White, 22);

            AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff))));

            {
                var i = VGPath.OpenVGPath();
                VGU.vguRect(i, 0, 0, 45, 59);
                var rv = new VGPath(i, new VGSolidColor(new Color(0x6d6e71ff)), new VGSolidColor(new Color(0x414041ff)))
                {
                    StrokeWidth = 1.0f
                };
                rv.Move(X + 12, Y + 32);
                AddVGPath(rv);
            }

            mSensor.OnUpdate += sensor => SetValue(sensor.Value / 10.0f);


            Move(x, y);
        }
Example #4
0
        public static GraphicArea ClassicArea(IWidget parent)
        {
            var rv = new GraphicArea(parent, 460, 220)
            {
                Background = Palette.TextArea.Background
            };

            #region Lines & arrows
            {
                var path = VGPath.OpenVGPath();
                VG.vgLoadIdentity();

                VGU.vguLine(path, 0, 0, rv.Width - 60, 0);  // OX
                VGU.vguLine(path, 0, 0, 0, rv.Height - 40); // OY

                const float kXBias = 5f;
                const float kYBias = 12f;

                var yArroyBias = rv.Height - 40f;

                var pathData = new float[16];
                pathData[0] = -kXBias;
                pathData[1] = yArroyBias;          //0f;
                pathData[2] = 0f;
                pathData[3] = yArroyBias + kYBias; // kYBias;
                pathData[4] = kXBias;
                pathData[5] = yArroyBias;          //0f;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var xArroyBias = rv.Width - 60f;
                pathData[0] = xArroyBias;
                pathData[1] = -kXBias;
                pathData[2] = xArroyBias + kYBias;
                pathData[3] = 0f;
                pathData[4] = xArroyBias;
                pathData[5] = kXBias;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var vgPath = new VGPath(path, new VGSolidColor(Palette.Black), new VGSolidColor(Palette.LightBlue));
                vgPath.Move(35, 15);
                rv.Arrows = vgPath;
            }
            #endregion

            #region Grid
            {
                var path = VGPath.OpenVGPath();

                for (var i = 1; i < 4; i++)
                {
                    VGU.vguLine(path, 0, i * 60, rv.Width - 60, i * 60);  // OX
                }
                for (var i = 1; i < 11; i++)
                {
                    VGU.vguLine(path, i * 40, 0, i * 40, rv.Height - 40); // OY
                }
                var vgPath = new VGPath(path, null, null);
                vgPath.SetStroke(new VGSolidColor(Palette.DarkSlateGray), new[] { 5.0f, 10.0f, 15.0f, 10.0f });
                vgPath.StrokeWidth = 0.5f;
                vgPath.Move(40, 20);

                rv.Grid = vgPath;
            }
            #endregion

            rv.Move(10, 10);
            return(rv);
        }
Example #5
0
        private void Init(int x, int y)
        {
            InitBackground();

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);

            AddVGPath(new VGPath(mPath, new VGSolidColor(new Color(0xD1D3D4FF)), new VGSolidColor(new Color(0x2c2d2eff)))
            {
                StrokeWidth = 0.5f
            });

            var       divideLines = VGPath.OpenVGPath();
            const int kBiasY      = 44;

            VGU.vguLine(divideLines, 0, 3 * kBiasY, Width - 30, 3 * kBiasY);
            VGU.vguLine(divideLines, 0, 2 * kBiasY, Width - 30, 2 * kBiasY);
            VGU.vguLine(divideLines, 0, kBiasY, Width - 30, kBiasY);
            VGU.vguLine(divideLines, 0, 0, Width - 30, 0);
            var lines = new VGPath(divideLines, new VGSolidColor(new Color(0xD1D3D4FF)), null)
            {
                StrokeWidth = 0.5f
            };

            lines.Move(15, kBiasY);
            AddVGPath(lines);

            const int kBiasX  = 47;
            const int kBiasX0 = 60;

            Text.Label(this, "T, ⁰C", 16, kBiasX0, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "I, A", 16, kBiasX0 + kBiasX, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "U, B", 16, kBiasX0 + 2 * kBiasX, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "F, Гц", 16, kBiasX0 + 3 * kBiasX, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "об/мин", 16, kBiasX0 + 4 * kBiasX, kBiasY * 4, kBiasX, 18);

            //Text.Label(this, "ПЧН #1\\nПЧН #2\\nПЧН #3\\nПЧН #4", 18, 15, 22, kBiasX0 - 15, kBiasY, Align.Left);

            mTable     = new Table(this);
            mTableLine = new TableLine(kBiasY / 2);
            mTableLine.AddColumn(kBiasX0 - 15, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            //mTableLine.Text[0].Text = "ПЧН #4";
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));

            mTableStatusLine = new TableLine(kBiasY / 2);
            mTableStatusLine.AddColumn(kBiasX0 - 15, null, Align.Center, 16, new Color(0xD1D3D4FF), new GfxPoint(0, 5));
            mTableStatusLine.Text[0].Text = "статус:";
            mTableStatusLine.AddColumn(kBiasX * 5, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));

            mTable.AddLine(mTableStatusLine);
            mTable.AddLine(mTableLine);

            mTable.AddLine(new TableLine(mTableStatusLine));
            mTable.AddLine(new TableLine(mTableLine));

            mTable.AddLine(new TableLine(mTableStatusLine));
            mTable.AddLine(new TableLine(mTableLine));

            mTable.AddLine(new TableLine(mTableStatusLine));
            mTable.AddLine(new TableLine(mTableLine));

            //mTable.SetBorder(1, Palette.Lime); // for debug
            mTable.Move(15, 0);

            mTable.GetCellById(7, 0).Text = "Uz 2";
            mTable.GetCellById(5, 0).Text = "Uz 3";
            mTable.GetCellById(3, 0).Text = "Uz 4";
            mTable.GetCellById(1, 0).Text = "Uz 5";


            #region temperature
            mReciever.GetSignal("uz.2.temperature").OnUpdate += sensor => mTable.GetCellById(7, 1).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.3.temperature").OnUpdate += sensor =>
            {
                mTable.GetCellById(5, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.4.temperature").OnUpdate += sensor => mTable.GetCellById(3, 1).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.5.temperature").OnUpdate += sensor => mTable.GetCellById(1, 1).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 1).Text = "-";
            mTable.GetCellById(5, 1).Text = "-";
            mTable.GetCellById(3, 1).Text = "-";
            mTable.GetCellById(1, 1).Text = "-";
            #endregion

            #region current
            mReciever.GetSignal("uz.2.current").OnUpdate += sensor => mTable.GetCellById(7, 2).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.3.current").OnUpdate += sensor => mTable.GetCellById(5, 2).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.4.current").OnUpdate += sensor => mTable.GetCellById(3, 2).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.5.current").OnUpdate += sensor => mTable.GetCellById(1, 2).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 2).Text = "-";
            mTable.GetCellById(5, 2).Text = "-";
            mTable.GetCellById(3, 2).Text = "-";
            mTable.GetCellById(1, 2).Text = "-";
            #endregion

            #region voltage
            mReciever.GetSignal("uz.2.voltage").OnUpdate += sensor => mTable.GetCellById(7, 3).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.3.voltage").OnUpdate += sensor => mTable.GetCellById(5, 3).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.4.voltage").OnUpdate += sensor => mTable.GetCellById(3, 3).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.5.voltage").OnUpdate += sensor => mTable.GetCellById(1, 3).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 3).Text = "-";
            mTable.GetCellById(5, 3).Text = "-";
            mTable.GetCellById(3, 3).Text = "-";
            mTable.GetCellById(1, 3).Text = "-";
            #endregion

            // TODO: привязать к реальным значениям
            #region freq
            mReciever.GetSignal("uz.2.frequency").OnUpdate += sensor => mTable.GetCellById(7, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mReciever.GetSignal("uz.3.frequency").OnUpdate += sensor => mTable.GetCellById(5, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mReciever.GetSignal("uz.4.frequency").OnUpdate += sensor => mTable.GetCellById(3, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mReciever.GetSignal("uz.5.frequency").OnUpdate += sensor => mTable.GetCellById(1, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mTable.GetCellById(7, 4).Text = "-";
            mTable.GetCellById(5, 4).Text = "-";
            mTable.GetCellById(3, 4).Text = "-";
            mTable.GetCellById(1, 4).Text = "-";
            #endregion

            #region rpm - энкодера нет физически
            //mReciever.GetSignal("uz.2.speed").OnUpdate += sensor => mTable.GetCellById(7, 5).Text = string.Format("{0}", sensor.Value);
            //mReciever.GetSignal("uz.3.speed").OnUpdate += sensor => mTable.GetCellById(5, 5).Text = string.Format("{0}", sensor.Value);
            //mReciever.GetSignal("uz.4.speed").OnUpdate += sensor => mTable.GetCellById(3, 5).Text = string.Format("{0}", sensor.Value);
            //mReciever.GetSignal("uz.5.speed").OnUpdate += sensor => mTable.GetCellById(1, 5).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 5).Text = "-";
            mTable.GetCellById(5, 5).Text = "-";
            mTable.GetCellById(3, 5).Text = "-";
            mTable.GetCellById(1, 5).Text = "-";
            #endregion

            // TODO: по значению
            #region status

            /*
             * mReciever.GetSignal("uz.2.error").OnUpdate += sensor => mTable.GetCellById(7, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             * mReciever.GetSignal("uz.3.error").OnUpdate += sensor => mTable.GetCellById(5, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             * mReciever.GetSignal("uz.4.error").OnUpdate += sensor => mTable.GetCellById(3, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             * mReciever.GetSignal("uz.5.error").OnUpdate += sensor => mTable.GetCellById(1, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             */

            mReciever.GetSignal("uz.2.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(6, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(6, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.3.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(4, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(4, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.4.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(2, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(2, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.5.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(0, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(0, 1).Text = string.Format("{0}", sensor.Value);
            };

            mTable.GetCellById(6, 1).Text = "6:1";
            mTable.GetCellById(4, 1).Text = "4:1";
            mTable.GetCellById(2, 1).Text = "2:1";
            mTable.GetCellById(0, 1).Text = "0:1";
            #endregion

            //mReciever.GetSignal("").OnUpdate += sensor => mTable.GetCellById(0, 0).Text = string.Format("{0}", sensor.Value);


            Move(x, y);
        }
Example #6
0
        private void AddChilds()
        {
            #region generic

            var window = this;

            mTextArea = new TextArea(window, 20, 207, 435, 25)
            {
                Text = ""
            };                                                               //, Size = 18, Background = true};
            mTextArea.SetFont(Palette.Black, 24);
            mTextArea.SetAlign(Align.Left, new GfxPoint(0, 5));


            var outline = VGPath.OpenVGPath();
            VGU.vguRoundRect(outline, 0, 0, mTextArea.Width + 6, mTextArea.Height + 6, 5, 5);
            var vgOutline = new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.White));
            vgOutline.Move(mTextArea.X - 3, mTextArea.Y - 3);
            window.AddVGPath(vgOutline);

            GenericButton(window, 15, 15, 80, "cancel", Palette.Red).OnRelease = caller =>
            {
                if (ReturnWindow == null)
                {
                    return;
                }

                mTextArea.Text = "";
                Text           = "";

                mBlink.Stop();

                mApplication.SetFocusedWindow(ReturnWindow);
            };

            GenericButton(window, 385, 15, 80, "enter", Palette.Lime).OnRelease = caller =>
            {
                if (ReturnWindow == null)
                {
                    return;
                }

                if (OnEnter != null)
                {
                    OnEnter(Text);
                }

                mTextArea.Text = "";
                Text           = "";

                mBlink.Stop();

                mApplication.SetFocusedWindow(ReturnWindow);
            };

            GenericButton(window, 110, 15, 260, "", null).OnRelease = caller =>
            {
                Text           = (Text + " ");
                mTextArea.Text = Text;
            };

            #endregion

            #region symbols

            var xPos     = 110;
            var xPosStep = 52;
            var yPos     = 150;

            #region first row

            {
                var btnRus = NumericButton(window, "rus", 20, yPos);
                btnRus.OnRelease = caller => ActivateLayout(mRusLayout);

                NumericButton(window, "0", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "1", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "2", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "3", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "4", xPos, yPos);

                xPos = 415;
                var btnDel = NumericButton(window, "del", xPos, yPos);
                btnDel.OnRelease = caller =>
                {
                    Text           = RemoveLastSymbol(Text);
                    mTextArea.Text = Text;
                };
            }

            #endregion

            #region second row
            xPos = 110;
            yPos = 107;
            {
                var btnEng = NumericButton(window, "eng", 20, yPos);
                //btnEng.PressColor = Utils.ColorPalette.Blue;
                btnEng.OnRelease = caller => ActivateLayout(mEngLayout);

                NumericButton(window, "5", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "6", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "7", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "8", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "9", xPos, yPos);
            }

            #endregion

            #region third row
            xPos = 110;
            yPos = 65;
            {
                NumericButton(window, ".", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, ",", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "_", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "#", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, ":", xPos, yPos);
            }

            #endregion

            #endregion

            #region russian
            xPos     = 10;
            xPosStep = 39;
            yPos     = 150;

            #region first row

            {
                RusButton(window, "É", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ö", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ó", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ê", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Å", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Í", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ã", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ø", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ù", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ç", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Õ", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ú", xPos, yPos);
            }

            #endregion

            #region second row

            xPos = 10;
            yPos = 107;
            {
                var btn123 = RusButton(window, "123", xPos, yPos);
                //btn123.PressColor = Utils.ColorPalette.Blue;
                btn123.OnRelease = caller => ActivateLayout(mSymbolLayout);
                xPos            += xPosStep;

                RusButton(window, "Ô", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Û", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Â", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "À", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ï", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ð", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Î", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ë", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ä", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Æ", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ý", xPos, yPos);
            }

            #endregion

            #region third row

            xPos = 10;
            yPos = 65;
            {
                var btnEng = RusButton(window, "eng", xPos, yPos);
                //btnEng.PressColor = Utils.ColorPalette.Blue;
                btnEng.OnRelease = caller => ActivateLayout(mEngLayout);
                xPos            += xPosStep;

                RusButton(window, "ß", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "×", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ñ", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ì", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "È", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ò", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ü", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Á", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Þ", xPos, yPos);
                xPos += xPosStep;

                xPos += xPosStep;
                var btnDel = RusButton(window, "del", xPos, yPos);
                btnDel.OnRelease = caller =>
                {
                    Text           = RemoveLastSymbol(Text);
                    mTextArea.Text = Text;
                };
            }

            #endregion


            #endregion

            #region english
            xPos     = 10;
            xPosStep = 39;
            yPos     = 150;

            #region first row

            {
                EngButton(window, "Q", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "W", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "E", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "R", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "T", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "Y", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "U", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "I", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "O", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "P", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "{", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "}", xPos, yPos);
            }

            #endregion

            #region second row

            xPos = 10;
            yPos = 107;
            {
                var btn123 = EngButton(window, "123", xPos, yPos);
                //btn123.PressColor = Utils.ColorPalette.Blue;
                btn123.OnRelease = caller => ActivateLayout(mSymbolLayout);
                xPos            += xPosStep;

                EngButton(window, "A", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "S", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "D", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "F", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "G", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "H", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "J", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "K", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "L", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, ";", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "\"", xPos, yPos);
            }

            #endregion

            #region third row

            xPos = 10;
            yPos = 65;
            {
                var btnRus = EngButton(window, "rus", xPos, yPos);
                //btnRus.PressColor = Utils.ColorPalette.Blue;
                btnRus.OnRelease = caller => ActivateLayout(mRusLayout);
                xPos            += xPosStep;

                EngButton(window, "Z", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "X", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "C", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "V", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "B", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "N", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "M", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "<", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, ">", xPos, yPos);
                xPos += xPosStep;

                xPos += xPosStep;
                var btnDel = EngButton(window, "del", xPos, yPos);
                btnDel.OnRelease = caller =>
                {
                    Text           = RemoveLastSymbol(Text);
                    mTextArea.Text = Text;
                };
            }

            #endregion


            #endregion
        }
Example #7
0
        private void Init()
        {
            mTimer = new Timer(ProcessTimerEvent, null, Timeout.Infinite, Timeout.Infinite);

            mPath        = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            mFillPaint   = VG.vgCreatePaint();
            mStrokePaint = VG.vgCreatePaint();

            mGrapihcs = new List <GraphicsData>();

            var color = new VGSolidColor(new Color(0xD1D3D4FF));

            #region Lines & arrows
            {
                var path = VGPath.OpenVGPath();
                VG.vgLoadIdentity();

                const float kXBias = 3f;
                const float kYBias = 12f;

                VGU.vguLine(path, 0, 0, Width - 60, 0);          // OX
                //VGU.vguLine(path, 0, 0, 0, Height - 40); // OY
                VGU.vguLine(path, 0, 0, 0, Height - kYBias - 1); // OY



                var yArroyBias = Height - kYBias - 1;
                //var yArroyBias = Height - 40f;

                var pathData = new float[16];
                pathData[0] = -kXBias;
                pathData[1] = yArroyBias;          //0f;
                pathData[2] = 0f;
                pathData[3] = yArroyBias + kYBias; // kYBias;
                pathData[4] = kXBias;
                pathData[5] = yArroyBias;          //0f;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var xArroyBias = Width - 60f;
                pathData[0] = xArroyBias;
                pathData[1] = -kXBias;
                pathData[2] = xArroyBias + kYBias;
                pathData[3] = 0f;
                pathData[4] = xArroyBias;
                pathData[5] = kXBias;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var vgPath = new VGPath(path, color, color);
                vgPath.Move(35, 15);
                Arrows = vgPath;
            }

            #endregion

            #region Grid

            {
                var path = VGPath.OpenVGPath();
                VGU.vguLine(path, 0, 0, Width - 60, 0); // OX

                var vgPath = new VGPath(path, null, null);
                //vgPath.SetStroke(color);
                vgPath.SetStroke(color, new[] { 2.0f, 2.0f });
                vgPath.StrokeWidth = 0.5f;
                vgPath.Move(40, 20 + 180);

                Grid = vgPath;
            }

            #endregion

            #region childs
            mHLabels = new[]
            {
                new TextArea(this, 15, 0, 36, 18)
                {
                    Text = "1"
                },
                new TextArea(this, (int)(kOxWidht * 50 / 177), 0, 36, 18)
                {
                    Text = "50"
                },
                new TextArea(this, (int)(kOxWidht * 100 / 177), 0, 36, 18)
                {
                    Text = "100"
                },
                new TextArea(this, (int)(kOxWidht * 150 / 177), 0, 36, 18)
                {
                    Text = "150"
                }
            };

            var oyLabel = new TextArea(this, -10, Height, 60, 18)
            {
                Text = "P, бар"
            };
            mVRuntimeLabels = new[]
            {
                oyLabel,
                new TextArea(this, -10, 10, 36, 18)
                {
                    Text = "0"
                },

                new TextArea(this, -10, Height * 50 / kHeight, 36, 18)
                {
                    Text = "100"
                },
                new TextArea(this, -10, Height * 100 / kHeight, 36, 18)
                {
                    Text = "200"
                },
                new TextArea(this, -10, Height * 150 / kHeight, 36, 18)
                {
                    Text = "300"
                },
                new TextArea(this, -10, Height * 200 / kHeight, 36, 18)
                {
                    Text = "400"
                },
                new TextArea(this, -10, Height * 250 / kHeight, 36, 18)
                {
                    Text = "500"
                }
            };


            mVHistoryLabels = new[]
            {
                new TextArea(this, -15, Height * 10 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 25 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 60 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 75 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 110 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 125 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 160 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 175 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 210 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 225 / kHeight, 45, 18)
                {
                    Text = ""
                }
            };

            foreach (var label in mHLabels)
            {
                label.SetFont(new Color(0xD1D3D4FF), 20);
                label.SetAlign(Align.Right);
            }


            foreach (var label in mVRuntimeLabels)
            {
                label.SetFont(new Color(0xD1D3D4FF), 20);
                label.SetAlign(Align.Right);
            }


            foreach (var label in mVHistoryLabels)
            {
                label.SetFont(new Color(0xD1D3D4FF), 20);
                label.SetAlign(Align.Right);
                label.Hide();
            }

            //mVRuntimeLabels[mVRuntimeLabels.Length - 2].SetFont(new Color(0x5EE82CFF), 20);// "180"

            var oxLabel = new TextArea(this, Width - 20, 0, 60, 18)
            {
                Text = "N"
            };
            oxLabel.SetFont(new Color(0xD1D3D4FF), 20);


            oyLabel.SetFont(new Color(0xD1D3D4FF), 20);
            oyLabel.SetAlign(Align.Left, new GfxPoint(0, 5));
            #endregion

            Move(170, 310);

            //ImageCacheBorder = 50; // work

            Type = VisializationType.Realtime;
        }