blob: b9051676811eb41d46902390ff8db968c9a2a9f0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.WinForms.Applications;
using ShiftOS.Engine;
namespace ShiftOS.WinForms
{
public partial class DownloadControl : UserControl
{
public DownloadControl(int index)
{
InitializeComponent();
var d = DownloadManager.Downloads[index];
lbshiftneturl.Text = d.ShiftnetUrl;
pcicon.Image = FileSkimmerBackend.GetImage(d.Destination);
int bytesTransferred = 0;
DownloadManager.ProgressUpdate += (i, p) =>
{
try
{
this.Invoke(new Action(() =>
{
if (i == index)
{
bytesTransferred += 256;
pgprogress.Value = bytesTransferred;
lbshiftneturl.Text = $@"{d.ShiftnetUrl}
{bytesTransferred} B out of {d.Bytes.Length} B transferred at 256 B per second.
To {d.Destination}";
pgprogress.Maximum = d.Bytes.Length;
}
}));
}
catch
{
}
};
}
}
}
|