public void ChangeDateForDisplayedLayers(DateTime newDateTime) { // Make a copy of the currently applied layers, so we're not iterating through // a list that we're changing on-the-fly AppliedLayer[] appliedLayerListCopy = new AppliedLayer[appliedLayers.Count]; appliedLayers.CopyTo(appliedLayerListCopy); // Cycle through all of the layers and re-apply them with a new dateTime for (int i = 0; i < appliedLayerListCopy.Length; i++) { AppliedLayer layer = appliedLayerListCopy[i]; ApplyLayer(layer.layerName, newDateTime, layer.style, layer.layerIndex); } }
private void AddToAppliedLayerList(string layerName, DateTime selectedDateTime, LayerVisualizationStyle style, int layerIndex) { AppliedLayer layer = new AppliedLayer { layerName = layerName, selectedDateTime = selectedDateTime, style = style, layerIndex = layerIndex }; // Clear matching layer from list, if necessary appliedLayers.RemoveAll(x => (x.layerIndex == layerIndex) && (x.style == style)); // Add to list appliedLayers.Add(layer); }