ArcGISWindowsPhoneSDK.AddressToLocation.LocatorTask_AddressToLocationsCompleted C# (CSharp) Method

LocatorTask_AddressToLocationsCompleted() private method

private LocatorTask_AddressToLocationsCompleted ( object sender, ESRI args ) : void
sender object
args ESRI
return void
        private void LocatorTask_AddressToLocationsCompleted(object sender, ESRI.ArcGIS.Client.Tasks.AddressToLocationsEventArgs args)
        {
            List<AddressCandidate> returnedCandidates = args.Results;

            AddressBorder.Visibility = System.Windows.Visibility.Collapsed;

            if (returnedCandidates.Count > 0)
            {
                AddressCandidate candidate = returnedCandidates[0];

                Graphic graphic = new Graphic()
                {
                    Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as Symbol,
                    Geometry = candidate.Location
                };

                graphic.Attributes.Add("Address", candidate.Address);

                graphicsLayer.Graphics.Add(graphic);

                ResultsTextBlock.Visibility = System.Windows.Visibility.Visible;
                ResultsTextBlock.Text = candidate.Address;

                double displaySize = MyMap.MinimumResolution * 30;
                ESRI.ArcGIS.Client.Geometry.Envelope displayExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(
                    candidate.Location.X - (displaySize / 2),
                    candidate.Location.Y - (displaySize / 2),
                    candidate.Location.X + (displaySize / 2),
                    candidate.Location.Y + (displaySize / 2));
                MyMap.ZoomTo(displayExtent);
            }
        }