public Keyboard(DataEntryField field) { MoreKey = new DMIIconButton("NA_23.bmp", "NA_23.bmp", "More", false, () => { CurrentKeyPage++; if (CurrentKeyPage * 11 >= Keys.Count) { CurrentKeyPage = 0; } field.DataEntryWindow.PrepareLayout(); }, 102, 50, field.DMI); MoreKey.Enabled = true; }
public MessageArea(DriverMachineInterface dmi) : base(Viewer.Catalog.GetString("Acknowledge"), true, dmi, false) { MaxTextLines = dmi.IsSoftLayout ? 4 : 5; Height = MaxTextLines * RowHeight; Width = 234; DisplayedTexts = new TextPrimitive[MaxTextLines]; DisplayedTimes = new TextPrimitive[MaxTextLines]; ButtonScrollUp = new DMIIconButton("NA_13.bmp", "NA_15.bmp", Viewer.Catalog.GetString("Scroll Up"), true, () => { if (CurrentPage < NumPages - 1) { CurrentPage++; SetMessages(); } }, 46, Height / 2, dmi); ButtonScrollDown = new DMIIconButton("NA_14.bmp", "NA_16.bmp", Viewer.Catalog.GetString("Scroll Down"), true, () => { if (CurrentPage > 0) { CurrentPage--; SetMessages(); } }, 46, Height / 2, dmi); PressedAction = () => { if (AcknowledgingMessage != null) { var ackmsg = AcknowledgingMessage.Value; ackmsg.Acknowledgeable = false; ackmsg.Acknowledged = true; int index = MessageList.IndexOf(ackmsg); if (index != -1) { MessageList[index] = ackmsg; } AcknowledgingMessage = null; } }; ScaleChanged(); }
public DataEntryWindow(DMIDataEntryDefinition definition, DriverMachineInterface dmi) : base(definition.WindowTitle, definition.FullScreen || definition.Fields.Count > 1, dmi) { Definition = definition; Title = definition.WindowTitle; int i = 0; LabelFont = GetFont(FontHeightLabel); foreach (var field in Definition.Fields) { Fields.Add(new DataEntryField(field, i, this, !FullScreen)); i++; } if (FullScreen) { NextButton = new DMIIconButton("NA_17.bmp", "NA_18.2.bmp", Viewer.Catalog.GetString("Next"), true, () => { if ((ActiveField / 4) < (Fields.Count / 4)) { NextButton.Enabled = false; PrevButton.Enabled = true; ActiveField = 4 * (ActiveField / 4 + 1); PrepareLayout(); } }, 82, 50, dmi); PrevButton = new DMIIconButton("NA_18.bmp", "NA_19.bmp", Viewer.Catalog.GetString("Next"), true, () => { if (ActiveField > 3) { NextButton.Enabled = true; PrevButton.Enabled = false; ActiveField = 4 * (ActiveField / 4 - 1); PrepareLayout(); } }, 82, 50, dmi); DataEntryCompleteLabel = new DMITextLabel(Title + " data entry complete?", 334, 50, dmi); YesButton = new DMIYesButton(dmi); YesButton.PressedAction = () => { bool overrideOperational = YesButton.DelayType; YesButton.DelayType = false; Dictionary <string, string> values = new Dictionary <string, string>(); foreach (var field in Fields) { values[field.Name] = field.AcceptedValue; } bool checkPassed = true; foreach (var check in Definition.TechnicalCrossChecks) { var conflict = check.GetConflictingVariables(values); foreach (var name in conflict) { foreach (var field in Fields) { if (field.Name == name) { checkPassed = false; field.TechnicalCrossCheckInvalid = true; break; } } } } if (!checkPassed) { return; } if (overrideOperational) { foreach (var check in Definition.OperationalCrossChecks) { var conflict = check.GetConflictingVariables(values); foreach (var name in conflict) { foreach (var field in Fields) { if (field.Name == name) { checkPassed = false; field.OperationalCrossCheckInvalid = true; break; } } } } } if (!checkPassed) { YesButton.DelayType = true; return; } string result = WindowTitle + "\n"; foreach (var field in Fields) { result += field.Name + "=" + field.AcceptedValue + "\n"; } //if (DMI.ETCSStatus != null) DMI.ETCSStatus.DriverActionResult = result; DMI.ExitWindow(this); }; YesButton.ExtendedSensitiveArea = new Rectangle(0, 50, 0, 0); PrevButton.Enabled = false; NextButton.Enabled = false; } if (Fields.Count > 4) { NextButton.Enabled = true; } PrepareLayout(); Visible = true; }