Example #1
0
        void DownloadV2RayCore()
        {
            downloader = new Service.Downloader();
            downloader.SetArchitecture(cboxArch.SelectedIndex == 1);
            downloader.SetVersion(cboxVer.Text);

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

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

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

            downloader.OnDownloadFail += (s, a) =>
            {
                ResetUI(0);
                MessageBox.Show(I18N("DownloadFail"));
            };

            downloader.DownloadV2RayCore();
            UpdateProgressBar(1);
        }
Example #2
0
        void DownloadV2RayCore()
        {
            downloader = new Service.Downloader();
            downloader.SetArchitecture(cboxArch.SelectedIndex == 1);
            downloader.SetVersion(cboxVer.Text);

            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);
        }