public void ShowAreaSelectionInfo(GardenArea area) { if (area == null) { ShowEmptyAreaSelectionInfo(); return; } AreaInfo.Buffer.Clear(); AreaInfo.AddEntry(area.Name, AreaInfo.tag_headline); AreaInfo.AddEntry(area.Description, AreaInfo.tag_italic); AreaInfo.AddEntry("Created: " + area.created.Month + "/" + area.created.Year); AreaInfo.AddEntry("Removed: " + area.removed.Month + "/" + area.removed.Year); AreaInfo.AddEntry($"Size: {area.AreaSize() / 10000f}m²"); if (area is Planting planting) { AreaInfo.AddEntry("Varieties:"); foreach (KeyValuePair <VarietyKeySeq, PlantingInfo> pair in planting.Varieties) { VarietyKeySeq seq = pair.Key; int count = pair.Value.Count; PlantVariety variety = GardenData.LoadedData.GetVariety(seq); Plant plant = GardenData.LoadedData.GetPlant(seq.FamilyKey, seq.PlantKey); AreaInfo.AddEntry(variety.Name + " (" + plant.Name + "): " + count); } } AreaInfo.ApplyTags(); }
private InfoPlantVarietyWindow(PlantVariety variety, bool create, bool isEdited) : base("Info about " + variety.Name, isEdited) { Variety = variety; Create = create; AddEntry(variety.Name, infoView.tag_headline); Plant plant = GardenData.LoadedData.GetPlant(variety.FamilyID, variety.PlantID); AddEntry(plant.Name + "-Sorte" + " ", false); AddEntry("(" + plant.ScientificName + ")", infoView.tag_weak); AddEntry("Beschreibung: ", false); AddEntry(variety.Description, infoView.tag_italic); AddEntry("Aussaat draußen: " + variety.PlantOutsideDateRange); ApplyTags(); }
public void MakeSelection() { MainWindow win = MainWindow.GetInstance(); win.SelectGardenEntry(SelectedArea); win.PlantAddButton.Sensitive = SelectedArea is Planting && win.SelectedEntry is PlantVariety; win.AreaEditButton.Sensitive = true; Draw(); if (SelectedArea is Garden.Garden g) { TooltipText = "Garden '" + g.Name + "'"; } else if (SelectedArea is Planting p) { string s = ""; foreach (var k in p.Varieties.Keys) { PlantVariety v = GardenData.LoadedData.GetVariety(k); s += v.Name + ", "; } if (s.Length > 0) { s = s.Substring(0, s.Length - 2); TooltipText = "Planting '" + p.Name + "': " + s; } else { TooltipText = "Planting '" + p.Name + "'"; } } else if (SelectedArea is GardenArea a) { TooltipText = "MethodArea '" + a.Name + "'"; } }
public static void ShowWindow(PlantVariety variety, bool isEdited = false, bool create = false) { InfoPlantVarietyWindow win = new InfoPlantVarietyWindow(variety, create, isEdited); win.ShowAll(); }
public static GardenData TestData() { GardenData Data = new GardenData("testdata"); var zwiebelgewaechse = new PlantFamily("Zwiebelgewaechse", ""); Data.AddFamily("zwiebelgewaechse", zwiebelgewaechse); var knoblauch = new Plant("Knoblauch", ""); knoblauch.FeederType = FeederType.Medium; knoblauch.ScientificName = "allium sativum"; zwiebelgewaechse.AddPlant("knoblauch", knoblauch); var morado = new PlantVariety("Morado", "rotviolett, aus Spanien, geeignet für Herbstpflanzung, bildet Brutzwiebeln"); morado.SetColor(new Cairo.Color(0.9, 0.9, 0.9)); knoblauch.AddVariety("morado", morado); var vallelado = new PlantVariety("Vallelado", "bla"); vallelado.SetColor(new Cairo.Color(0.9, 0.9, 0.9)); knoblauch.AddVariety("vallelado", vallelado); var nachtschattengew = new PlantFamily("Nachtschattengewächse", ""); Data.AddFamily("nachtschattengewaechse", nachtschattengew); var kartoffeln = new Plant("Kartoffel", ""); kartoffeln.SetColor(new Cairo.Color(0.2, 0.8, 0.8)); nachtschattengew.AddPlant("kartoffel", kartoffeln); var bed1 = new Garden.Garden("Omas Garten", "Alte Garten von Oma", 2000, 1, 2000, 1); var bed2 = new Garden.Garden("Hauptstraßengarten", "Alte Garten von Oma", 2000, 1, 2000, 1); Data.AddGarden("oma_garten", bed1); Data.AddGarden("hptstr_garten", bed2); bed1.Shape.AddPoint(new GardenPoint(0, 0)); bed1.Shape.AddPoint(new GardenPoint(0, 200)); bed1.Shape.AddPoint(new GardenPoint(300, 200)); bed1.Shape.AddPoint(new GardenPoint(300, 0)); bed1.Shape.FinishPoints(); var compostArea = new GardenArea("Kompost", "hier wurde Kompost angewendet", 2000, 1, 2010, 6); compostArea.Shape.AddPoint(new GardenPoint(100, 100)); compostArea.Shape.AddPoint(new GardenPoint(300, 100)); compostArea.Shape.AddPoint(new GardenPoint(300, 200)); compostArea.Shape.AddPoint(new GardenPoint(100, 200)); compostArea.Shape.FinishPoints(); bed1.AddMethodArea("compost", compostArea); var plantingArea = new Planting("Planting", "hier wurde was gepflanzt", 2000, 1, 2010, 6); plantingArea.Shape.AddPoint(new GardenPoint(400, 400)); plantingArea.Shape.AddPoint(new GardenPoint(500, 400)); plantingArea.Shape.AddPoint(new GardenPoint(500, 500)); plantingArea.Shape.AddPoint(new GardenPoint(400, 500)); plantingArea.Shape.FinishPoints(); bed1.AddPlanting("planting", plantingArea); plantingArea.AddVariety(morado, new PlantingInfo() { Count = 3 }); plantingArea.AddVariety(vallelado, new PlantingInfo() { Count = 2 }); //string s = Newtonsoft.Json.JsonConvert.SerializeObject(Data, Newtonsoft.Json.Formatting.Indented); return(Data); }