title: Update progress bar from Task.Run async
body: <p>I have a method to generate software activation key from User Information:</p>
  
  <pre><code>private async void GenerateAsync()
          {
              await Task.Run(() =&gt;
              {
                  var secretstring = "CustomerName &gt;&gt; " + txtFullname.Text + " &gt;&gt; " + txtproducid.Text;
                  keymng = new KeyManager(secretstring);
                  var dateexp = numExpdate.Value;
                  if (dateexp == 0)
                  {
                      dateexp = 730000;
                  }
  
                  if (cbLicenseType.SelectedIndex == 0)
                  {
                      kvc = new KeyValueClass()
                      {
                          LicenseType = LicenseType.FULL,
                          Header = Convert.ToByte(9),
                          Footer = Convert.ToByte(6),
                          ProductCode = PRODUCTCODE,
                          Edition = (Edition)Enum.Parse(typeof(Edition), cbEdition.SelectedText),
                          Version = 1,
                          Expiration = DateTime.Now.AddDays(Convert.ToInt32(dateexp))
                      };
  
                      if (!keymng.GenerateKey(kvc, ref productkey))
                      {
                          //Handling Error
                      }
                  }
                  else
                  {
                      kvc = new KeyValueClass()
                      {
                          LicenseType = LicenseType.TRIAL,
                          Header = Convert.ToByte(9),
                          Footer = Convert.ToByte(6),
                          ProductCode = PRODUCTCODE,
                          Edition = (Edition)Enum.Parse(typeof(Edition), cbEdition.SelectedText),
                          Version = 1,
                          Expiration = DateTime.Now.AddDays(Convert.ToInt32(dateexp))
                      };
                      if (!keymng.GenerateKey(kvc, ref productkey))
                      {
                          //Handling Error
                      }
                  }
              });
  
          }
  </code></pre>
  
  <p>and I have progressbar. I want to run this method async and update progress to progressbar. How to update UI with async-await method. BackgroundWorker is  alternative???</p>