public void RefreshLayers() { chbLayerNames.Items.Clear(); var layers = MapDataAdapter.GetAllLayers(); if (layers.Count() > 0) { gbxLayers.Visible = true; chbLayerNames.Items.AddRange(layers.ToArray()); chbLayerNames.SetItemChecked(0, true); } else { gbxLayers.Visible = false; } }
private bool ValidateName() { string error = null; if (string.IsNullOrWhiteSpace(txtName.Text)) { error = "Please enter a name"; } else if (MapDataAdapter.GetAllLayers().Any(item => item.Name.Equals(txtName.Text, StringComparison.OrdinalIgnoreCase))) { error = "The layer name already exists"; } errPrvAddLayer.DisplayError(txtName, error); return(error == null); }