Пример #1
0
        protected override void OnStart()
        {
            var account = Services.Services.GetInstance().AccountService.GetAccountFor(AppName);

            if (account != null)
            {
                var httpClient = new WalkieTalkyClient();
                var model      = httpClient.CreateGetRequest(account.Properties["access_token"]);
                var request    = new OAuth2Request("GET", new Uri("https://graph.facebook.com/me"), null, account);
                request.GetResponseAsync().ContinueWith(t =>
                {
                    if (t.IsFaulted)
                    {
                    }

                    else
                    {
                        string json = t.Result.GetResponseText();
                        var x       = new JSONObject(json);
                        //  StartNavigationService(model);
                    }
                });

                StartNavigationService(model);
            }
        }
Пример #2
0
 public async void Execute(object parameter)
 {
     //var restModel = parameter as RestCallViewModel;
     var    walkiestalkyclient = new WalkieTalkyClient();
     string fakeToken          = "iulian";
     var    personRecord       = walkiestalkyclient.CreateGetRequest(fakeToken);
 }
Пример #3
0
        private void OnLogin(object sender, OnLoginEventArgs args)
        {
            if (args.Account == null)
            {
                return;
            }
            if (args.StayLoggedIn)
            {
                Services.Services.GetInstance().AccountService.SaveAccount(args.Account, AppName);
            }
            HttpService.SendAuthenticationCredentials(args.Account);
            var httpClient = new WalkieTalkyClient();
            var model      = httpClient.CreateGetRequest(args.Account.Properties["access_token"]);
            var request    = new OAuth2Request("GET", new Uri("https://graph.facebook.com/me"), null, args.Account);

            request.GetResponseAsync().ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                }

                else
                {
                    string json = t.Result.GetResponseText();
                    var x       = new JSONObject(json);
                    // StartNavigationService(model);
                }
            });

            StartNavigationService(model);
        }
Пример #4
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, "");
 }
Пример #5
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));
            }
        }