Version 1.1

Rating: No reviews yet
Downloads: 53
Change Set: 21688
Released: Jan 30, 2013
Updated: Jan 30, 2013 by josemesona
Dev status: Stable Help Icon

Recommended Download

Application Compiled binaries (Debug and Release)
application, 130K, uploaded Jan 30, 2013 - 53 downloads

Release Notes

Added the ability to cancel time-consuming operations

Breaking Change

The DismProgressCallback signature has changed to only take a new class DismProgress. This now allows for users to cancel the operations by setting the Cancel property to true. If your code is using the callback to track progress, you'll need to update your method signature and access the properties of the DismProgress object.

This example will start mounting an image and cancel after 30% progress is made. You can also respond to user input and cancel when they request it.

private static void Main()
{
	DismApi.Initialize(DismLogLevel.LogErrorsWarningsInfo);

	try
	{
		Console.WriteLine("Mounting image");

		// Mount the image which is a blocking call
		DismApi.MountImage(imagePath, mountPath, 1, true, MyDismProgressCallback);

		Console.WriteLine("Successfully mounted image");
	}
	catch(OperationCanceledException)
	{
		// The operation was cancelled
		Console.WriteLine("Cancelled mounting image");
	}
	finally
	{
		DismApi.Shutdown();
	}
}

private void MyDismProgressCallback(DismProgress progress)
{
	Console.WriteLine("Progress: {0}/{1}", progress.Current, progress.Total);

	// See if past 30% progress
	if(progress.Current > 30)
	{
		// Cancel the operation
		progress.Cancel = true;
	}
}

Reviews for this release

No reviews yet for this release.