Exemple #1
0
        private void StoreListView_ItemClick(object sender, ItemClickEventArgs e)
        {
            StoreListing  sent = e.ClickedItem as StoreListing;
            PurchasedView p    = new PurchasedView();

            p.purchases = test;
            p.sel       = sent;
            //sent.Price = 50.ToString();
            Frame.Navigate(typeof(CreateDetail), p);
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            StorageFolder folder     = Windows.Storage.ApplicationData.Current.LocalFolder;
            StorageFile   sampleFile = await folder.GetFileAsync("sample.txt");

            testlol = await Windows.Storage.FileIO.ReadTextAsync(sampleFile);

            LoadingBar.Visibility      = Visibility.Visible;
            LoadingBar.IsIndeterminate = true;

            try
            {
                rec          = e.Parameter as PurchasedView;
                Cover.Source = rec.sel.Image;
                Title.Text   = rec.sel.Title;
                Author.Text  = rec.sel.Author;
                List <string> chaps = new List <string>();
                string[]      lol   = rec.purchases.Split(',');
                for (int i = 0; i < lol.Length; i++)
                {
                    string   test3 = lol[i];
                    string[] test4 = test3.Split('.');
                    if (test4[0] == rec.sel.Id)
                    {
                        if (test4[1] != "full")
                        {
                            chaps.Add(test4[1]);
                        }
                        else
                        {
                            items = await Table.Where(Chapter
                                                      => Chapter.bookid == rec.sel.Id).ToCollectionAsync();

                            foreach (Chapter lol2 in items)
                            {
                                chaps.Add(lol2.Id);
                            }
                        }
                    }
                }

                list = new List <ChapterView>();
                ChapterView temp;
                try
                {
                    items = await Table.Where(Chapter
                                              => chaps.Contains(Chapter.Id)).ToCollectionAsync();


                    foreach (Chapter lol2 in items)
                    {
                        temp       = new ChapterView();
                        temp.Id    = lol2.Id;
                        temp.Title = "Chapter No: " + (lol2.sno + 1).ToString();
                        temp.Price = "Price: " + lol2.price.ToString();
                        list.Add(temp);
                    }
                    LoadingBar.Visibility     = Visibility.Collapsed;
                    StoreListView.ItemsSource = list;
                }
                catch (Exception)
                {
                    LoadingBar.Visibility = Visibility.Collapsed;
                    await(new MessageDialog("Can't get data now please try again later")).ShowAsync();
                }
            }

            catch (Exception)
            {
                LoadingBar.Visibility = Visibility.Collapsed;
                await(new MessageDialog("Can't get data now please try again later")).ShowAsync();
            }
        }