示例#1
0
        private async void DownloaderDownloadProgressChanged(Models.Progress progress)
        {
            //在后台运行(挂起或最小化)不更新UI
            if (((App)App.Current).InBackground)
            {
                return;
            }

            int per = (int)((progress.TargetValue == null) ? 0
                : (100f * progress.CurrentValue / progress.TargetValue));
            //更新所有进度显示
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                      () =>
            {
                ProgressBlock.Text = (progress.TargetValue == null) ? "-%" : (per + "%");
                Bar.Value          = per;
                SizeBlock.Text     = StringConverter.GetPrintSize(progress.CurrentValue)
                                     + " / " + (progress.TargetValue == null ? "--" :
                                                StringConverter.GetPrintSize((long)progress.TargetValue));
                SpeedBlock.Text = StringConverter.GetPrintSize((long)progress.Speed) + "/s ";
                if (progress.TargetValue != null && progress.AverageSpeed >= 1)
                {
                    long time        = (long)(((long)progress.TargetValue - progress.CurrentValue) / (progress.AverageSpeed + 0.001));
                    SpeedBlock.Text += Strings.AppResources.GetString("Prediction") + StringConverter.GetPrintTime(time);
                }
            });
        }
示例#2
0
        public AddProgress(Models.Progress editProgress)
        {
            InitializeComponent();
            _dataApp         = ((App)Application.Current).DataApp;
            this.DataContext = this;
            _editProgress    = editProgress;

            LoadData();

            _dataPicker.DisplayDateStart = DateTime.Today;
            _dataPicker.DisplayDateEnd   = DateTime.Today.AddDays(1000);
        }
示例#3
0
        public JsonResult UpdateQuestionProgress(Models.Progress progressObj)
        {
            bool status = false;

            try
            {
                status = repository.UpdateProgress(progressObj.QuesId, progressObj.EmailId, progressObj.Status, progressObj.DateOfCompletion);
            }
            catch (Exception)
            {
                status = false;
            }

            return(Json(status));
        }