コード例 #1
0
ファイル: MainForm.cs プロジェクト: t0rus1/shareviewer
        //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);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: t0rus1/shareviewer
        private void DownloadDayDataBtnClicked(object sender, EventArgs e)
        {
            var whichSource = groupBoxSource.Controls.OfType <RadioButton>().FirstOrDefault(n => n.Checked);

            if (textBoxUsername.Text.Length == 0 || textBoxPassword.Text.Length == 0)
            {
                MessageBox.Show("Please enter both username and password.", "Credentials Needed");
            }
            else
            {
                if ((MessageBox.Show($"Download (up to) {listBoxInhalt.Items.Count} files?", "Confirmation required",
                                     MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes))
                {
                    Helper.InitProgressCountdown("progressBarDownload", "labelBusyDownload", listBoxInhalt.Items.Count);
                    listBoxInhalt.ClearSelected();
                    Helper.HoldWhileDownloadingDayData(true); //reversed once all files downloaded
                    // downloads take place as async tasks
                    ShareSite.DownloadDayDataFiles(textBoxUsername.Text, textBoxPassword.Text, listBoxInhalt.Items);
                }
            }
        }