public static LegendToggleCommand CreateToggleLayerLabelCommand(MapPresenter map, ILayer layer, LabelParameters labels) { LegendToggleCommand result = new LegendToggleCommand(); result.PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarTextSerif; result.NotCheckedPathMarkup = IRI.Jab.Common.Assets.ShapeStrings.AppbarExtension.appbarTextSerifNone; result.ToolTip = "نمایش برچسب عوارض"; result.Layer = layer; EventHandler <CustomEventArgs <LabelParameters> > labels_IsInScaleRangeChanged = (sender, e) => { if (e.Arg != null) { result.IsEnabled = e.Arg.IsInScaleRange; } }; EventHandler <CustomEventArgs <LabelParameters> > layer_OnLabelChanged = (sender, e) => { if (e.Arg != null) { e.Arg.OnIsInScaleRangeChanged -= labels_IsInScaleRangeChanged; e.Arg.OnIsInScaleRangeChanged += labels_IsInScaleRangeChanged; } }; layer.OnLabelChanged -= layer_OnLabelChanged; layer.OnLabelChanged += layer_OnLabelChanged; layer.Labels = labels; result.Command = new RelayCommand(param => { if (layer == null) { return; } if (result.IsSelected) { result.Layer.Labels.IsOn = true; //map.Refresh(); } else { result.Layer.Labels.IsOn = false; //map.Refresh(); } map.RefreshLayerVisibility(result.Layer); }); return(result); }