private void InstallButtonClick(object sender, EventArgs e) { WebFile installer = null; downloadProgressBar.Visible = true; installButton.Enabled = false; switch (m_Type) { case UpdateType.Both: UpdateBoth(); break; case UpdateType.Extensions: installer = UpdateExtensions(); break; case UpdateType.Player: installer = UpdatePlayer(); break; } if (installer == null) { return; } m_DownloadingWebFile = installer; m_DownloadingWebFile.Downloaded += InstallerOnDownloaded; m_DownloadingWebFile.DownloadFailed += InstallerOnDownloadFailed; m_DownloadingWebFile.DownloadProgressChanged += InstallerOnDownloadProgressChanged; m_DownloadingWebFile.DownloadFile(); }
private void DownloadFile(string url) { downloadButton.Enabled = false; downloadProgressBar.Visible = true; m_File = new TemporaryWebFile(new Uri(url)); m_File.Downloaded += o => { m_File.Start(); GuiThread.DoAsync(() => { ResetDlButtonProgressBar(); Close(); }); }; m_File.DownloadProgressChanged += (o, args) => GuiThread.DoAsync(() => { downloadProgressBar.Value = args.ProgressPercentage; }); m_File.DownloadFailed += (sender, error) => GuiThread.DoAsync(() => { ResetDlButtonProgressBar(); MessageBox.Show(error.Message, "Download Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); }); m_File.Cancelled += sender => { Trace.WriteLine("Download Cancelled"); ResetDlButtonProgressBar(); }; m_File.DownloadFile(); }
private void UpdateBoth() { m_DownloadingWebFile = UpdateExtensions(); m_DownloadingWebFile.DownloadFailed += InstallerOnDownloadFailed; m_DownloadingWebFile.DownloadProgressChanged += InstallerOnDownloadProgressChanged; m_DownloadingWebFile.Downloaded += (o => { var downloadedExtensionInstaller = (WebFile)o; downloadedExtensionInstaller.Start(string.Format("/ARCH={0} /MPDN_VERSION=\"{1}\"", ArchitectureHelper.GetPlayerArtchitecture(), m_Settings.MpdnVersionOnServer)); GuiThread.Do((Application.Exit)); }); m_DownloadingWebFile.DownloadFile(); }
private void DownloadFile(string url) { downloadButton.Enabled = false; downloadProgressBar.Visible = true; m_File = new TemporaryWebFile(new Uri(url)); m_File.Downloaded += o => { m_File.Start(); GuiThread.DoAsync(() => { ResetDlButtonProgressBar(); Close(); }); }; m_File.DownloadProgressChanged += (o, args) => GuiThread.DoAsync(() => { downloadProgressBar.Value = args.ProgressPercentage; }); m_File.DownloadFailed += (sender, error) => GuiThread.DoAsync(() => { ResetDlButtonProgressBar(); MessageBox.Show(error.Message, "Download Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); }); m_File.Cancelled += sender => { Trace.WriteLine("Download Cancelled"); ResetDlButtonProgressBar(); }; m_File.DownloadFile(); }
private void UpdateBoth() { m_DownloadingWebFile = UpdateExtensions(); m_DownloadingWebFile.DownloadFailed += InstallerOnDownloadFailed; m_DownloadingWebFile.DownloadProgressChanged += InstallerOnDownloadProgressChanged; m_DownloadingWebFile.Downloaded += (o => { var downloadedExtensionInstaller = (WebFile) o; downloadedExtensionInstaller.Start(string.Format("/ARCH={0} /MPDN_VERSION=\"{1}\"", ArchitectureHelper.GetPlayerArtchitecture(), m_Settings.MpdnVersionOnServer)); GuiThread.Do((Application.Exit)); }); m_DownloadingWebFile.DownloadFile(); }
private void InstallButtonClick(object sender, EventArgs e) { WebFile installer = null; downloadProgressBar.Visible = true; installButton.Enabled = false; switch (m_Type) { case UpdateType.Both: UpdateBoth(); break; case UpdateType.Extensions: installer = UpdateExtensions(); break; case UpdateType.Player: installer = UpdatePlayer(); break; } if (installer == null) return; m_DownloadingWebFile = installer; m_DownloadingWebFile.Downloaded += InstallerOnDownloaded; m_DownloadingWebFile.DownloadFailed += InstallerOnDownloadFailed; m_DownloadingWebFile.DownloadProgressChanged += InstallerOnDownloadProgressChanged; m_DownloadingWebFile.DownloadFile(); }