public static void AddPresetRow(string name, List <string> zoneIds) { MapCreatorData.ZoneSelectionPresetsRow row = mapCreatorData.ZoneSelectionPresets.NewZoneSelectionPresetsRow(); row.Name = name; row.Zones = String.Join(",", zoneIds); mapCreatorData.ZoneSelectionPresets.AddZoneSelectionPresetsRow(row); SavePresets(); }
private void deletePresetButton_Click(object sender, EventArgs e) { if (presetsComboBox.SelectedItem == null || !(presetsComboBox.SelectedItem is MapCreatorData.ZoneSelectionPresetsRow)) { return; } MapCreatorData.ZoneSelectionPresetsRow preset = (MapCreatorData.ZoneSelectionPresetsRow)presetsComboBox.SelectedItem; DataWrapper.RemovePreset(preset); UpdatePresets(); }
private void savePresetButton_Click(object sender, EventArgs e) { if (presetsComboBox.SelectedItem == null || !(presetsComboBox.SelectedItem is MapCreatorData.ZoneSelectionPresetsRow)) { return; } MapCreatorData.ZoneSelectionPresetsRow preset = (MapCreatorData.ZoneSelectionPresetsRow)presetsComboBox.SelectedItem; List <string> zoneIds = new List <string>(); foreach (ZoneSelection selectedZone in selectedMapsListBox.Items) { zoneIds.Add(selectedZone.Id); } preset.Zones = string.Join(",", zoneIds); DataWrapper.SavePresets(); }
private void loadPresetButton_Click(object sender, EventArgs e) { if (presetsComboBox.SelectedItem == null || !(presetsComboBox.SelectedItem is MapCreatorData.ZoneSelectionPresetsRow)) { return; } MapCreatorData.ZoneSelectionPresetsRow preset = (MapCreatorData.ZoneSelectionPresetsRow)presetsComboBox.SelectedItem; SelectedZones.Clear(); foreach (string zoneId in preset.Zones.Split(',')) { var result = m_allNodes.Where(n => ((ZoneSelection)n.Tag).Id == zoneId).Select(n => (ZoneSelection)n.Tag); if (result.Count() > 0) { SelectedZones.Add(result.First()); } } UpdateSelectedMapsListBox(); }
public static void RemovePreset(MapCreatorData.ZoneSelectionPresetsRow row) { mapCreatorData.ZoneSelectionPresets.RemoveZoneSelectionPresetsRow(row); SavePresets(); }