private void HandleOptionCommand(object option) { var parameterOption = option as string; if (parameterOption == "OK") { SafeWaterDepthSettingMessage safeWaterMessage = new SafeWaterDepthSettingMessage(SafetyContourDepth, SafetyWaterDepth, ShallowWaterDepth, DeepWaterDepth, DepthUnit); Messenger.Default.Send(safeWaterMessage); } WindowStateMessage windowMessage = new WindowStateMessage(S57WindowState.Close); Messenger.Default.Send(windowMessage, "SafeWaterDepthSettingsWindow"); }
private void HandleSafeWaterDepthMessage(SafeWaterDepthSettingMessage message) { if (!map.Overlays.Contains(chartsOverlayName)) { return; } LayerOverlay overlay = map.Overlays[chartsOverlayName] as LayerOverlay; var layers = overlay.Layers.OfType <NauticalChartsFeatureLayer>(); foreach (NauticalChartsFeatureLayer layer in layers) { layer.SafetyDepthInMeter = NauticalChartsFeatureLayer.ConvertDistanceToMeters(message.SafetyWaterDepth, message.DepthUnit); layer.ShallowDepthInMeter = NauticalChartsFeatureLayer.ConvertDistanceToMeters(message.ShallowWaterDepth, message.DepthUnit); layer.DeepDepthInMeter = NauticalChartsFeatureLayer.ConvertDistanceToMeters(message.DeepWaterDepth, message.DepthUnit); layer.SafetyContourDepthInMeter = NauticalChartsFeatureLayer.ConvertDistanceToMeters(message.SafetyContourDepth, message.DepthUnit); } Globals.SafetyDepth = message.SafetyWaterDepth; Globals.DeepDepth = message.DeepWaterDepth; Globals.ShallowDepth = message.ShallowWaterDepth; Globals.SafetyContour = message.SafetyContourDepth; Globals.CurrentDepthUnit = message.DepthUnit; map.Refresh(); }