Beispiel #1
0
        /// <summary>
        /// Shows the planting info window for varities that already have been added to a planting.
        /// </summary>
        /// <param name="plantingInfo">Planting info.</param>
        /// <param name="action">Action.</param>
        /// <param name="planting">Planting.</param>
        /// <param name="varietyName">Variety name.</param>
        public static void ShowPlantingInfoWindow(PlantingInfo plantingInfo, System.Action <PlantingInfo> action, Planting planting, string varietyName)
        {
            EditPlantingInfoWindow window = new EditPlantingInfoWindow(plantingInfo, action);

            window.Title = $"Add {varietyName} to {planting.Name}";
            window.ShowAll();
        }
Beispiel #2
0
        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);
        }
 public bool IsIrrigationField(PlantingInfo <MushroomField> plant)
 {
     return(plant?.Doing == true && plant.FieldCount > 0 ? plant.Fields.Any(it => it.IrrigationField == true) : false);
 }
 public bool IsIrrigationField(PlantingInfo <GrowingFieldWithNames> plant)
 {
     return(plant?.Doing == true && plant.FieldCount > 0 ? plant.Fields.Any(it => it.IrrigationField == true) : false);
 }