diff options
author | David Karlaš <david.karlas@xamarin.com> | 2014-07-10 17:27:25 +0400 |
---|---|---|
committer | David Karlaš <david.karlas@xamarin.com> | 2014-07-10 17:27:25 +0400 |
commit | f87fc8908efac535706a068760a183e8d2fc894d (patch) | |
tree | 044abbffc85b72fb222d9902e71f0de8b39fcb7f /main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Converters | |
parent | b2d52c547ea4cd0ba2c2878a58bb17c485e4e6a0 (diff) |
[Debugger] Location Preview and Android location converter
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Converters')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Converters/LocationConverters.cs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Converters/LocationConverters.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Converters/LocationConverters.cs new file mode 100644 index 0000000000..6021b707f4 --- /dev/null +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Converters/LocationConverters.cs @@ -0,0 +1,60 @@ +// +// LocationConverters.cs +// +// Author: +// David Karlaš <david.karlas@xamarin.com> +// +// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using Mono.Debugging.Client; + +namespace MonoDevelop.Debugger.Converters +{ + public class GpsLocation + { + public double Latitude { get; set; } + + public double Longitude { get; set; } + } + + public class LocationConverters : DebugValueConverter<GpsLocation> + { + #region implemented abstract members of DebugValueConverter + + public override bool CanGetValue (ObjectValue val) + { + return val.TypeName == "Android.Locations.Location"; + } + + public override GpsLocation GetValue (ObjectValue val) + { + var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone (); + ops.AllowTargetInvoke = true; + return new GpsLocation () { + Latitude = (double)val.GetChild ("Latitude", ops).GetRawValue (ops), + Longitude = (double)val.GetChild ("Longitude", ops).GetRawValue (ops) + }; + } + + #endregion + } +} + |