public EditPlantingInfoWindow(PlantingInfo plantingInfo, System.Action <PlantingInfo> okAction) : base("Edit planting information") { GardenPlannerSettings settings = GardenPlannerSettings.GetSettings(); AddControlButton("cancel", () => { this.Destroy(); }); AddControlButton("ok", () => { plantingInfo.Count = numberPlantsSpinButton.ValueAsInt; plantingInfo.PlannedPlantingDate = plannedDateBox.GetDate(); plantingInfo.AlreadyPlanted = alreadyPlantedButton.Active; plantingInfo.PlantingDate = actualDateBox.GetDate(); this.Destroy(); okAction.Invoke(plantingInfo); }); numberPlantsSpinButton = new SpinButton(1, settings.MaxPlantingCount, 1); numberPlantsSpinButton.Value = plantingInfo.Count; AddLabeledEntry("Number of plants", numberPlantsSpinButton); plannedDateBox = new DateEntryBox("planned planting date", DateEntryType.MiddleMonthDateEntry); plannedDateBox.SetDate(plantingInfo.PlannedPlantingDate); AddEntry(plannedDateBox); alreadyPlantedButton = new CheckButton("already planted") { Active = plantingInfo.AlreadyPlanted }; alreadyPlantedButton.Clicked += (sender, e) => { actualDateBox.Sensitive = alreadyPlantedButton.Active; }; AddEntry(alreadyPlantedButton); actualDateBox = new DateEntryBox("planted on", DateEntryType.DayDateEntry) { Sensitive = alreadyPlantedButton.Active }; actualDateBox.SetDate(plantingInfo.PlantingDate); AddEntry(actualDateBox); }