Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
		/// <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);
		}