private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            Exception AppException = null;

            LoadingControl.DisplayLoadingError(false);
            LoadingControl.SetLoadingStatus(true);

            try
            {
                supermarkt               = Supermarkt.Deserialize(e.NavigationParameter as string);
                this.DataContext         = supermarkt;
                supermarkt.ProductPagina = await GetSAData.GetDiscountsFromSupermarket(supermarkt, false);

                this.ProductsLV.DataContext = supermarkt.ProductPagina.Producten;
                DiscountVallidTextbox.Text  = supermarkt.ProductPagina.DiscountValid;

                try
                {
                    if (SelectedItem != null)
                    {
                        foreach (Product p in supermarkt.ProductPagina.Producten)
                        {
                            if (p.ID == SelectedItem.ID)
                            {
                                supermarkt.ProductPagina.SelectedItem = p;
                                SelectedItem            = null;
                                ProductsLV.SelectedItem = p;
                                break;
                            }
                        }

                        ProductsLV.ScrollIntoView(supermarkt.ProductPagina.SelectedItem);
                    }
                }
                catch
                {
                }
            }
            catch (Exception ex)
            {
                AppException = ex;
                LoadingControl.DisplayLoadingError(true);
            }
            finally
            {
                Task t = Task.Run(() => ClientIDHandler.instance.PostAppStats(ClientIDHandler.AppName.Supermarkt_Aanbiedingen));
                LoadingControl.SetLoadingStatus(false);
            }

            if (AppException != null)
            {
                Task t = Task.Run(() => ExceptionHandler.instance.PostException(new AppException(AppException), (int)ClientIDHandler.AppName.Supermarkt_Aanbiedingen));
            }
        }
Пример #2
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            Exception AppException = null;

            try
            {
                CountCombovox.ItemsSource  = ItemCount;
                CountCombovox.SelectedItem = (CountCombovox.ItemsSource as string[])[0];

                supermarkt       = Supermarkt.Deserialize(e.NavigationParameter as string);
                this.DataContext = supermarkt;

                //GetBoodschappenlijstje
                IList <BoodschappenLijstje> lijstjes = await BoodschappenLijstje.GetBoodschappenLijstjes();

                foreach (BoodschappenLijstje b in lijstjes)
                {
                    if (b.supermarkt.Name == supermarkt.Name)
                    {
                        foreach (BoodschappenlijstjeItem BItem in b.Producten)
                        {
                            if (BItem.SupermarktItem.Name == supermarkt.ProductPagina.SelectedItem.Name)
                            {
                                DeleteButton.Visibility         = Windows.UI.Xaml.Visibility.Visible;
                                AddButtonText.Text              = "Wijzig";
                                BoodschappenlijstTextblock.Text = "Verander aantal in boodschappenlijst:";
                                CountCombovox.SelectedIndex     = BItem.Count - 1;
                            }
                        }

                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                AppException = ex;
            }

            if (AppException != null)
            {
                Task t = Task.Run(() => ExceptionHandler.instance.PostException(new AppException(AppException), (int)ClientIDHandler.AppName.Supermarkt_Aanbiedingen));
            }
        }