private void parseJSONParentCategory(String jsonParentCategory)
        {
            try
            {
                var parentCatJSONObj = JsonConvert.DeserializeObject <RootParentCategoryClass>(jsonParentCategory);
                if (parentCatJSONObj.success == true)
                {
                    foreach (var obj in parentCatJSONObj.items)
                    {
                        parentCategoryObj                = new ParentCategoryClass();
                        parentCategoryObj.category_id    = obj.category_id;
                        parentCategoryObj.category_name  = obj.category_name;
                        parentCategoryObj.category_image = obj.category_image;
                        listParentCategory.Add(parentCategoryObj);
                    }

                    this.numberParentCategories = Int16.Parse(parentCatJSONObj.quantity);
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
 private void lstParentCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         ParentCategoryClass parentCategory = (sender as ListBox).SelectedItem as ParentCategoryClass;
         NavigationService.Navigate(new Uri("/List_Child_Category_Level_2.xaml?category_id=" + parentCategory.category_id + "&category_name=" + parentCategory.category_name, UriKind.Relative));
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
        //Phuc vu cho viec Cache Data APIs //
        private void BindingDataParentCategory_FixData(string subFolder, string subFileName)
        {
            try
            {
                IsolatedStorageFile File = IsolatedStorageFile.GetUserStoreForApplication();
                string sFile             = subFolder + "\\" + subFileName;
                bool   fileExist         = File.FileExists(sFile);
                string rawData           = "";
                if (fileExist == true)
                {
                    StreamReader reader = new StreamReader(new IsolatedStorageFileStream(sFile, FileMode.Open, File));
                    rawData = reader.ReadToEnd();
                    reader.Close();
                }

                parseJSONParentCategory(rawData);

                ds.Clear();
                for (int i = 0; i < numberParentCategories; i++)
                {
                    parentCategoryObj = new ParentCategoryClass();
                    parentCategoryObj = listParentCategory[i];
                    //string source_image = imgCache.getImage(parentCategoryObj.category_image);
                    string source_image = "";
                    if (fixCacheImage == true)
                    {
                        source_image = imgCache.getImage_2(parentCategoryObj.category_id);
                    }
                    else //Day la hoan thien nhat tuy nhien can thoi gian de fix data
                    {
                        source_image = imgCache.getImage(parentCategoryObj.category_image);
                    }

                    ds.Add(new ParentCategoryClass()
                    {
                        category_image = source_image, category_name = parentCategoryObj.category_name, category_id = parentCategoryObj.category_id
                    });
                }
                this.lstParentCategory.ItemsSource = ds;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
        void client_1_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            string data = e.Result;

            if (this.responseResult.Equals("") || this.responseResult == null)
            {
                this.responseResult = data;
            }

            /* Ghi du lieu vao File lan dau tien */
            bool result = writeDataToFile(this.responseResult);

            parseJSONParentCategory(this.responseResult);
            ds.Clear();
            for (int i = 0; i < numberParentCategories; i++)
            {
                parentCategoryObj = new ParentCategoryClass();
                parentCategoryObj = listParentCategory[i];
                //string source_image = imgCache.getImage(parentCategoryObj.category_image);
                string source_image = "";
                if (fixCacheImage == true)
                {
                    source_image = imgCache.getImage_2(parentCategoryObj.category_id);
                }
                else //Day la hoan thien nhat tuy nhien can thoi gian de fix data
                {
                    source_image = imgCache.getImage(parentCategoryObj.category_image);
                }

                ds.Add(new ParentCategoryClass()
                {
                    category_image = source_image, category_name = parentCategoryObj.category_name, category_id = parentCategoryObj.category_id
                });
            }
            this.lstParentCategory.ItemsSource = ds;
            disableProgressBar();
        }