title: Using ProgressBar in WPF, Simple Application
body: <p>I have been trying to make sense of this article <a href="http://bensprogrammingwork.blogspot.com/2012/01/progressbar-in-wpf.html" rel="nofollow">http://bensprogrammingwork.blogspot.com/2012/01/progressbar-in-wpf.html</a></p>
  
  <p>I have the following code on my <code>Button_Click</code> event:</p>
  
  <pre><code>FileInfo existingFile = new FileInfo("C:\\Users\\cle1394\\Desktop\\Apple Foreign Tax Payment Sample Layout Proposed - Sample Data.xlsx");
  
  ConsoleApplication2.Program.ExcelData data = ConsoleApplication2.Program.GetExcelData(existingFile);
  </code></pre>
  
  <p>The <code>GetExcelData()</code> method takes a few minutes to complete, so I would like to show a progress bar to indicate the estimated time until completion.</p>
  
  <p>However, I don't know how to apply the methods in the tutorial above to my code below for <code>GetExcelData()</code>:</p>
  
  <pre><code>public static ExcelData GetExcelData(FileInfo file)
  {
      ExcelData data = new ExcelData();
      data.Countries = new List&lt;Country&gt;();
  
      using (ExcelPackage xlPackage = new ExcelPackage(file))
      {
          // get the first worksheet in the workbook
          ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets[1];
  
          List&lt;string&gt; countryNames = new List&lt;string&gt; 
          { 
              "Australia"/*,
              "China - Beijing",
              "China - Shanghai",
              "Hong Kong",
              "Hungary",
              "Ireland",
              "Spain",
              "United Kingdom"*/
          };
  
          List&lt;string&gt; monthNames = new List&lt;string&gt;
          {
              "January",
              "February",
              "March",
              "April",
              "May",
              "June",
              "July",
              "August",
              "September",
              "October",
              "November",
              "December"
          };
  
          foreach (string name in countryNames)
          {
              Country country = new Country();
  
              Console.WriteLine(name);
  
              country.Name = name;
              country.Months = new List&lt;Month&gt;();
  
              foreach (string _name in monthNames)
              {
                  country.Months.Add(GetMonthDataRows(_name, GetMonth(_name, GetCountry(name, worksheet), worksheet), worksheet));
              }
  
              country.Totals = GetTotals(country);
  
              data.Countries.Add(country);
  
              // this is where I would like to update the progressbar
  
          }
  
      } // the using statement calls Dispose() which closes the package.
  
      return data;
  }
  </code></pre>
  
  <p>I would like to update the progressbar in the foreach loop above.  Can someone show me an example how to do this?</p>