private void OnLayerPropertyChanged(object sender, PropertyChangedEventArgs e)
{
var layer = sender as Layer;
if (layer == null)
{
return;
}
if (e.PropertyName == "MinScale")
{
MinimumScale = Layer.MinScale != 0 && !double.IsNaN(Layer.MinScale)
? Math.Min(_serviceMinScale, Layer.MinScale)
: _serviceMinScale;
if (LegendTree != null)
{
LegendTree.UpdateLayerVisibilities();
}
}
else if (e.PropertyName == "MaxScale")
{
MaximumScale = !double.IsNaN(Layer.MaxScale)
? Math.Max(_serviceMaxScale, Layer.MaxScale)
: _serviceMaxScale;
if (LegendTree != null)
{
LegendTree.UpdateLayerVisibilities();
}
}
else if (e.PropertyName == "IsVisible")
{
if (LegendTree != null)
{
LegendTree.UpdateLayerVisibilities();
}
}
else if (e.PropertyName == "DisplayName")
{
Label = layer.DisplayName;
}
else if (e.PropertyName == "Status")
{
//if (!(sender is GroupLayerBase)) // For group layers, we don't wait for initialized event
Refresh();
}
}