async void iconApi_Tap(object sender, EventArgs e) { try { //Check username and password if (!string.IsNullOrWhiteSpace(AppSettingLoad("ApiAccount").ToString()) && !string.IsNullOrWhiteSpace(AppSettingLoad("ApiPassword").ToString())) { HideShowMenu(true); //Check if account has changed await CheckAccountChange(); //Wait for busy application await ApiUpdate.WaitForBusyApplication(); App.NavigateToPage(new ApiPage(), true, false); return; } else { HideShowMenu(true); await NoAccountPrompt(); } } catch { } }
async void iconApi_Tap(object sender, RoutedEventArgs e) { try { //Check username and password if (!String.IsNullOrWhiteSpace(AppVariables.ApplicationSettings["ApiAccount"].ToString()) && !String.IsNullOrWhiteSpace(AppVariables.ApplicationSettings["ApiPassword"].ToString())) { HideShowMenu(true); //Check if account has changed await CheckAccountChange(); //Wait for busy application await ApiUpdate.WaitForBusyApplication(); App.vApplicationFrame.Navigate(typeof(ApiPage)); App.vApplicationFrame.BackStack.Clear(); return; } else { HideShowMenu(true); await NoAccountPrompt(); } } catch { } }
//Ignore feeds in database async void btn_IgnoreFeeds_Click(object sender, RoutedEventArgs e) { try { //Check for selected items if (ListView_Items.SelectedItems.Count == 0) { await AVMessageBox.Popup("No feeds selected", "Please select some feeds that you want to un/ignore first.", "Ok", "", "", "", "", false); return; } else { try { //Wait for busy application await ApiUpdate.WaitForBusyApplication(); await ProgressDisableUI("Un/ignoring selected feeds...", true); //Wait for busy database await ApiUpdate.WaitForBusyDatabase(); List <TableFeeds> TableEditFeeds = await SQLConnection.Table <TableFeeds>().ToListAsync(); foreach (Feeds SelectedItem in ListView_Items.SelectedItems) { TableFeeds TableResult = TableEditFeeds.Where(x => x.feed_id == SelectedItem.feed_id).FirstOrDefault(); if (SelectedItem.feed_ignore_status == Visibility.Visible) { TableResult.feed_ignore_status = false; SelectedItem.feed_ignore_status = Visibility.Collapsed; } else { TableResult.feed_ignore_status = true; SelectedItem.feed_ignore_status = Visibility.Visible; } } //Update the items in database await SQLConnection.UpdateAllAsync(TableEditFeeds); //Reset the list selection ListView_Items.SelectedIndex = -1; await AVMessageBox.Popup("Feeds have been un/ignored", "Their items will be hidden or shown again on the next news item refresh.", "Ok", "", "", "", "", false); } catch { await AVMessageBox.Popup("Failed to un/ignore feeds", "Please try to un/ignored the feeds again.", "Ok", "", "", "", "", false); } await ProgressEnableUI(); } } catch { } }
async void iconHelp_Tap(object sender, EventArgs e) { try { HideShowMenu(true); //Wait for busy application await ApiUpdate.WaitForBusyApplication(); App.NavigateToPage(new HelpPage(), true, false); } catch { } }
//Delete feeds from The Old Reader/Database async void btn_DeleteFeeds_Click(object sender, RoutedEventArgs e) { try { //Check for internet connection if (!NetworkInterface.GetIsNetworkAvailable()) { await AVMessageBox.Popup("No internet connection", "Deleting a feed can only be done when there is an internet connection available.", "Ok", "", "", "", "", false); return; } //Check for selected items if (ListView_Items.SelectedItems.Count == 0) { await AVMessageBox.Popup("No feeds selected", "Please select some feeds that you want to delete first.", "Ok", "", "", "", "", false); return; } else { //Wait for busy application await ApiUpdate.WaitForBusyApplication(); await ProgressDisableUI("Deleting the selected feeds...", true); try { foreach (Feeds SelectedItem in ListView_Items.SelectedItems) { await DeleteFeed(SelectedItem.feed_id); } await AVMessageBox.Popup("Feeds have been deleted", "The feeds and it's items will disappear on the next refresh.", "Ok", "", "", "", "", false); } catch { await AVMessageBox.Popup("Failed to delete feeds", "Please check your account settings, internet connection and try again.", "Ok", "", "", "", "", false); } //Reset the online status OnlineUpdateFeeds = true; ApiMessageError = String.Empty; //Load all the feeds await LoadFeeds(); await ProgressEnableUI(); } } catch { } }
async void iconHelp_Tap(object sender, RoutedEventArgs e) { try { HideShowMenu(true); //Wait for busy application await ApiUpdate.WaitForBusyApplication(); App.vApplicationFrame.Navigate(typeof(HelpPage)); App.vApplicationFrame.BackStack.Clear(); } catch { } }
async void iconSettings_Tap(object sender, EventArgs e) { try { HideShowMenu(true); //Wait for busy application await ApiUpdate.WaitForBusyApplication(); await CleanupPageResources(); App.NavigateToPage(new SettingsPage(), true, false); } catch { } }
async void iconSettings_Tap(object sender, RoutedEventArgs e) { try { HideShowMenu(true); //Wait for busy application await ApiUpdate.WaitForBusyApplication(); await CleanupPageResources(); App.vApplicationFrame.Navigate(typeof(SettingsPage)); //FixApp.vApplicationFrame.BackStack.Clear(); } catch { } }
//Delete feeds from The Old Reader/Database async void btn_DeleteFeeds_Click(object sender, EventArgs e) { try { //Check for internet connection if (Connectivity.NetworkAccess != NetworkAccess.Internet) { List <string> messageAnswers = new List <string>(); messageAnswers.Add("Ok"); await MessagePopup.Popup("No internet connection", "Deleting a feed can only be done when there is an internet connection available.", messageAnswers); return; } //Check for selected items if (listview_Items.SelectedItem == null) { List <string> messageAnswers = new List <string>(); messageAnswers.Add("Ok"); await MessagePopup.Popup("No feeds selected", "Please select some feeds that you want to delete first.", messageAnswers); return; } else { //Wait for busy application await ApiUpdate.WaitForBusyApplication(); ProgressDisableUI("Deleting the selected feeds...", true); try { Feeds SelectedItem = (Feeds)listview_Items.SelectedItem; await DeleteFeed(SelectedItem.feed_id); List <string> messageAnswers = new List <string>(); messageAnswers.Add("Ok"); await MessagePopup.Popup("Feeds have been deleted", "The feeds and it's items will disappear on the next refresh.", messageAnswers); } catch { List <string> messageAnswers = new List <string>(); messageAnswers.Add("Ok"); await MessagePopup.Popup("Failed to delete feeds", "Please check your account settings, internet connection and try again.", messageAnswers); } //Reset the online status OnlineUpdateFeeds = true; ApiMessageError = string.Empty; //Load all the feeds await LoadFeeds(); ProgressEnableUI(); } } catch { } }
//Ignore feeds in database async void btn_IgnoreFeeds_Click(object sender, EventArgs e) { try { //Check for selected items if (listview_Items.SelectedItem == null) { List <string> messageAnswers = new List <string>(); messageAnswers.Add("Ok"); await MessagePopup.Popup("No feeds selected", "Please select some feeds that you want to un/ignore first.", messageAnswers); return; } else { try { //Wait for busy application await ApiUpdate.WaitForBusyApplication(); ProgressDisableUI("Un/ignoring selected feeds...", true); List <TableFeeds> TableEditFeeds = await vSQLConnection.Table <TableFeeds>().ToListAsync(); Feeds SelectedItem = (Feeds)listview_Items.SelectedItem; TableFeeds TableResult = TableEditFeeds.Where(x => x.feed_id == SelectedItem.feed_id).FirstOrDefault(); if (SelectedItem.feed_ignore_status == true) { TableResult.feed_ignore_status = false; SelectedItem.feed_ignore_status = false; } else { TableResult.feed_ignore_status = true; SelectedItem.feed_ignore_status = true; } //Update the items in database await vSQLConnection.UpdateAllAsync(TableEditFeeds); //Reset the list selection listview_Items.SelectedItem = -1; List <string> messageAnswers = new List <string>(); messageAnswers.Add("Ok"); await MessagePopup.Popup("Feeds have been un/ignored", "Their items will be hidden or shown again on the next news item refresh.", messageAnswers); } catch { List <string> messageAnswers = new List <string>(); messageAnswers.Add("Ok"); await MessagePopup.Popup("Failed to un/ignore feeds", "Please try to un/ignored the feeds again.", messageAnswers); } ProgressEnableUI(); } } catch { } }