100 lines
3.2 KiB
C#
100 lines
3.2 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
|
|
namespace m3uTool.Tests
|
|
{
|
|
/// <summary>
|
|
/// Implements the interface progress callback for testing output purposes
|
|
/// </summary>
|
|
public class ProgressCallbackTestBase : IProgressCallback
|
|
{
|
|
protected string mPreface = "";
|
|
|
|
#region IProgressCallback Members
|
|
|
|
/// <summary>
|
|
/// Call this method from the worker thread to initialize
|
|
/// the progress callback.
|
|
/// </summary>
|
|
/// <param name="minimum">The minimum.</param>
|
|
/// <param name="maximum">The maximum.</param>
|
|
public virtual void Begin(int minimum, int maximum)
|
|
{
|
|
Debug.WriteLine(mPreface + String.Format("Begin min:{0} max:{1}", minimum, maximum));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Call this method from the worker thread to initialize
|
|
/// the progress callback, without setting the range
|
|
/// </summary>
|
|
public virtual void Begin()
|
|
{
|
|
Debug.WriteLine(mPreface + String.Format("Begin"));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Call this method from the worker thread to reset the range in the
|
|
/// progress callback
|
|
/// </summary>
|
|
/// <param name="minimum">The minimum.</param>
|
|
/// <param name="maximum">The maximum.</param>
|
|
public virtual void SetRange(int minimum, int maximum)
|
|
{
|
|
Debug.WriteLine(mPreface + String.Format("SetRange min:{0} max:{1}", minimum, maximum));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Call this method from the worker thread to update the progress text.
|
|
/// </summary>
|
|
/// <param name="text">The text.</param>
|
|
public virtual void SetText(string text)
|
|
{
|
|
Debug.WriteLine(mPreface + String.Format("SetText : {0}", text));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Call this method from the worker thread to increase the progress
|
|
/// counter by a specified value.
|
|
/// </summary>
|
|
/// <param name="val">The val.</param>
|
|
public virtual void StepTo(int val)
|
|
{
|
|
Debug.WriteLine(mPreface + String.Format("StepTo : {0}", val));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Call this method from the worker thread to step the progress meter to a
|
|
/// particular value.
|
|
/// </summary>
|
|
/// <param name="val">The val.</param>
|
|
public virtual void Increment(int val)
|
|
{
|
|
Debug.WriteLine(mPreface + String.Format("Increment : {0}", val));
|
|
}
|
|
|
|
/// <summary>
|
|
/// If this property is true, then you should abort work
|
|
/// </summary>
|
|
/// <value>
|
|
/// <c>true</c> if this instance is aborting; otherwise, <c>false</c>.
|
|
/// </value>
|
|
public virtual bool IsAborting
|
|
{
|
|
get
|
|
{
|
|
Debug.WriteLine(mPreface + "IsAborting");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Call this method from the worker thread to finalize the progress meter
|
|
/// </summary>
|
|
public virtual void End()
|
|
{
|
|
Debug.WriteLine(mPreface + "End");
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |