Esempio n. 1
0
        public void OnUnzip(object sender, UnZipEventArgs e)
        {
            pb_import.Dispatcher.Invoke(() => pb_import.Maximum = e.Count);
            var x = ((double)e.Index / (double)e.Count) * 100;

            txtJD.Dispatcher.Invoke(() => txtJD.Text = $"当前进度:{x.ToString("F2")}%");

            pb_import.Dispatcher.Invoke(new Action <System.Windows.DependencyProperty, object>(pb_import.SetValue),
                                        DispatcherPriority.Background,
                                        ProgressBar.ValueProperty,
                                        double.Parse(e.Index.ToString()));
        }
Esempio n. 2
0
        //public void download(string arg)
        //{
        //    if (!Directory.Exists("./temp"))
        //    {
        //        Directory.CreateDirectory("./temp");
        //    }

        //    var fileinfo = new FileInfo("./temp/Update.zip");
        //    if (fileinfo.Exists)
        //    {
        //        fileinfo.Delete();
        //    }

        //    HttpUtil httpUtil = new HttpUtil();
        //    httpUtil.DownloadStatistics += Bootstrap_DownloadStatistics;
        //    httpUtil.DownloadFile(arg, new FileInfo("./temp/Update.zip")).Wait();
        //}

        //private void Bootstrap_DownloadStatistics(object sender, DownloadStatisticsEventArgs e)
        //{
        //    Debug.WriteLine(e.Speed);
        //    updateVM._progressValuelue = double.Parse(e.Speed);
        //    progressBar.Value = double.Parse(e.Speed);
        //    progress.Text = $"下载速度:{e.Speed},剩余时间:{e.Remaining.Minute}:{e.Remaining.Second}";
        //}
        #endregion

        #region 解压更新包已停用
        private void OnUnzip(object sender, UnZipEventArgs e)
        {
            //zipProgress.Text = $"当前第{e.Index}个 文件数:{e.Count} 文件名:{e.Name}";

            //Debug.WriteLine($"当前第{e.Index}个 文件数:{e.Count} 文件名:{e.Name}");
        }