Exemple #1
0
        void DownloadV2RayCore(int proxyPort)
        {
            downloader = new Lib.Nets.Downloader(setting);
            downloader.SetArchitecture(cboxArch.SelectedIndex == 1);
            downloader.SetVersion(cboxVer.Text);
            downloader.proxyPort = proxyPort;

            downloader.OnProgress += (s, a) =>
            {
                UpdateProgressBar(a.Data);
            };

            downloader.OnDownloadCompleted += (s, a) =>
            {
                ResetUI(100);
                Task.Factory.StartNew(
                    () => MessageBox.Show(I18N.DownloadCompleted));
            };

            downloader.OnDownloadCancelled += (s, a) =>
            {
                ResetUI(0);
                Task.Factory.StartNew(
                    () => MessageBox.Show(I18N.DownloadCancelled));
            };

            downloader.OnDownloadFail += (s, a) =>
            {
                ResetUI(0);
                Task.Factory.StartNew(
                    () => MessageBox.Show(I18N.TryManualDownload));
            };

            downloader.DownloadV2RayCore();
            UpdateProgressBar(1);
        }
Exemple #2
0
 void ResetUI(int progress)
 {
     UpdateProgressBar(progress);
     downloader = null;
     EnableBtnDownload();
 }