10 Rules for Building a Windows Phone App: Listing 3.

Changing the Loaded event to offload data.

BackgroundWorker getDataWorker = null;
void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
  getDataWorker = new BackgroundWorker();
  getDataWorker.DoWork += GetData_DoWork;
  getDataWorker.RunWorkerCompleted +=new
RunWorkerCompletedEventHandler(getDataWorker_RunWorkerCompleted);
  getDataWorker.RunWorkerAsync();
            
  }

  private void GetData_DoWork(object sender, DoWorkEventArgs e)
{

// Here call to get data
Model.GetData();

  }

About the Author

Max Zilberman is an architect evangelist at Microsoft on the Developer andPlatform Evangelism team and is available at [email protected].

comments powered by Disqus

Featured

Subscribe on YouTube