示例#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++;
            }
        }
 public DMISubwindow(string title, bool fullScreen, DriverMachineInterface dmi) : base(dmi, fullScreen ? 640 : 306, 450)
 {
     WindowTitle         = title;
     FullScreen          = fullScreen;
     CloseButton         = new DMIIconButton("NA_11.bmp", "NA_12.bmp", Viewer.Catalog.GetString("Close"), true, () => dmi.ExitWindow(this), 82, 50, dmi);
     CloseButton.Enabled = true;
     BackgroundColor     = DMI.BlackWhiteTheme ? Color.Black : ColorBackground;
     SetFont();
     AddToLayout(CloseButton, new Point(fullScreen ? 334 : 0, 400));
 }