/// <summary> /// Handler for key pressed events /// </summary> /// <param name="sender">The mapViewModel</param> /// <param name="args">The keyEvent args</param> protected override void OnKeyDown(MapViewModel sender, MapKeyEventArgs args) { // Default behavior base.OnKeyDown(sender, args); // Get the keys var keys = args.Key; // Act upon the different keys if (keys == Key.C) { // C for Close _activeMeasurer.CloseMeasurer(); args.Handled = true; } else if (keys == Key.Enter) { // End the measurer _activeMeasurer.EndMeasuring(); args.Handled = true; } else if (keys == Key.Delete || keys == Key.Back) { // Remove the last coordinate of the active measurer _activeMeasurer.DeleteLastCoordinate(); args.Handled = true; } }
/// <summary> /// Handler for key pressed events /// </summary> /// <param name="sender">The mapViewModel</param> /// <param name="args">The keyEvent args</param> protected override void OnKeyDown(MapViewModel sender, MapKeyEventArgs args) { // Default behavior base.OnKeyDown(sender, args); // Get the keys var keys = args.Key; // Act upon the different keys if (keys == Key.C) { // C for Close _activeMeasurer.CloseMeasurer(); args.Handled = true; } else if (keys == Key.Enter) { // End the measurer _activeMeasurer.EndMeasuring(); args.Handled = true; } else if (keys == Key.Delete || keys == Key.Back) { // Remove the last coordinate of the active measurer _activeMeasurer.DeleteLastCoordinate(); args.Handled = true; ///////////////////////// //Si se dehizo el ultimo trazo eliminar la ultima coordenada pulsada y que se almacena en las _str //Deshacer las Latitudes int intUltimaLat = _viewModel.Latitud.LastIndexOf(','); if (intUltimaLat != -1) { int sizeUltimaLat = _viewModel.Latitud.Length; string strUltimaLat = _viewModel.Latitud; _viewModel.Latitud = strUltimaLat.Remove(intUltimaLat, (sizeUltimaLat - intUltimaLat)); } else { _viewModel.Latitud = string.Empty; } //Deshacer las Longitudes int intUltimaLon = _viewModel.Longitud.LastIndexOf(','); if (intUltimaLon != -1) { int sizeUltimaLon = _viewModel.Longitud.Length; string strUltimaLon = _viewModel.Longitud; _viewModel.Longitud = strUltimaLon.Remove(intUltimaLon, (sizeUltimaLon - intUltimaLon)); } else { _viewModel.Longitud = string.Empty; } ///////////////////// } }