示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Downloads"))
            {
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Downloads");
            }

            _downloadManager = new BitsManager();
            _downloadManager.OnJobModified    += downloadManager_OnJobModified;
            _downloadManager.OnJobTransferred += downloadManager_OnJobTransferred;
            _downloadManager.EnumJobs(JobOwner.CurrentUser);

            foreach (var job in _downloadManager.Jobs.Values)
            {
                if (job.State == JobState.Transferred)
                {
                    job.Complete();
                }
                else
                {
                    AddJobFlags(job);
                }
            }

            _colIDs = new ColumnIDs(dataGridView1);

            dataGridView1.Rows.AddRange(GetDownloadJobsAsRows().ToArray());
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Downloads"))
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Downloads");

            _downloadManager = new BitsManager();
            _downloadManager.OnJobModified += downloadManager_OnJobModified;
            _downloadManager.OnJobTransferred += downloadManager_OnJobTransferred;
            _downloadManager.EnumJobs(JobOwner.CurrentUser);

            foreach (var job in _downloadManager.Jobs.Values)
            {
                if (job.State == JobState.Transferred)
                    job.Complete();
                else
                    AddJobFlags(job);
            }

            _colIDs = new ColumnIDs(dataGridView1);

            dataGridView1.Rows.AddRange(GetDownloadJobsAsRows().ToArray());
        }