示例#1
0
 public async void Execute(object parameter)
 {
     // var restModel = parameter as RestCallViewModel;
     var walkiestalkyclient = new WalkieTalkyClient();
     var person             = new PersonRecord
     {
         PersonId = "0de77c08b76406e9eb6703c0663061e9f3445054d17fc1de490ff4b2da0f8ef7"
     };
     var personList = walkiestalkyclient.CreatePutRequest(person.PersonId, person, "");
 }
示例#2
0
        public async void UpdateTopics()
        {
            var location = await CrossGeolocator.Current.GetPositionAsync();

            _currentLatitude  = location.Latitude;
            _currentLongitude = location.Longitude;
            App.MapPageViewModel.TopicsViewModel.Model.Topics =
                new List <string>(
                    App.MapPageViewModel.TopicsViewModel.Topics.Where(e => !string.IsNullOrEmpty(e.TopicName))
                    .Select(e => e.TopicName));
            App.MapPageViewModel.TopicsViewModel.Model.Coordinates = new GeoCoordinates
            {
                Latitude  = _currentLatitude,
                Longitude = _currentLongitude
            };
            WalkieTalkyClient client = new WalkieTalkyClient();
            var token =
                Services.Services.GetInstance().AccountService.GetAccountFor(App.AppName).Properties["access_token"];
            var response = client.CreatePutRequest(App.MapPageViewModel.TopicsViewModel.Model.PersonId,
                                                   App.MapPageViewModel.TopicsViewModel.Model, token);

            foreach (PersonRecord personRecord in response.ClosePersons)
            {
                if (personRecord.Coordinates.Latitude == null || personRecord.Coordinates.Longitude == null)
                {
                    continue;
                }
                var item = new Pin
                {
                    Type     = PinType.Generic,
                    Position = new Position(personRecord.Coordinates.Latitude.Value, personRecord.Coordinates.Longitude.Value),
                    Label    = personRecord.Name,
                    Address  = personRecord.Phonenumber
                };
                TopicsMap.CustomPins.Add(new CustomPin {
                    Pin = item
                });
                TopicsMap.Pins.Add(item);
            }
            if (response.Match != null)
            {
                string matchedTopicName = string.Empty;
                foreach (Topic topic in App.TopicsViewModel.Topics)
                {
                    foreach (string topicName in response.Match.Topics)
                    {
                        if (topicName.ToUpper().Equals(topic.TopicName.ToUpper()))
                        {
                            matchedTopicName = topicName;
                        }
                    }
                }
                await Navigation.PushModalAsync(new MatchPage(response.Match, matchedTopicName));
            }
        }