コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 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();
 }
コード例 #4
0
        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();
        }
コード例 #5
0
 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();
 }
コード例 #6
0
        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();
        }