O'Reilly logo

C# 2008 and 2005 Threaded Programming: Beginner's Guide by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - Updating progress percentages from worker threads

Now, we are going to make the necessary changes to the Encrypter class to allow it to invoke many user interface updates, while the progress percentages increase during the encryption algorithm:

  1. Stay in the project, MarsEncrypter.
  2. Open the code for the Encrypter class.
  3. Add the following private variable:
    private FileToEncryptProgress proFileToEncryptProgress;
    
  4. Add the following properties to access the private variable (we want to create a compact and reliable class):
    public FileToEncryptProgress poFileToEncryptProgress
    {
    set
    {
    proFileToEncryptProgress = value;
    }
    get
    {
    return proFileToEncryptProgress;
    }
    }
    
  5. Replace the EncryptText method with the following:
    private void EncryptText() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required