Ejemplo n.º 1
0
        //Update Api Start
        async Task LoadItems()
        {
            try
            {
                //Clear all items and reset load count
                await ClearObservableCollection(List_StarredItems);

                //Update the loading information
                txt_AppInfo.Text              = "Loading items";
                txt_NewsScrollInfo.Text       = "Your starred items will be shown here shortly...";
                txt_NewsScrollInfo.Visibility = Visibility.Visible;

                //Load items from api/database
                AppVariables.LoadNews    = false;
                AppVariables.LoadStarred = true;
                AppVariables.LoadSearch  = false;
                AppVariables.LoadFeeds   = true;
                Int32 Result = await ApiUpdate.PageApiUpdate();

                //Check the api update result
                if (Result == 2)
                {
                    await CleanupPageResources();

                    App.vApplicationFrame.Navigate(typeof(SettingsPage));
                    App.vApplicationFrame.BackStack.Clear();
                    return;
                }

                //Wait for busy database
                await ApiUpdate.WaitForBusyDatabase();

                //Set all items to list
                List <TableItems> LoadTableItems = await SQLConnection.Table <TableItems>().ToListAsync();

                //Load items into the list
                await ProcessItemLoad.DatabaseToList(null, LoadTableItems, AppVariables.CurrentItemsLoaded, AppVariables.ItemsToScrollLoad, false, false);

                //Update the total items count
                await UpdateTotalItemsCount(null, LoadTableItems, false, true);
            }
            catch { }
        }
Ejemplo n.º 2
0
        //Check if new items need to be loaded
        public static async Task ScrollViewerAddItems(ListView TargetListView, Int32 CurrentOffsetId)
        {
            try
            {
                if (!(bool)AppVariables.ApplicationSettings["LoadAllItems"])
                {
                    Int32 LoadedListCount = TargetListView.Items.Count();
                    if (!AppVariables.BusyApplication && (LoadedListCount - CurrentOffsetId) < AppVariables.ItemsToScrollLoad && LoadedListCount < AppVariables.CurrentTotalItemsCount)
                    {
                        AppVariables.BusyApplication = true;

                        //Debug.WriteLine("ItemsLoaded" + AppVariables.CurrentItemsLoaded + "/" + AppVariables.TotalItemsCount);
                        //Debug.WriteLine("Time to load new items because there are only " + AppVariables.ItemsToScrollLoad + " left.");
                        await ProcessItemLoad.DatabaseToList(null, null, LoadedListCount, AppVariables.ItemsToScrollLoad, true, false);

                        AppVariables.BusyApplication = false;
                    }
                }
            }
            catch { AppVariables.BusyApplication = false; }
        }
Ejemplo n.º 3
0
        //Load feeds from Api
        async Task LoadFeeds()
        {
            try
            {
                //Clear all items
                await ClearObservableCollection(List_Feeds);

                //Update the loading information
                txt_AppInfo.Text              = "Loading feeds";
                txt_NewsScrollInfo.Text       = "Your feeds will be shown here shortly...";
                txt_NewsScrollInfo.Visibility = Visibility.Visible;

                //Load feeds from api/database
                AppVariables.LoadNews    = false;
                AppVariables.LoadStarred = false;
                AppVariables.LoadSearch  = false;
                AppVariables.LoadFeeds   = true;
                int Result = await ApiUpdate.PageApiUpdate();

                //Check the api update result
                if (Result == 2)
                {
                    await CleanupPageResources();

                    App.vApplicationFrame.Navigate(typeof(SettingsPage));
                    //FixApp.vApplicationFrame.BackStack.Clear();
                    return;
                }

                //Set all items to list
                List <TableFeeds> LoadTableFeeds = await SQLConnection.Table <TableFeeds>().OrderBy(x => x.feed_folder).ToListAsync();

                //Load items into the list
                await ProcessItemLoad.DatabaseToList(LoadTableFeeds, null, AppVariables.CurrentItemsLoaded, AppVariables.ItemsToScrollLoad, false, false);

                //Update the total items count
                await UpdateTotalItemsCount(LoadTableFeeds, null, false, true);
            }
            catch { }
        }
Ejemplo n.º 4
0
        //Update Api Start
        async Task LoadItems()
        {
            try
            {
                //Clear all items and reset load count
                await ClearObservableCollection(List_StarredItems);

                //Update the loading information
                txt_AppInfo.Text             = "Loading items";
                txt_NewsScrollInfo.Text      = "Your starred items will be shown here shortly...";
                txt_NewsScrollInfo.IsVisible = true;

                //Load items from api/database
                AppVariables.LoadNews    = false;
                AppVariables.LoadStarred = true;
                AppVariables.LoadSearch  = false;
                AppVariables.LoadFeeds   = true;
                int Result = await ApiUpdate.PageApiUpdate();

                //Check the api update result
                if (Result == 2)
                {
                    await CleanupPageResources();

                    App.NavigateToPage(new SettingsPage(), true, false);
                    return;
                }

                //Set all items to list
                List <TableItems> LoadTableItems = await vSQLConnection.Table <TableItems>().ToListAsync();

                //Load items into the list
                await ProcessItemLoad.DatabaseToList(null, LoadTableItems, AppVariables.CurrentItemsLoaded, AppVariables.ItemsToLoadMax, false, false);

                //Update the total items count
                await UpdateTotalItemsCount(null, LoadTableItems, false, true);
            }
            catch { }
        }
Ejemplo n.º 5
0
        //Update Api Start
        async Task LoadItems(bool LoadSelectFeeds, bool UpdateSelectFeeds)
        {
            try
            {
                //Clear all items and reset load count
                await ClearObservableCollection(List_NewsItems);

                //Get the currently selected feed
                string SelectedFeedTitle = "All items";
                if (!(bool)AppVariables.ApplicationSettings["DisplayReadMarkedItems"])
                {
                    SelectedFeedTitle = "Unread items";
                }
                if (vCurrentLoadingFeedFolder != null)
                {
                    if (vCurrentLoadingFeedFolder.feed_title != null)
                    {
                        SelectedFeedTitle = vCurrentLoadingFeedFolder.feed_title;
                    }
                    if (vCurrentLoadingFeedFolder.feed_folder_title != null)
                    {
                        SelectedFeedTitle = vCurrentLoadingFeedFolder.feed_folder_title;
                    }
                }

                //Update the loading information
                txt_AppInfo.Text = "Loading items";
                txt_NewsScrollInfo.Inlines.Clear();
                txt_NewsScrollInfo.Inlines.Add(new Run()
                {
                    Text = "Your news items from "
                });
                txt_NewsScrollInfo.Inlines.Add(new Run()
                {
                    Text = SelectedFeedTitle, Foreground = new SolidColorBrush((Color)Application.Current.Resources["ApplicationAccentLightColor"])
                });
                txt_NewsScrollInfo.Inlines.Add(new Run()
                {
                    Text = " will be shown here shortly..."
                });
                txt_NewsScrollInfo.Visibility = Visibility.Visible;

                //Check the loading feed
                if (LoadSelectFeeds)
                {
                    if ((bool)AppVariables.ApplicationSettings["DisplayReadMarkedItems"])
                    {
                        Feeds TempFeed = new Feeds();
                        TempFeed.feed_id          = "0";
                        vCurrentLoadingFeedFolder = TempFeed;
                        vPreviousScrollItem       = 0;
                    }
                    else
                    {
                        Feeds TempFeed = new Feeds();
                        TempFeed.feed_id          = "2";
                        vCurrentLoadingFeedFolder = TempFeed;
                        vPreviousScrollItem       = 0;
                    }
                }

                //Load items from api/database
                AppVariables.LoadNews    = true;
                AppVariables.LoadStarred = false;
                AppVariables.LoadSearch  = false;
                AppVariables.LoadFeeds   = true;
                int Result = await ApiUpdate.PageApiUpdate();

                //Check the api update result
                if (Result == 2)
                {
                    await CleanupPageResources();

                    App.vApplicationFrame.Navigate(typeof(SettingsPage));
                    //FixApp.vApplicationFrame.BackStack.Clear();
                    return;
                }

                //Set all items to list
                List <TableFeeds> LoadTableFeeds = await SQLConnection.Table <TableFeeds>().OrderBy(x => x.feed_folder).ToListAsync();

                List <TableItems> LoadTableItems = await SQLConnection.Table <TableItems>().ToListAsync();

                //Load items into the list
                await ProcessItemLoad.DatabaseToList(LoadTableFeeds, LoadTableItems, AppVariables.CurrentItemsLoaded, AppVariables.ItemsToScrollLoad, false, false);

                //Load feeds into selector
                if (LoadSelectFeeds)
                {
                    await LoadSelectionFeeds(LoadTableFeeds, LoadTableItems, false, true);
                }

                //Update feeds in selector
                if (UpdateSelectFeeds)
                {
                    await UpdateSelectionFeeds(LoadTableFeeds, LoadTableItems, false, true);
                }

                //Change the selection feed
                ChangeSelectionFeed(vCurrentLoadingFeedFolder, false);

                //Update the total item count
                UpdateTotalItemsCount();

                //Enable the interface manually
                if (!LoadSelectFeeds && !UpdateSelectFeeds)
                {
                    await ProgressEnableUI();
                }
            }
            catch { }
        }
Ejemplo n.º 6
0
        //Search items from database
        async Task LoadItems()
        {
            try
            {
                //Clear all items and reset load count
                await ClearObservableCollection(List_SearchItems);

                //Get the currently selected feed
                vSearchFeed = combobox_FeedSelection.SelectedItem as Feeds;
                if (vSearchFeed.feed_title != null)
                {
                    vSearchFeedTitle = vSearchFeed.feed_title;
                }
                if (vSearchFeed.feed_folder_title != null)
                {
                    vSearchFeedTitle = vSearchFeed.feed_folder_title;
                }

                //Update the items count placer
                txt_AppInfo.Text = "Searching items";
                txt_NewsScrollInfo.Inlines.Clear();
                txt_NewsScrollInfo.Inlines.Add(new Run()
                {
                    Text = "Your search results for "
                });
                txt_NewsScrollInfo.Inlines.Add(new Run()
                {
                    Text = vSearchTerm, Foreground = new SolidColorBrush((Color)Application.Current.Resources["SystemAccentColor"])
                });
                txt_NewsScrollInfo.Inlines.Add(new Run()
                {
                    Text = " in "
                });
                txt_NewsScrollInfo.Inlines.Add(new Run()
                {
                    Text = vSearchFeedTitle, Foreground = new SolidColorBrush((Color)Application.Current.Resources["SystemAccentColor"])
                });
                txt_NewsScrollInfo.Inlines.Add(new Run()
                {
                    Text = " will be shown here shortly..."
                });
                txt_NewsScrollInfo.Visibility = Visibility.Visible;

                await EventProgressDisableUI("Searching for: " + vSearchTerm, true);

                Debug.WriteLine("Searching for: " + vSearchTerm);

                //Add search history to database
                await AddSearchHistory(vSearchTerm);

                //Load items from api/database
                AppVariables.LoadNews    = false;
                AppVariables.LoadStarred = false;
                AppVariables.LoadSearch  = true;
                AppVariables.LoadFeeds   = false;
                Int32 Result = await ApiUpdate.PageApiUpdate();

                //Check the api update result
                if (Result == 2)
                {
                    await CleanupPageResources();

                    App.vApplicationFrame.Navigate(typeof(SettingsPage));
                    App.vApplicationFrame.BackStack.Clear();
                    return;
                }

                //Wait for busy database
                await ApiUpdate.WaitForBusyDatabase();

                //Set all items to list
                List <TableItems> LoadTableItems = await SQLConnection.Table <TableItems>().ToListAsync();

                //Load items into the list
                await ProcessItemLoad.DatabaseToList(null, LoadTableItems, AppVariables.CurrentItemsLoaded, AppVariables.ItemsToScrollLoad, false, false);

                //Update the total items count
                await UpdateTotalItemsCount(null, LoadTableItems, false, true);
            }
            catch { }
        }
Ejemplo n.º 7
0
        //Search items from database
        async Task LoadItems()
        {
            try
            {
                //Clear all items and reset load count
                await ClearObservableCollection(List_SearchItems);

                //Get the currently selected feed
                vSearchFeed = combobox_FeedSelection.SelectedItem as Feeds;
                if (vSearchFeed.feed_title != null)
                {
                    vSearchFeedTitle = vSearchFeed.feed_title;
                }
                if (vSearchFeed.feed_folder_title != null)
                {
                    vSearchFeedTitle = vSearchFeed.feed_folder_title;
                }

                //Update the items count placer
                txt_AppInfo.Text = "Searching items";

                Span text1 = new Span {
                    Text = "Your search results for "
                };
                Span text2 = new Span {
                    Text = vSearchTerm
                };
                text2.SetDynamicResource(Span.TextColorProperty, "ApplicationAccentLightColor");
                Span text3 = new Span {
                    Text = " in "
                };
                Span text4 = new Span {
                    Text = vSearchFeedTitle
                };
                text4.SetDynamicResource(Span.TextColorProperty, "ApplicationAccentLightColor");
                Span text5 = new Span {
                    Text = " will be shown here shortly..."
                };

                FormattedString formattedString = new FormattedString();
                formattedString.Spans.Add(text1);
                formattedString.Spans.Add(text2);
                formattedString.Spans.Add(text3);
                formattedString.Spans.Add(text4);
                formattedString.Spans.Add(text5);
                txt_NewsScrollInfo.FormattedText = formattedString;
                txt_NewsScrollInfo.IsVisible     = true;

                EventProgressDisableUI("Searching for: " + vSearchTerm, true);
                Debug.WriteLine("Searching for: " + vSearchTerm);

                //Add search history to database
                await AddSearchHistory(vSearchTerm);

                //Load items from api/database
                AppVariables.LoadNews    = false;
                AppVariables.LoadStarred = false;
                AppVariables.LoadSearch  = true;
                AppVariables.LoadFeeds   = false;
                int Result = await ApiUpdate.PageApiUpdate();

                //Check the api update result
                if (Result == 2)
                {
                    await CleanupPageResources();

                    App.NavigateToPage(new SettingsPage(), true, false);
                    return;
                }

                //Set all items to list
                List <TableItems> LoadTableItems = await vSQLConnection.Table <TableItems>().ToListAsync();

                //Load items into the list
                await ProcessItemLoad.DatabaseToList(null, LoadTableItems, AppVariables.CurrentItemsLoaded, AppVariables.ItemsToLoadMax, false, false);

                //Update the total items count
                await UpdateTotalItemsCount(null, LoadTableItems, false, true);
            }
            catch { }
        }
Ejemplo n.º 8
0
        //Update Api Start
        async Task LoadItems(bool LoadSelectFeeds, bool UpdateSelectFeeds)
        {
            try
            {
                //Clear all items and reset load count
                await ClearObservableCollection(List_NewsItems);

                //Get the currently selected feed
                string SelectedFeedTitle = "All news items";
                if (!(bool)AppSettingLoad("DisplayReadMarkedItems"))
                {
                    SelectedFeedTitle = "Unread news items";
                }
                if (vNewsFeed != null)
                {
                    if (vNewsFeed.feed_title != null)
                    {
                        SelectedFeedTitle = vNewsFeed.feed_title;
                    }
                    if (vNewsFeed.feed_folder_title != null)
                    {
                        SelectedFeedTitle = vNewsFeed.feed_folder_title;
                    }
                }

                //Update the loading information
                txt_AppInfo.Text = "Loading items";

                Span text1 = new Span {
                    Text = "Your news items from "
                };
                Span text2 = new Span {
                    Text = SelectedFeedTitle
                };
                text2.SetDynamicResource(Span.TextColorProperty, "ApplicationAccentLightColor");
                Span text3 = new Span {
                    Text = " will be shown here shortly..."
                };

                FormattedString formattedString = new FormattedString();
                formattedString.Spans.Add(text1);
                formattedString.Spans.Add(text2);
                formattedString.Spans.Add(text3);
                txt_NewsScrollInfo.FormattedText = formattedString;
                txt_NewsScrollInfo.IsVisible     = true;

                //Check the loading feed
                if (LoadSelectFeeds)
                {
                    if ((bool)AppSettingLoad("DisplayReadMarkedItems"))
                    {
                        Feeds TempFeed = new Feeds();
                        TempFeed.feed_id    = "0";
                        vNewsFeed           = TempFeed;
                        vPreviousScrollItem = 0;
                    }
                    else
                    {
                        Feeds TempFeed = new Feeds();
                        TempFeed.feed_id    = "2";
                        vNewsFeed           = TempFeed;
                        vPreviousScrollItem = 0;
                    }
                }

                //Load items from api/database
                AppVariables.LoadNews    = true;
                AppVariables.LoadStarred = false;
                AppVariables.LoadSearch  = false;
                AppVariables.LoadFeeds   = true;
                int Result = await ApiUpdate.PageApiUpdate();

                //Check the api update result
                if (Result == 2)
                {
                    await CleanupPageResources();

                    App.NavigateToPage(new SettingsPage(), true, false);
                    return;
                }

                //Set all items to list
                List <TableFeeds> LoadTableFeeds = await vSQLConnection.Table <TableFeeds>().OrderBy(x => x.feed_folder).ToListAsync();

                List <TableItems> LoadTableItems = await vSQLConnection.Table <TableItems>().ToListAsync();

                //Load items into the list
                await ProcessItemLoad.DatabaseToList(LoadTableFeeds, LoadTableItems, AppVariables.CurrentItemsLoaded, AppVariables.ItemsToLoadMax, false, false);

                //Load feeds into selector
                if (LoadSelectFeeds)
                {
                    await LoadSelectionFeeds(LoadTableFeeds, LoadTableItems, false, true);
                }

                //Update feeds in selector
                if (UpdateSelectFeeds)
                {
                    await UpdateSelectionFeeds(LoadTableFeeds, LoadTableItems, false, true);
                }

                //Change the selection feed
                ChangeSelectionFeed(vNewsFeed, false);

                //Update the total item count
                UpdateTotalItemsCount();

                //Enable the interface manually
                if (!LoadSelectFeeds && !UpdateSelectFeeds)
                {
                    ProgressEnableUI();
                }
            }
            catch { }
        }