Beispiel #1
0
        async public Task download(downloadUnit re)
        {
            WebClient wc = new WebClient();

            try
            {
                wc.DownloadFile(re.url, re.savePath + "\\" + re.fileName);
            }
            catch (Exception e)
            {
                MessageBox.Show($"ну ты и {e.Message}", "голос.");
                //return false;
            }

            //return true;
        }
Beispiel #2
0
        private void seizeFileInfo(object sender, EventArgs e)
        {
            vh = new FileInfo(fileNamesComboBox.Text);

            #region newUnit
            string        url      = tempTs.units[fileNamesComboBox.SelectedIndex].url;
            string        tempPath = string.Empty;
            string        savePath = tempTs.units[fileNamesComboBox.SelectedIndex].savePath;
            string        fileName = tempTs.units[fileNamesComboBox.SelectedIndex].fileName;
            List <string> tags     = tempTs.units[fileNamesComboBox.SelectedIndex].tags;
            DateTime      dv       = tempTs.units[fileNamesComboBox.SelectedIndex].unl;
            bool?         success  = tempTs.units[fileNamesComboBox.SelectedIndex].success;
            #endregion

            tempUnit = new downloadUnit(url, tempPath, fileName, tags, dv, success);
            this.exclusiveUnitSavePath = savePath;
        }
Beispiel #3
0
        private void submitButton_Click(object sender, EventArgs e)
        {
            string        temple = string.Empty;
            List <string> tags   = new List <string>();

            for (int i = 0; i < tagsTextBox.Text.Length; i++)
            {
                if (tagsTextBox.Text[i] == ',' || i == tagsTextBox.Text.Length)
                {
                    tags.Add(temple);
                    temple = string.Empty;
                }
                else if (tagsTextBox.Text[i] == ' ')
                {
                    ;
                }
                else
                {
                    temple += tagsTextBox.Text[i];
                }
            }

            DateTime ae = DateTime.Now;

            temp = new downloadUnit(linkTextBox.Text, locationTextBox.Text, fileNameTextBox.Text, tags, ae);

            pauseButton.Visible = true;
            re = Task.Run(() =>
            {
                tempTs.download(temp);
                MessageBox.Show("дело сделано.", "голос.");
                temp.success = true;
                tempTs.units.Add(temp);
            });
            pauseButton.Visible = false;
        }