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/Applications | |
| 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/Applications')
| -rw-r--r-- | ShiftOS.WinForms/Applications/Downloader.cs | 48 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Shiftnet.Designer.cs | 2 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Shiftnet.cs | 10 |
3 files changed, 21 insertions, 39 deletions
diff --git a/ShiftOS.WinForms/Applications/Downloader.cs b/ShiftOS.WinForms/Applications/Downloader.cs index 021af3e..0c3076d 100644 --- a/ShiftOS.WinForms/Applications/Downloader.cs +++ b/ShiftOS.WinForms/Applications/Downloader.cs @@ -50,7 +50,6 @@ namespace ShiftOS.WinForms.Applications SetupUI(); })); }; - DownloadManager.ProgressUpdate += pupdate; DownloadManager.DownloadStarted += started; DownloadManager.DownloadCompleted += completed; } @@ -62,7 +61,6 @@ namespace ShiftOS.WinForms.Applications public bool OnUnload() { - DownloadManager.ProgressUpdate -= pupdate; DownloadManager.DownloadStarted -= started; DownloadManager.DownloadCompleted -= completed; return true; @@ -78,46 +76,22 @@ namespace ShiftOS.WinForms.Applications int heightMultiplier = 0; - foreach(var download in DownloadManager.Downloads) + for(int i = 0; i < DownloadManager.Downloads.Length; i++) { - var pnl = new Panel(); - pnl.Width = fllist.Width; - pnl.Height = 50; - var picpreview = new PictureBox(); - picpreview.Size = new Size(42, 42); - picpreview.Image = FileSkimmerBackend.GetImage(download.Destination); - picpreview.Location = new Point(4, 4); - if (heightMultiplier < 5) + var dctrl = new DownloadControl(i); + if(heightMultiplier < 10) + { heightMultiplier++; - pnl.Controls.Add(picpreview); - picpreview.Show(); - var prg = new ShiftedProgressBar(); - prg.Maximum = 100; - prg.Value = download.Progress; - prg.Width = pnl.Width - 8; - prg.Left = 4; - prg.Top = picpreview.Height + 8; - prg.Height = 20; - var lbtitle = new Label(); - lbtitle.Tag = "header1"; - lbtitle.Text = download.ShiftnetUrl; - lbtitle.Top = 4; - lbtitle.Left = 8 + picpreview.Height; - pnl.Controls.Add(lbtitle); - lbtitle.Show(); - lbtitle.AutoSize = true; - pnl.Controls.Add(prg); - prg.Show(); - - fllist.Controls.Add(pnl); - pnl.Show(); - ControlManager.SetupControls(pnl); + } + + fllist.Controls.Add(dctrl); + dctrl.Show(); } if (heightMultiplier == 0) heightMultiplier = 1; - this.Parent.Height = 50 * heightMultiplier; + this.ParentForm.Height = 150 * heightMultiplier; } } @@ -149,8 +123,8 @@ namespace ShiftOS.WinForms.Applications for (int i = 0; i < down.Bytes.Length; i += byteWrite) { Thread.Sleep(1000); - _downloads[_downloads.IndexOf(down)].Progress = i / down.Bytes.Length; - ProgressUpdate?.Invoke(_downloads.IndexOf(down), i / down.Bytes.Length); + _downloads[_downloads.IndexOf(down)].Progress = (int)((float)(i / down.Bytes.Length) * 100); + ProgressUpdate?.Invoke(_downloads.IndexOf(down), (int)((float)(i / down.Bytes.Length) * 100)); } ShiftOS.Objects.ShiftFS.Utils.WriteAllBytes(down.Destination, down.Bytes); _downloads.Remove(down); diff --git a/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs b/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs index eeb0439..164c79d 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs @@ -102,6 +102,7 @@ // wbcanvas // this.wbcanvas.Dock = System.Windows.Forms.DockStyle.Fill; + this.wbcanvas.IsWebBrowserContextMenuEnabled = false; this.wbcanvas.Location = new System.Drawing.Point(0, 29); this.wbcanvas.MinimumSize = new System.Drawing.Size(20, 20); this.wbcanvas.Name = "wbcanvas"; @@ -109,6 +110,7 @@ this.wbcanvas.Size = new System.Drawing.Size(805, 510); this.wbcanvas.TabIndex = 1; this.wbcanvas.WebBrowserShortcutsEnabled = false; + this.wbcanvas.Navigated += new System.Windows.Forms.WebBrowserNavigatedEventHandler(this.wbcanvas_Navigated); this.wbcanvas.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.wbcanvas_Navigating); // // Shiftnet diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 986eec6..d89b55a 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -89,11 +89,12 @@ namespace ShiftOS.WinForms.Applications private void wbcanvas_Navigating(object sender, WebBrowserNavigatingEventArgs e) { - if (CurrentUrl != e.Url.ToString() && !e.Url.ToString().StartsWith("about:")) + string Url = e.Url.ToString().Replace("http://", ""); + if (CurrentUrl != Url.ToString() && !Url.ToString().StartsWith("about:")) { e.Cancel = true; Future.Clear(); - ShiftnetNavigate(e.Url.ToString()); + ShiftnetNavigate(Url.ToString()); } } @@ -227,5 +228,10 @@ namespace ShiftOS.WinForms.Applications e.SuppressKeyPress = true; } } + + private void wbcanvas_Navigated(object sender, WebBrowserNavigatedEventArgs e) + { + } } } + |
