Example #1
0
        public async void GetSimilerJSON()
        {
            var itemsr   = string.Empty;
            var client   = RestService.HttpClient;
            var response = await client.GetAsync(RestService.ipupdate + "GetSimmiler.php");

            ContectList ObjItemList = new ContectList();

            if (response.IsSuccessStatusCode)
            {
                string NoteInfoList = response.Content.ReadAsStringAsync().Result;
                ObjItemList = JsonConvert.DeserializeObject <ContectList>(NoteInfoList);
                // listviewNotes.ItemsSource = ObjItemList.NoteInfo;
                foreach (Contactone t in ObjItemList.contacts)
                {
                    // FlagNu = t.Name;
                    // List<Contactone> itemsr = new List<Contactone>(ObjItemList.contacts);
                    itemsr = t.Name;
                    // titlesimi.Text = t.Name;
                }
                //var FlagNuf = new List<JsonItemnoteClass>();
            }
            List <Contactone> similerDeatils = new List <Contactone>(ObjItemList.contacts);


            ObservableCollection <Contactone> imageCollection = new ObservableCollection <Contactone>(ObjItemList.contacts);

            MainCarouselView.ItemsSource = similerDeatils;
            Device.StartTimer(TimeSpan.FromSeconds(3), (Func <bool>)(() =>
            {
                MainCarouselView.Position = (MainCarouselView.Position + 1) % similerDeatils.Count;

                return(true);
            }));
        }
        public async void GetJSON()
        {
            var client   = RestService.HttpClient;
            var postData = new List <KeyValuePair <string, string> >();

            postData.Add(new KeyValuePair <string, string>("ItemName", SerchItem));
            //  postData.Add(new KeyValuePair<string, string>("Flag", flag));

            var content  = new FormUrlEncodedContent(postData);
            var response = await client.PostAsync(RestService.ipupdate + "SerchItem.php", content);

            string      contactsJson   = response.Content.ReadAsStringAsync().Result;
            ContectList ObjContactList = new ContectList();

            Layout.Children.Add(load1);

            if (response.IsSuccessStatusCode)
            {
                ObjContactList = JsonConvert.DeserializeObject <ContectList>(contactsJson);
                //Layout.Children.Add(load1);
                ItemsListView.ItemsSource = ObjContactList.contacts;
                //load1.IsRunning = false;
                Layout.Children.Remove(load1);
                ItemsListView.Opacity = 1.0;
                noresult = null;
            }
            else
            {
                noresult = "yes";
            }
        }