예제 #1
0
        protected BaseViewModel(INavService navService)
        {
            NavService = navService;

            TokenService      = DependencyService.Get <ITokenService>();
            GoogleDataService = new GoogleDataService();
        }
예제 #2
0
        public override async Task Init(Person item)
        {
            var token = TokenService.GetToken();
            await GoogleDataService.LoadContactDetails(token, item);

            Person = item;

            // temporary until Google People API is fixed
            Person = new Person
            {
                FirstName = "Daniel",
                LastName  = "Dhillon",
                ImageUrl  = "https://lh5.googleusercontent.com/-kv6ZbOeIPA0/AAAAAAAAAAI/AAAAAAAAAI0/1aoWlBq6pes/photo.jpg",
                Details   = new PersonDetails
                {
                    EmailAddresses = new[] {
                        new EmailAddress
                        {
                            Type  = EmailType.Home,
                            Value = "*****@*****.**"
                        },
                        new EmailAddress
                        {
                            Type  = EmailType.Other,
                            Value = "*****@*****.**"
                        }
                    },
                    PhoneNumbers = new[] {
                        new PhoneNumber
                        {
                            Type          = PhoneType.Mobile,
                            CanonicalForm = "19095551212",
                            Value         = "(909) 555-1212"
                        },
                        new PhoneNumber
                        {
                            Type          = PhoneType.Work,
                            CanonicalForm = "19095551313",
                            Value         = "(909) 555-1313"
                        }
                    },
                    Organization = new Organization
                    {
                        Name  = "Dhillon Zone",
                        Title = "Software Developer"
                    }
                }
            };
        }
        async Task LoadContacts()
        {
            if (IsProcessBusy)
            {
                return;
            }

            IsProcessBusy = true;

            try
            {
                var token = TokenService.GetToken();
                Contacts = new ObservableCollection <Person>(await GoogleDataService.GetContacts(token));
            }
            finally
            {
                IsProcessBusy = false;
            }
        }
예제 #4
0
        protected async Task HandleValidSubmit()
        {
            this.City.Location = Location;

            Map_AddCity map_AddCity = new Map_AddCity();

            if (this.City.NeedsMuseum)
            {
                map_AddCity.MuseumSearches = (await GoogleDataService.TextSearch(MuseumType + "Museum", this.City.Location)).results;
            }
            if (this.City.NeedsRestaurant)
            {
                map_AddCity.RestaurantSearches = (await GoogleDataService.TextSearch(RestaurantType + "Restaurant", this.City.Location)).results;
            }

            map_AddCity.City = this.City;

            await CloseEventCallBack.InvokeAsync(map_AddCity);//we can send even the save employee here

            ShowDialog = false;
            _autocompleteInitialized = false;
            StateHasChanged();
        }