//gets data days listing from the approropriate source (local/internet) private List <string> GetDaysListingPerSource() { List <string> dataDaysList; var whichSource = groupBoxSource.Controls.OfType <RadioButton>().FirstOrDefault(n => n.Checked); if (whichSource.Text.Equals("internet")) { //retrieve 'inhalt.txt' file from shares site and bind left list box to lines within the file dataDaysList = ShareSite.GetDataDaysListing(textBoxUsername.Text, textBoxPassword.Text); } else { //read local inhalt file dataDaysList = LocalStore.GetDataDaysListing(); } buttonNewShareList.Enabled = (dataDaysList.Count > 0); return(dataDaysList); }
private void ShowDataOnHand(bool forceLocal) { if (!forceLocal) { //decide whether to use local inahlt file or download a fresh one from the internet var whichSource = groupBoxSource.Controls.OfType <RadioButton>().FirstOrDefault(n => n.Checked); if (whichSource.Text.Equals("internet") && (textBoxUsername.Text.Length == 0 || textBoxPassword.Text.Length == 0)) { MessageBox.Show("Please enter both username and password.", "Credentials Needed"); return; } listBoxInhalt.DataSource = GetDaysListingPerSource().Where((entry) => WithinDateRange(entry)).ToList(); } else { //use local inhalt file otherwise listBoxInhalt.DataSource = LocalStore.GetDataDaysListing().Where((entry) => WithinDateRange(entry)).ToList(); } var numFilesTicked = LocalStore.TickOffListboxFileItems("listBoxInhalt", Helper.UserSettings().ExtraFolder); Helper.ListBoxClearAndScrollToBottom(listBoxInhalt); buttonDayDataDownload.Enabled = listBoxInhalt.Items.Count > 0; labelDatafilesCount.Text = $"{numFilesTicked} files local"; }