Beispiel #1
0
        private async void page_load(object sender, RoutedEventArgs e)
        {
            tbNama.Text         = "Welcome, " + member.nama;
            tbTimeWorkouts.Text = "Time Workouts : ";

            string responseData = await httpObject.GetRequest("member/getUserFavExercise/" + member.uid);

            ocExercise            = JsonConvert.DeserializeObject <ObservableCollection <Exercises> >(responseData);
            lvProfile.ItemsSource = ocExercise;
        }
Beispiel #2
0
        private async void suggestionChosen(object sender, ItemClickEventArgs e)
        {
            isChosen = true;
            AutocompleteAddress item = (AutocompleteAddress)e.ClickedItem;

            txtAutocompleteAddress.Text = item.description;
            string reqUri       = "https://maps.googleapis.com/maps/api/geocode/json?address=" + item.description + "&key=AIzaSyA9rHJZEGWe6rX4nAHTGXFxCubmw-F0BBw";
            string responseData = await httpObject.GetRequest(reqUri);

            JObject json = JObject.Parse(responseData);

            lat = json["results"][0]["geometry"]["location"]["lat"].ToString().Replace(",", ".");
            lng = json["results"][0]["geometry"]["location"]["lng"].ToString().Replace(",", ".");
            listAutoCompleteAddress.Clear();
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            stackLoading.Visibility = Visibility.Visible;
            stackFilter.Visibility  = Visibility.Collapsed;
            var entry = this.Frame.BackStack.LastOrDefault();

            if (entry.SourcePageType == typeof(AllLostFoundReportPage))
            {
                stackBarang.Visibility       = Visibility.Visible;
                stackJenisLaporan.Visibility = Visibility.Visible;
                stackKejadian.Visibility     = Visibility.Collapsed;
                mode = 0;
            }
            else if (entry.SourcePageType == typeof(AllCrimeReportPage))
            {
                stackKejadian.Visibility     = Visibility.Visible;
                stackBarang.Visibility       = Visibility.Collapsed;
                stackJenisLaporan.Visibility = Visibility.Collapsed;
                mode = 1;
            }
            string responseData = await httpObject.GetRequest("settings/getKecamatan");

            listKecamatan                 = JsonConvert.DeserializeObject <ObservableCollection <Kecamatan> >(responseData);
            cbKecamatan.ItemsSource       = listKecamatan;
            cbKecamatan.DisplayMemberPath = "nama_kecamatan";
            cbKecamatan.SelectedValuePath = "id_kecamatan";
            cbKecamatan.SelectedIndex     = 0;
            stackLoading.Visibility       = Visibility.Collapsed;
            stackFilter.Visibility        = Visibility.Visible;
        }
        private async void page_load(object sender, RoutedEventArgs e)
        {
            string responseData = await httpObject.GetRequest("admin/getAllExercise");

            ocExercise             = JsonConvert.DeserializeObject <ObservableCollection <Exercises> >(responseData);
            lvExercise.ItemsSource = ocExercise;
        }
Beispiel #5
0
        private async void page_load(object sender, RoutedEventArgs e)
        {
            string responseData = await httpObject.GetRequest("member/getAllWorkouts");

            ocWorkouts             = JsonConvert.DeserializeObject <ObservableCollection <Workouts> >(responseData);
            lvExercise.ItemsSource = ocWorkouts;
        }
        public async void PoliceStationPageLoaded(object sender, RoutedEventArgs e)
        {
            session = new Session();
            var location = await Geolocation.GetLastKnownLocationAsync();

            if (location == null)
            {
                location = await Geolocation.GetLocationAsync(new GeolocationRequest
                {
                    DesiredAccuracy = GeolocationAccuracy.Best,
                    Timeout         = TimeSpan.FromSeconds(30)
                });
            }
            string origins      = location.Latitude.ToString().Replace(",", ".") + "," + location.Longitude.ToString().Replace(",", ".");
            string responseData = await httpObject.GetRequestWithAuthorization("settings/getAllKantorPolisi", session.getTokenAuthorization());

            string destinations = "";

            listKantorPolisi = JsonConvert.DeserializeObject <ObservableCollection <KantorPolisi> >(responseData);
            for (int i = 0; i < listKantorPolisi.Count; i++)
            {
                destinations += listKantorPolisi[i].lat_kantor_polisi.Replace(",", ".") + "," + listKantorPolisi[i].lng_kantor_polisi.Replace(",", ".") + "|";
            }
            destinations.Remove(destinations.Length - 1, 1);
            string reqUri = "https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins=" + origins + "&destinations=" + destinations + "&key=AIzaSyA9rHJZEGWe6rX4nAHTGXFxCubmw-F0BBw";

            responseData = await httpObject.GetRequest(reqUri);

            JObject json  = JObject.Parse(responseData);
            var     token = JToken.Parse(responseData)["rows"][0]["elements"].ToList().Count;

            for (int i = 0; i < token; i++)
            {
#if NETFX_CORE
                string distance = json["rows"][0]["elements"][i]["distance"]["text"].ToString().Split(" ")[0].Replace(".", ",");
#elif __ANDROID__
                string distance = json["rows"][0]["elements"][i]["distance"]["text"].ToString().Split(" ")[0];
#endif
                listKantorPolisi[i].distance = Convert.ToDouble(distance);
            }
            listKantorPolisi = new ObservableCollection <KantorPolisi>(listKantorPolisi.OrderBy(k => k.distance));
            gvListKantorPolisi.ItemsSource = listKantorPolisi;
        }
Beispiel #7
0
        public async void cekFav()
        {
            try
            {
                string responseData = await httpObject.GetRequest("member/getFavOrNot/" + member.uid + "/" + selected.uid);

                JObject json = JObject.Parse(responseData);
                if (json["message"].ToString() == "Tidak Ada")
                {
                    btnAdd.Content = "Add To Favourites";
                }
                else
                {
                    btnAdd.Content = "Remove From Favourites";
                }
            }
            catch (Exception x)
            {
                await new MessageDialog(x.Message).ShowAsync();
            }
        }
Beispiel #8
0
        private async Task <string> getUserAddress()
        {
            var location = await Geolocation.GetLastKnownLocationAsync();

            if (location == null)
            {
                location = await Geolocation.GetLocationAsync(new GeolocationRequest
                {
                    DesiredAccuracy = GeolocationAccuracy.Best,
                    Timeout         = TimeSpan.FromSeconds(30)
                });
            }
            string lat          = location.Latitude.ToString().Replace(",", ".");
            string lng          = location.Longitude.ToString().Replace(",", ".");
            string latlng       = lat + "," + lng;
            string reqUri       = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + latlng + "&key=AIzaSyA9rHJZEGWe6rX4nAHTGXFxCubmw-F0BBw";
            string responseData = await httpObject.GetRequest(reqUri);

            JObject json    = JObject.Parse(responseData);
            string  address = json["results"][0]["formatted_address"].ToString();

            return(address);
        }
Beispiel #9
0
    public async Task Compile()
    {
        var request = await HttpHandler.GetRequest();

        return(ReportGenerator.GenerateReport(request));
    }