private void bwAsyncZip_DoWork(object sender, DoWorkEventArgs e)
        {
            // The Sender is the BackgroundWorker object we need it to
            // report progress and check for cancellation.
            BackgroundWorker _asyncZipStatusWorker = sender as BackgroundWorker;

            int i = 0;

            string _status;

            Thread.Sleep(100);

            List <State> _states = StateService.GetActive();

            foreach (State _state in _states)
            {
                i++;

                // Periodically report progress to the main thread so that it can
                // update the UI.
                _status = "Updating Statistics for State: " + _state.StateCode + "...";

                _asyncZipStatusWorker.ReportProgress(Convert.ToInt32(i * (100.0 / _states.Count)), _status);

                ZipGeoCodeService.UpdateStatsForState(_state);

                // Periodically check if a Cancellation request is pending.  If the user
                // clicks cancel the line _asyncWorker.CancelAsync();
                if (_asyncZipStatusWorker.CancellationPending)
                {
                    // Pause for bit to demonstrate that there is time between
                    // "Cancelling..." and "Canceled".
                    // Thread.Sleep(1200);

                    // Set the e.Cancel flag so that the WorkerCompleted event
                    // knows that the process was canceled.
                    e.Cancel = true;
                    return;
                }
            }
            _asyncZipStatusWorker.ReportProgress(100);
        }
        private void btnUpdateCaseAvailCount_Click(object sender, RoutedEventArgs e)
        {
            if (trvZipCodes.SelectedItems != null && trvZipCodes.SelectedItems.Count > 0)
            {
                RadTreeViewItem item = trvZipCodes.SelectedItems[0] as RadTreeViewItem;

                if (((string)item.Tag) == "State")
                {
                    ZipGeoCodeService.UpdateStatsForState(((string)item.Header).Substring(0, 2));
                    GridSelectedZipCodes.ItemsSource = ZipGeoCodeService.GetForState(((string)item.Header).Substring(0, 2), (float)_selectedDealer.Latitude, (float)_selectedDealer.Longitude, (float)_selectedDealer.MaxDistance);
                    GridSelectedZipCodes.Rebind();
                    SelectZipCodes();
                }
                else
                {
                    ZipGeoCodeService.UpdateStatsForZipPart(((string)item.Header).Substring(0, 3));
                    GridSelectedZipCodes.ItemsSource = ZipGeoCodeService.GetForZipPart((string)item.Header, (float)_selectedDealer.Latitude, (float)_selectedDealer.Longitude, (float)_selectedDealer.MaxDistance);
                    SelectZipCodes();
                }
            }
        }