Пример #1
0
        public void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            (sender as WebClient).DownloadStringCompleted -= client_DownloadStringCompleted;
            if (e.Error == null)
            {
                StringReader sr = new StringReader(e.Result);
                XElement respElement = XElement.Load(sr);
                string callStatus = (string)respElement.Element("Status");
                if (callStatus.Equals("OK"))
                {
                    SiteUser user = new SiteUser()
                    {
                        IP = (string)respElement.Element("Ip"),
                        City = (string)respElement.Element("City"),
                        Country = (string)respElement.Element("CountryName"),
                        CountryCode = (string)respElement.Element("CountryCode"),
                        RegionCode = (string)respElement.Element("RegionCode"),
                        RegionName = (string)respElement.Element("RegionName"),
                        PostalCode = (string)respElement.Element("ZipPostalCode"),
                        Latitude = (double)respElement.Element("Latitude"),
                        Longitude = (double)respElement.Element("Longitude")
                    };
                    this.Resources.Add("User", user);

                }
            }
            this.RootVisual = new MainPage();
        }
Пример #2
0
        public FilterView()
        {
            InitializeComponent();

            //Get a Instance of the Map
            Messenger.Default.Register<CustomMap>(this, mp => {
                MapInstance  = mp;
            MapInstance.ViewChangeOnFrame += new EventHandler<MapEventArgs>(MapInstance_ViewChangeOnFrame);
            });

            //After we done of drawing the areas, clear the drawarea
            Messenger.Default.Register<bool>(this,"draw", bl => {
                ClearDraw();
                ClearFilterChecks();
            });

            //GeoCode is Done, draw and query for areas
            Messenger.Default.Register<Messages.RouteDoneMessage>(this, "RouteDone", msg =>
            {
                DrawRote(msg.Locations, msg.Legs);
            });

                currentUser = (App.Current.Resources["User"] as SiteUser);
                if (currentUser != null)
                {
                    string locationString  ="";
                    if (!string.IsNullOrEmpty(currentUser.City))
                    {
                    locationString += currentUser.City + ", ";
                    }
                    if (!string.IsNullOrEmpty(currentUser.RegionName))
                    {
                        locationString += currentUser.RegionName + ", ";
                    }

                    if (!string.IsNullOrEmpty(currentUser.PostalCode))
                    {
                        locationString += currentUser.PostalCode + ", ";
                    }

                    if (!string.IsNullOrEmpty(currentUser.Country))
                    {
                        locationString += currentUser.Country;
                     //   filter.Text = currentUser.Country;
                    }

                    FromInput.Text = locationString;
                    ToInput.Text = "";
                }
            filtersAccordion.SelectedIndex = 3;
            isLoaded = true;
        }