private void OnLoadingProgressUpdated(ProgressUpdatedEventArgs e)
 {
     if (LoadingProgressUpdated != null)
     {
         LoadingProgressUpdated(this, e);
     }
 }
Exemple #2
0
        private void FileSystemExplorer_ProgressUpdated(object sender, ProgressUpdatedEventArgs e)
        {
            _model.Progress = $"{Math.Round(e.PercentDone, 2)}%";

            var             newHeight    = ((e.PercentDone / 100) * this.ActualHeight);
            var             newWidth     = ((e.PercentDone / 100) * this.ActualWidth);
            var             sb           = new Storyboard();
            DoubleAnimation HeightOutAni = new DoubleAnimation {
                From = _scanButton.ActualHeight, To = newHeight, Duration = TimeSpan.FromMilliseconds(800), EasingFunction = new CubicEase {
                    EasingMode = EasingMode.EaseOut
                }
            };

            Storyboard.SetTarget(HeightOutAni, _scanButton);
            Storyboard.SetTargetProperty(HeightOutAni, new PropertyPath(HeightProperty));

            DoubleAnimation WidthOutAni = new DoubleAnimation {
                From = _scanButton.ActualWidth, To = newWidth, Duration = TimeSpan.FromMilliseconds(800), EasingFunction = new CubicEase {
                    EasingMode = EasingMode.EaseOut
                }
            };

            Storyboard.SetTarget(WidthOutAni, _scanButton);
            Storyboard.SetTargetProperty(WidthOutAni, new PropertyPath(WidthProperty));

            sb.Children.Add(HeightOutAni);
            sb.Children.Add(WidthOutAni);
            sb.Begin();

            sb.Completed += (obj, evt) =>
            {
                _model.Height = newHeight;
                _model.Width  = newWidth;
            };
        }
Exemple #3
0
        public Task <string> AggregateDataAsync(UserIdService userIdService,
                                                string databaseFolderPath,
                                                AggregationSetup setup,
                                                CancellationToken cancellationToken)
        {
            if (setup.Begin != setup.Begin.Date)
            {
                throw new ValidationException("The begin parameter must have no time component.");
            }

            if (setup.End != setup.End.Date)
            {
                throw new ValidationException("The end parameter must have no time component.");
            }

            return(Task.Run(() =>
            {
                // log
                var message = $"User '{userIdService.GetUserId()}' aggregates data: {setup.Begin.ToISO8601()} to {setup.End.ToISO8601()} ... ";
                _logger.LogInformation(message);

                try
                {
                    var progress = (IProgress <ProgressUpdatedEventArgs>) this.Progress;
                    var instructions = AggregationService.ComputeInstructions(setup, _databaseManager.State, _logger);
                    var days = (setup.End - setup.Begin).TotalDays;
                    var totalDays = instructions.Count() * days;
                    var i = 0;

                    foreach (var instruction in instructions)
                    {
                        var projectId = instruction.Container.Id;

                        for (int j = 0; j < days; j++)
                        {
                            cancellationToken.ThrowIfCancellationRequested();

                            var currentDay = setup.Begin.AddDays(j);
                            var progressMessage = $"Processing project '{projectId}': {currentDay.ToString("yyyy-MM-dd")}";
                            var progressValue = (i * days + j) / totalDays;
                            var eventArgs = new ProgressUpdatedEventArgs(progressValue, progressMessage);
                            progress.Report(eventArgs);

                            this.AggregateProject(userIdService.User, databaseFolderPath, projectId, currentDay, setup, instruction, cancellationToken);
                        }

                        i++;
                    }
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex.GetFullMessage());
                    throw;
                }

                _logger.LogInformation($"{message} Done.");

                return string.Empty;
            }, cancellationToken));
        }
 /// <summary>
 /// Invoked when the operation has made progress.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="progressUpdatedEvt"></param>
 private void OnProgressUpdated(object sender, ProgressUpdatedEventArgs progressUpdatedEvt)
 {
     if (!IgnoreProgressMessages)
     {
         this.progressLabel.Text = progressUpdatedEvt.ProgressMessage;
     }
     this.progressBar.Maximum = progressUpdatedEvt.Total;
     this.progressBar.Value   = progressUpdatedEvt.Completed;
 }
Exemple #5
0
        private void _updateWeblogAsyncOperation_ProgressUpdated(object sender, ProgressUpdatedEventArgs progressUpdatedHandler)
        {
            string msg = progressUpdatedHandler.ProgressMessage;

            if (msg != null)
            {
                ProgressMessage = msg;
            }
        }
Exemple #6
0
        /// <summary>
        /// Fires the ProgressUpdated event.
        /// </summary>
        /// <param name="progress">The current progress.</param>
        protected void UpdateProgress(int progress)
        {
            ProgressUpdatedEventArgs invoke = ProgressUpdated;

            if (invoke != null)
            {
                invoke(progress);
            }
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="InputProperty" /> class.
        /// </summary>
        /// <param name="copierFactory">Factory for creating <see cref="IRecordCopier" /> objects.</param>
        /// <param name="showDebugMessagesFunc">Call back function to determine whether to show debug messages.</param>
        internal InputProperty(IRecordCopierFactory copierFactory = null, Func <bool> showDebugMessagesFunc = null)
        {
            this._lazyCopier =
                new Lazy <IRecordCopier>(() => copierFactory?.CreateCopier(this.RecordInfo, this.RecordInfo));

            this._showDebugMessagesFunc = showDebugMessagesFunc ?? (() => false);

            this._progressUpdatedEventArgs = new ProgressUpdatedEventArgs(double.NaN);
        }
Exemple #8
0
 /// <summary>
 /// Handle progress changed event
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">event args</param>
 private void browserControl_ProgressChange(object sender, BrowserProgressChangeEventArgs e)
 {
     if (ProgressUpdated != null)
     {
         ProgressUpdatedEventArgs ea = new ProgressUpdatedEventArgs(
             Convert.ToInt32(e.Progress), Convert.ToInt32(e.ProgressMax), String.Empty);
         ProgressUpdated(this, ea);
     }
 }
Exemple #9
0
 private void _progressProvider_ProgressUpdated(object sender, ProgressUpdatedEventArgs progressUpdatedHandler)
 {
     if (progressUpdatedHandler.ProgressMessage != "")
     {
         labelProgress.Text = progressUpdatedHandler.ProgressMessage;
         panelMain.Invalidate(labelProgress.Bounds);
     }
     progressBar.Maximum = progressUpdatedHandler.Total;
     progressBar.Value   = progressUpdatedHandler.Completed;
 }
Exemple #10
0
 private void progressChanged(ProgressUpdatedEventArgs e)
 {
     setTaskBarState(e.state);
     if (e.max == 0)
     {
         TaskbarItemInfo.ProgressValue = 0;
     }
     else
     {
         TaskbarItemInfo.ProgressValue = (double)e.value / (double)e.max;
     }
 }
        public override void updateProgress(ProgressUpdatedEventArgs e)
        {
            if (e.message != null && (last_message == null || last_message != e.message))
            {
                if (this.Visibility != System.Windows.Visibility.Visible)
                {
                    notifier.sendBalloon(e.message);
                }
            }

            this.applyProgress(progress, e);

            //            WPFCommunicationHelpers.ApplyProgress(progress, e);
        }
Exemple #12
0
 private void OnProgressUpdated(object sender, ProgressUpdatedEventArgs e)
 {
     this.GetClient().SendProgress(e.Progress, e.Message);
 }
Exemple #13
0
 private void subProgressChanged(ProgressUpdatedEventArgs e)
 {
     setTaskBarState(e.state);
 }
 private void GameModel_LoadingProgressUpdate(object sender, ProgressUpdatedEventArgs e)
 {
     OnLoadingProgressUpdated(e);
 }
 /// <summary>
 /// Handle progress changed event
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">event args</param>
 private void browserControl_ProgressChange(object sender, BrowserProgressChangeEventArgs e)
 {
     if ( ProgressUpdated != null )
     {
         ProgressUpdatedEventArgs ea = new ProgressUpdatedEventArgs(
             Convert.ToInt32(e.Progress), Convert.ToInt32(e.ProgressMax), String.Empty ) ;
         ProgressUpdated( this, ea ) ;
     }
 }
 private void ViewModel_LoadingProgressUpdated(object sender, ProgressUpdatedEventArgs e)
 {
     actionProgressLabel.text = String.Format("{0}... {1}%", e.ActionName, e.ActionProgress);
 }
Exemple #17
0
 private void OnProgress(ProgressUpdatedEventArgs e)
 {
     ((IProgress <ProgressUpdatedEventArgs>) this.Progress).Report(e);
 }