Asynchronous encoding sample

The WPFEncode application demonstrates how to encode a file from a user interface (UI) application when displaying the progress of the encoding process. To use the application, click the Browse button to point to a file that you want to encode, and then click the Encode button to encode it. When the file is being encoded, a bar displays the encoding progress.

When you press the Encode button, the application creates a thread to perform the encoding to make sure that the UI thread is not blocked. The progress events are called from a non-UI thread. Consequently, Microsoft Expression Encoder uses the Windows Presentation Foundation (WPF) Dispatcher to marshal the updates to the UI thread.

If you try to close the application when the encoding is still occurring, the application prompts you to confirm that you want to stop the process. If you confirm, the application stops the encoding thread but delays closing the application until the thread actually stops.

   © 2010 Microsoft Corporation. All rights reserved.
Show: