示例#1
0
        private async void PopularSupermarketsLV_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                LoadingControl.SetLoadingStatus(true);
                LoadingControl.DisplayLoadingError(false);

                List <Supermarkt> supermarkten = (List <Supermarkt>) await GetSAData.GetSelectedSuperMarkets();

                if (supermarkten.Count > 0)
                {
                    if (supermarkten.First().ID == 0)
                    {
                        Frame.Navigate(typeof(ConfigureSupermarkets));
                    }
                }

                (sender as ListView).ItemsSource = supermarkten;

                Content.Visibility = Visibility.Visible;
            }
            catch (Exception)
            {
                LoadingControl.DisplayLoadingError(true);
            }
            finally
            {
                LoadingControl.SetLoadingStatus(false);
            }
        }
示例#2
0
        public async Task LoadData()
        {
            SpreekwoordInstance = await SpreekwoordenWrapper.GetInstance();

            MyItemsPivotItem = MyItems;

            if (SpreekwoordInstance.MyItems.Count == 0)
            {
                SpreekwoordenPivot.Items.Remove(MyItems);
            }

            this.DataContext = SpreekwoordInstance;
            LoadingControl.SetLoadingStatus(false);

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

            await SpreekwoordInstance.GetRandomWoorden();

            LoadingControl.SetLoadingStatus(false);

            if (SpreekwoordInstance.ChangeLockscreen)
            {
                //NotificationHandler.Run("SpreekwoordenBackgroundTaskW.BackgroundTask", "ImageService", (uint)SpreekwoordInstance.IntervalArray[SpreekwoordInstance.SelectedInterval]);
            }

            int ID = await Task.Run(() => Datahandler.GetRandomSpreekwoordAndSaveImageToFile());

            //await LockScreen.SetImageFileAsync(await ApplicationData.Current.LocalFolder.GetFileAsync("Tegeltje" + ID + ".jpg"));
        }
示例#3
0
        private async void RandomSpreekwoordenButton_Click(object sender, RoutedEventArgs e)
        {
            LoadingControl.DisplayLoadingError(false);
            LoadingControl.SetLoadingStatus(true);

            await SpreekwoordInstance.GetRandomWoorden();

            LoadingControl.SetLoadingStatus(false);
        }
        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));
            }
        }
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            try
            {
                await StatusBar.GetForCurrentView().HideAsync();

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

                Supermarkets = (List <Supermarkt>) await GetSAData.GetAllSupermarkets();

                IList <Supermarkt> AanwezigeSupermarkten = null;

                try
                {
                    AanwezigeSupermarkten = await GetSAData.GetSelectedSuperMarkets();
                }
                catch
                {
                }

                if (AanwezigeSupermarkten != null && Supermarkets != null)
                {
                    NextButton.IsEnabled = true;

                    foreach (Supermarkt SA in Supermarkets)
                    {
                        foreach (Supermarkt SB in AanwezigeSupermarkten)
                        {
                            if (SB.Name == SA.Name)
                            {
                                SA.SupermarketEnabled = true;
                            }
                        }
                    }
                }
                else if (Supermarkets == null)
                {
                    throw new NullReferenceException();
                }

                SupermarktetsListview.ItemsSource = Supermarkets;
                ContentGrid.Visibility            = Visibility.Visible;
                LoadingControl.SetLoadingStatus(false);
            }
            catch
            {
                LoadingControl.SetLoadingStatus(false);
                LoadingControl.DisplayLoadingError(true);
            }
        }
示例#6
0
        private async void ReloadButton_Click(object sender, RoutedEventArgs e)
        {
            if (SpreekwoordenPivot.SelectedItem != SeachPivot)
            {
                SpreekwoordenPivot.SelectedItem = SeachPivot;
            }

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

            await SpreekwoordInstance.GetRandomWoorden();

            LoadingControl.SetLoadingStatus(false);
        }
示例#7
0
        public async Task Search()
        {
            LoadingControl.DisplayLoadingError(false);
            LoadingControl.SetLoadingStatus(true);

            await SpreekwoordInstance.Search(SearchTextbox.Text);

            if (!SpreekwoordInstance.Searching)
            {
                if (SpreekwoordInstance.SearchResult.Count == 0)
                {
                    LoadingControl.DisplayLoadingError(true);
                }

                LoadingControl.SetLoadingStatus(false);
            }
        }
示例#8
0
        private async void Search()
        {
            LoadingControl.DisplayLoadingError(false);
            LoadingControl.SetLoadingStatus(true);

            try
            {
                SearchTextbox.IsEnabled = false;
                SearchButton.IsEnabled  = false;

                IList <Supermarkt> supermarkten = await GetSAData.GetSelectedSuperMarkets();

                foreach (Supermarkt s in supermarkten)
                {
                    if (s.ProductPagina == null)
                    {
                        s.ProductPagina = await GetSAData.GetDiscountsFromSupermarket(s, false);
                    }
                }

                searchresult = SearchHandler.SearchForProductenInDiscounts(supermarkten, SearchTextbox.Text);


                if (searchresult.Count > 0)
                {
                    NoResultsGrid.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                }
                else
                {
                    NoResultsGrid.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }

                this.DataContext = searchresult;
            }
            catch
            {
                NoResultsGrid.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }

            LoadingControl.SetLoadingStatus(false);

            SearchTextbox.IsEnabled = true;
            SearchButton.IsEnabled  = true;
            SearchButton.Focus(Windows.UI.Xaml.FocusState.Pointer);
        }