Example #1
0
        private void StartSync()
        {
            IsInSync = true;
            var sync = resolver.GetInstanceOf <IPBSync>();

            progressBarAnimation = new ProgressBarAnimation(sync.StepCount, Indicator);

            Indicator.Width = 0;
            this.Show();

            bool res = false;

            Task.Factory.StartNew(() =>
            {
                res = sync.Sync(progressBarAnimation.OnProgressChanged);

                var action = (Action)(() =>
                {
                    if (!res)
                    {
                        if (!isClosed)
                        {
                            this.Hide();
                            syncFailedDialog.Show();
                        }
                    }
                    else
                    {
                        CloseCommandExecute(this);
                    }
                });

                Application.Current.Dispatcher.Invoke(action);
            });
        }
Example #2
0
        /// <summary>
        ///     Initializes the animation of the progress bar.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="position">The position.</param>
        /// <param name="step">The step.</param>
        /// <returns>
        ///     Returns a <see cref="IProgressBarAnimation" /> representing the object that controls the actions of the progress
        ///     bar.
        /// </returns>
        public static IProgressBarAnimation PlayAnimation(this IApplication source, int min, int max, int position, int step)
        {
            if (source == null)
            {
                return(null);
            }

            if (_ProgressBarAnimation != null)
            {
                _ProgressBarAnimation.Dispose();
            }

            _ProgressBarAnimation = new ProgressBarAnimation(source);
            _ProgressBarAnimation.Initialize(min, max, position, step);

            return(_ProgressBarAnimation);
        }
 public ProgressBarAnimationBuilder(ProgressBarAnimation animation)
 {
     Animation = animation;
 }
Example #4
0
 public ProgressBarAnimationBuilder(ProgressBarAnimation animation)
 {
     Animation = animation;
 }