Beispiel #1
0
        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            var cookie = cookieTextBox.Text;

            ConfigInfoManager.ConfigInfo.Cookie        = cookieTextBox.Text;
            ConfigInfoManager.ConfigInfo.DownloadItems = _downloadItems.ToList();
            ConfigInfoManager.WriteConfig();
        }
Beispiel #2
0
 private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     ConfigInfoManager.ConfigInfo.Cookie = cookieTextBox.Text.Trim();
     while (true)
     {
         if (backgroundWorker1.CancellationPending)
         {
             return;
         }
         var item = _downloadItems.FirstOrDefault(i => i.Status == DownloadStatus.Added);
         if (item != null)
         {
             var success = Downloader.Download(item.Url, item.SaveTo);
             if (success)
             {
                 Invoke(new Action(() =>
                 {
                     lock (ConfigInfoManager.ConfigInfo)
                     {
                         _downloadItems.Remove(item);
                         _downloadItems.ResetBindings();
                     }
                 }));
                 ConfigInfoManager.WriteConfig();
                 Thread.Sleep(1000);
             }
             else
             {
                 item.Status = DownloadStatus.Fail;
                 Invoke(new Action(() =>
                 {
                     lock (ConfigInfoManager.ConfigInfo)
                     {
                         _downloadItems.ResetBindings();
                     }
                 }));
                 Thread.Sleep(2000);
             }
         }
         Thread.Sleep(500);
     }
 }
Beispiel #3
0
 private void saveToolStripButton_Click(object sender, EventArgs e)
 {
     ConfigInfoManager.WriteConfig();
 }