Beispiel #1
0
        /// <summary>
        /// Initializes a new <see cref="ProgressGraphic"/>.
        /// </summary>
        /// <param name="progressProvider">The provider of progress information for which the <see cref="ProgressGraphic"/> will display updates.</param>
        /// <param name="autoClose">A value indicating whether or not the <see cref="ProgressGraphic"/> should automatically remove and dispose itself when the progress provider reports task completion or cancellation.</param>
        /// <param name="progressBarStyle">The style of progress bar to be displayed.</param>
        public ProgressGraphic(IProgressGraphicProgressProvider progressProvider, bool autoClose, ProgressBarGraphicStyle progressBarStyle)
        {
            _progressProvider = progressProvider;
            _autoClose        = autoClose;
            _progressBarStyle = progressBarStyle;

            base.Graphics.Add(_graphics = new ProgressCompositeGraphic(_progressBarStyle));
        }
Beispiel #2
0
		/// <summary>
		/// Initializes a new <see cref="ProgressGraphic"/>.
		/// </summary>
		/// <param name="progressProvider">The provider of progress information for which the <see cref="ProgressGraphic"/> will display updates.</param>
		/// <param name="autoClose">A value indicating whether or not the <see cref="ProgressGraphic"/> should automatically remove and dispose itself when the progress provider reports task completion or cancellation.</param>
		/// <param name="progressBarStyle">The style of progress bar to be displayed.</param>
		public ProgressGraphic(IProgressGraphicProgressProvider progressProvider, bool autoClose, ProgressBarGraphicStyle progressBarStyle)
		{
			_progressProvider = progressProvider;
			_autoClose = autoClose;
			_progressBarStyle = progressBarStyle;

			base.Graphics.Add(_graphics = new ProgressCompositeGraphic(_progressBarStyle));
		}
		/// <summary>
		/// Initializes a new <see cref="ProgressGraphic"/>.
		/// </summary>
		/// <param name="progressProvider">The provider of progress information for which the <see cref="ProgressGraphic"/> will display updates.</param>
		/// <param name="autoClose">A value indicating whether or not the <see cref="ProgressGraphic"/> should automatically remove and dispose itself when the progress provider reports task completion or cancellation.</param>
		/// <param name="progressBarStyle">The style of progress bar to be displayed.</param>
		public ProgressGraphic(IProgressProvider progressProvider, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle)
		{
			_autoClose = autoClose;
			_progressBarStyle = progressBarStyle;

			_progressProvider = progressProvider;
			_progressProvider.ProgressUpdated += OnProgressUpdated;

			_synchronizationContext = SynchronizationContext.Current;

			Graphics.Add(_graphics = new ProgressCompositeGraphic(_progressBarStyle));
		}
Beispiel #4
0
        /// <summary>
        /// Initializes a new <see cref="ProgressGraphic"/>.
        /// </summary>
        /// <param name="progressProvider">The provider of progress information for which the <see cref="ProgressGraphic"/> will display updates.</param>
        /// <param name="autoClose">A value indicating whether or not the <see cref="ProgressGraphic"/> should automatically remove and dispose itself when the progress provider reports task completion or cancellation.</param>
        /// <param name="progressBarStyle">The style of progress bar to be displayed.</param>
        public ProgressGraphic(IProgressProvider progressProvider, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle)
        {
            _autoClose        = autoClose;
            _progressBarStyle = progressBarStyle;

            _progressProvider = progressProvider;
            _progressProvider.ProgressUpdated += OnProgressUpdated;

            _synchronizationContext = SynchronizationContext.Current;

            Graphics.Add(_graphics = new ProgressCompositeGraphic(_progressBarStyle));
        }
Beispiel #5
0
        //TODO (CR Sept 2010): I think inheritance is the wrong model here.  Seems like each type of
        //progress bar only overrides one method.  If the contents of that method were part of a "style"
        //class, then there would only need to be a single ProgressBarGraphic with a settable Style property.

        /// <summary>
        /// Creates a new <see cref="ProgressBarGraphic"/> in the specified style.
        /// </summary>
        /// <param name="style">The <see cref="ProgressBarGraphicStyle">style</see> of the <see cref="ProgressBarGraphic"/> to be created.</param>
        /// <returns>A new <see cref="ProgressBarGraphic"/> in the specified style.</returns>
        public static ProgressBarGraphic Create(ProgressBarGraphicStyle style)
        {
            switch (style)
            {
            case ProgressBarGraphicStyle.Continuous:
                return(new ContinuousProgressBarGraphic());

            case ProgressBarGraphicStyle.Marquee:
                return(new MarqueeProgressBarGraphic());

            case ProgressBarGraphicStyle.Scanner:
                return(new ScannerProgressBarGraphic());

            case ProgressBarGraphicStyle.Blocks:
            default:
                return(new BlocksProgressBarGraphic());
            }
        }
Beispiel #6
0
 /// <summary>
 /// Creates and displays a <see cref="ProgressGraphic"/>.
 /// </summary>
 /// <remarks>
 /// This method will invoke the graphic's <see cref="IDrawable.Draw"/> method, so do not call it from a draw routine in the same scene graph!
 /// </remarks>
 /// <param name="task">The <see cref="BackgroundTask"/> to execute. The task is automatically started if it is not already running.</param>
 /// <param name="parentCollection">The graphics collection on which the progress graphic should be shown.</param>
 /// <param name="autoClose">A value indicating whether or not the progress graphic should be automatically removed when the task is terminated.</param>
 /// <param name="progressBarGraphicStyle">The style of the progress bar.</param>
 public static void Show(BackgroundTask task, GraphicCollection parentCollection, bool autoClose, ProgressBarGraphicStyle progressBarGraphicStyle)
 {
     if (!task.IsRunning)
     {
         task.Run();
     }
     Show(new BackgroundTaskProgressAdapter(task), parentCollection, autoClose, progressBarGraphicStyle);
 }
			/// <summary>
			/// Cloning constructor.
			/// </summary>
			/// <param name="source">The source object from which to clone.</param>
			/// <param name="context">The cloning context object.</param>
			protected ProgressCompositeGraphic(ProgressCompositeGraphic source, ICloningContext context)
			{
				context.CloneFields(source, this);

				_style = source._style;
			}
			public ProgressCompositeGraphic(ProgressBarGraphicStyle style)
			{
				_style = style;

				Initialize();
			}
            /// <summary>
            /// Cloning constructor.
            /// </summary>
            /// <param name="source">The source object from which to clone.</param>
            /// <param name="context">The cloning context object.</param>
            protected ProgressCompositeGraphic(ProgressCompositeGraphic source, ICloningContext context)
            {
                context.CloneFields(source, this);

                _style = source._style;
            }
            public ProgressCompositeGraphic(ProgressBarGraphicStyle style)
            {
                _style = style;

                Initialize();
            }
Beispiel #11
0
 public ProgressGraphic(IProgressGraphicProgressProvider progressProvider, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle)
     : this(new LegacyProgressProviderAdapter(progressProvider), autoClose, progressBarStyle)
 {
 }
		/// <summary>
		/// Creates and displays a <see cref="ProgressGraphic"/>.
		/// </summary>
		/// <remarks>
		/// This method will invoke the graphic's <see cref="IDrawable.Draw"/> method, so do not call it from a draw routine in the same scene graph!
		/// </remarks>
		/// <param name="task">The <see cref="BackgroundTask"/> to execute. The task is automatically started if it is not already running.</param>
		/// <param name="parentCollection">The graphics collection on which the progress graphic should be shown.</param>
		/// <param name="autoClose">A value indicating whether or not the progress graphic should be automatically removed when the task is terminated.</param>
		/// <param name="progressBarStyle">The style of the progress bar.</param>
		public static void Show(BackgroundTask task, GraphicCollection parentCollection, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle)
		{
			if (!task.IsRunning)
				task.Run();
			Show(new BackgroundTaskProgressAdapter(task), parentCollection, autoClose, progressBarStyle);
		}
Beispiel #13
0
 /// <summary>
 /// Creates and displays a <see cref="ProgressGraphic"/>.
 /// </summary>
 /// <param name="task">The <see cref="BackgroundTask"/> to execute. The task is automatically started if it is not already running.</param>
 /// <param name="parentCollection">The graphics collection on which the progress graphic should be shown.</param>
 /// <param name="autoClose">A value indicating whether or not the progress graphic should be automatically removed when the task is terminated.</param>
 /// <param name="progressBarStyle">The style of the progress bar.</param>
 /// <param name="drawImmediately">Specifies that a draw should be performed immediately after creation (should be set to FALSE if calling from a draw routine in the same scene graph, as that would otherwise cause a <see cref="StackOverflowException"/>.)</param>
 public static void Show(BackgroundTask task, GraphicCollection parentCollection, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle, bool drawImmediately = _defaultDrawImmediately)
 {
     if (!task.IsRunning)
     {
         task.Run();
     }
     Show(new BackgroundTaskProgressAdapter(task), parentCollection, autoClose, progressBarStyle, drawImmediately);
 }
Beispiel #14
0
        /// <summary>
        /// Creates and displays <see cref="ProgressGraphic"/>.
        /// </summary>
        /// <param name="task">The <see cref="BackgroundTask"/> to execute. The task is automatically started if it is not already running.</param>
        /// <param name="parentCollections">The graphics collections on which the progress graphic should be shown.</param>
        /// <param name="autoClose">A value indicating whether or not the progress graphic should be automatically removed when the task is terminated.</param>
        /// <param name="progressBarStyle">The style of the progress bar.</param>
        /// <param name="drawImmediately">Specifies that a draw should be performed immediately after creation (should be set to FALSE if calling from a draw routine in the same scene graph, as that would otherwise cause a <see cref="StackOverflowException"/>.)</param>
        public static void Show(BackgroundTask task, IEnumerable <GraphicCollection> parentCollections, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle, bool drawImmediately = _defaultDrawImmediately)
        {
            if (!task.IsRunning)
            {
                task.Run();
            }
            var provider = new BackgroundTaskProgressAdapter(task);

            foreach (var parentCollection in parentCollections)
            {
                Show(provider, parentCollection, autoClose, progressBarStyle, drawImmediately);
            }
        }
		public ProgressGraphic(IProgressGraphicProgressProvider progressProvider, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle)
			: this(new LegacyProgressProviderAdapter(progressProvider), autoClose, progressBarStyle) {}
		public static void Show(IProgressGraphicProgressProvider source, GraphicCollection parentCollection, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle)
		{
			ProgressGraphic progressGraphic = new ProgressGraphic(source, autoClose, progressBarStyle);
			parentCollection.Add(progressGraphic);
			progressGraphic.Draw();
		}
Beispiel #17
0
        /// <summary>
        /// Creates and displays a <see cref="ProgressGraphic"/>.
        /// </summary>
        /// <remarks>
        /// This method will invoke the graphic's <see cref="IDrawable.Draw"/> method, so do not call it from a draw routine in the same scene graph!
        /// </remarks>
        /// <param name="source">The source from which progress information is retrieved and displayed.</param>
        /// <param name="parentCollection">The graphics collection on which the progress graphic should be shown.</param>
        /// <param name="autoClose">A value indicating whether or not the progress graphic should be automatically removed when the task is terminated.</param>
        /// <param name="progressBarGraphicStyle">The style of the progress bar.</param>
        public static void Show(IProgressGraphicProgressProvider source, GraphicCollection parentCollection, bool autoClose, ProgressBarGraphicStyle progressBarGraphicStyle)
        {
            ProgressGraphic progressGraphic = new ProgressGraphic(source, autoClose, progressBarGraphicStyle);

            parentCollection.Add(progressGraphic);
            progressGraphic.Draw();
        }
Beispiel #18
0
        public static void Show(IProgressGraphicProgressProvider source, GraphicCollection parentCollection, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle, bool drawImmediately = _defaultDrawImmediately)
        {
            ProgressGraphic progressGraphic = new ProgressGraphic(source, autoClose, progressBarStyle);

            parentCollection.Add(progressGraphic);
            if (drawImmediately)
            {
                progressGraphic.Draw();
            }
        }
		/// <summary>
		/// Creates and displays <see cref="ProgressGraphic"/>.
		/// </summary>
		/// <remarks>
		/// This method will invoke each graphic's <see cref="IDrawable.Draw"/> method, so do not call it from a draw routine in the same scene graph!
		/// </remarks>
		/// <param name="task">The <see cref="BackgroundTask"/> to execute. The task is automatically started if it is not already running.</param>
		/// <param name="parentCollections">The graphics collections on which the progress graphic should be shown.</param>
		/// <param name="autoClose">A value indicating whether or not the progress graphic should be automatically removed when the task is terminated.</param>
		/// <param name="progressBarStyle">The style of the progress bar.</param>
		public static void Show(BackgroundTask task, IEnumerable<GraphicCollection> parentCollections, bool autoClose = _defaultAutoClose, ProgressBarGraphicStyle progressBarStyle = _defaultStyle)
		{
			if (!task.IsRunning)
				task.Run();
			var provider = new BackgroundTaskProgressAdapter(task);
			foreach (var parentCollection in parentCollections)
				Show(provider, parentCollection, autoClose, progressBarStyle);
		}