Пример #1
0
        public MenuWindow(DMIMenuWindowDefinition definition, DriverMachineInterface dmi) : base(definition.WindowTitle, false, dmi)
        {
            int i = 0;

            foreach (var buttondef in definition.Buttons)
            {
                DMIButton b;
                if (buttondef is DMITextButtonDefinition)
                {
                    b = new DMITextButton((buttondef as DMITextButtonDefinition).Label, buttondef.ConfirmerCaption, buttondef.Enabled, () => { /* TODO */ }, 153, 50, dmi);
                }
                else if (buttondef is DMIIconButtonDefinition)
                {
                    b = new DMIIconButton((buttondef as DMIIconButtonDefinition).EnabledIconName, (buttondef as DMIIconButtonDefinition).DisabledIconName, buttondef.ConfirmerCaption, buttondef.Enabled, () => { /* TODO */ }, 153, 50, dmi);
                }
                else
                {
                    i++;
                    continue;
                }
                Buttons.Add(b);
                AddToLayout(b, new Point(i % 2 * 153, 50 + 50 * (i / 2)));
                i++;
            }
        }
Пример #2
0
        public DedicateKeyboard(List <string> keyLabels, DataEntryField field) : base(field)
        {
            int i = 0;

            foreach (string label in keyLabels)
            {
                if (label == null)
                {
                    Keys.Add(null);
                    i++;
                    continue;
                }
                DMIButton but = new DMITextButton(label, label, false, () => field.HandleKeyPress(label), 102, 50, field.DMI);
                but.Enabled = true;
                Keys.Add(but);
                i++;
            }
        }
Пример #3
0
        public NumericKeyboard(DataEntryField field, bool enhanced = false) : base(field)
        {
            for (int i = 1; i < 10; i++)
            {
                string digitname = i.ToString();
                Keys.Add(new DMITextButton(digitname, digitname, false, () => field.HandleKeyPress(digitname), 102, 50, field.DMI, 16));
            }
            Keys.Add(new DMIIconButton("NA_21.bmp", "NA_21.bmp", "Delete", false, () => field.HandleKeyPress("DEL"), 102, 50, field.DMI));
            Keys.Add(new DMITextButton("0", "0", false, () => field.HandleKeyPress("0"), 102, 50, field.DMI, 16));
            foreach (var key in Keys)
            {
                key.Enabled = true;
            }
            var dotkey = new DMITextButton(".", ".", false, () => field.HandleKeyPress("."), 102, 50, field.DMI, 16);

            dotkey.Enabled = enhanced;
            Keys.Add(dotkey);
        }
Пример #4
0
        public AlphanumericKeyboard(DataEntryField field) : base(field)
        {
            Keys.Add(new DMITextButton("1", "1", false, () => field.HandleKeyPress("1"), 102, 50, field.DMI, 16));
            Keys.Add(new AlphanumericButton("2", "abc", field));
            Keys.Add(new AlphanumericButton("3", "def", field));
            Keys.Add(new AlphanumericButton("4", "ghi", field));
            Keys.Add(new AlphanumericButton("5", "jkl", field));
            Keys.Add(new AlphanumericButton("6", "mno", field));
            Keys.Add(new AlphanumericButton("7", "pqrs", field));
            Keys.Add(new AlphanumericButton("8", "tuv", field));
            Keys.Add(new AlphanumericButton("9", "wxyz", field));
            Keys.Add(new DMIIconButton("NA_21.bmp", "NA_21.bmp", "Delete", false, () => field.HandleKeyPress("DEL"), 102, 50, field.DMI));
            Keys.Add(new DMITextButton("0", "0", false, () => field.HandleKeyPress("0"), 102, 50, field.DMI, 16));
            foreach (var key in Keys)
            {
                key.Enabled = true;
            }
            var dotkey = new DMITextButton(".", ".", false, () => field.HandleKeyPress("."), 102, 50, field.DMI);

            Keys.Add(dotkey);
        }