diff options
| author | Michael <[email protected]> | 2017-02-02 19:51:57 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-02-02 19:51:57 -0500 |
| commit | 487deee243c7b1994f049c3d190e1e0971973bca (patch) | |
| tree | 0d46457bbe426ede9787faf9216d68d9dafc581e /ShiftOS.WinForms/DownloadControl.cs | |
| parent | bf100ab099e7335711ea739cb10a4a9df4b89dc5 (diff) | |
| download | shiftos_thereturn-487deee243c7b1994f049c3d190e1e0971973bca.tar.gz shiftos_thereturn-487deee243c7b1994f049c3d190e1e0971973bca.tar.bz2 shiftos_thereturn-487deee243c7b1994f049c3d190e1e0971973bca.zip | |
Fix download UI
Diffstat (limited to 'ShiftOS.WinForms/DownloadControl.cs')
| -rw-r--r-- | ShiftOS.WinForms/DownloadControl.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/DownloadControl.cs b/ShiftOS.WinForms/DownloadControl.cs new file mode 100644 index 0000000..b905167 --- /dev/null +++ b/ShiftOS.WinForms/DownloadControl.cs @@ -0,0 +1,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 + { + + } + }; + } + } +} |
