public ExampleViewModel4() { IEnumerable <ExampleModel> models = null; this.worker = new BackgroundWorker(); this.worker.DoWork += (s, e) => { IExampleService service = new MockExampleService(); models = service.FindExampleModels(); }; this.worker.RunWorkerCompleted += (s, e) => { if (e.Error != null) { throw e.Error; } this.ExampleModels = models; }; this.worker.RunWorkerAsync(); }
public ExampleViewModel() { IExampleService service = new MockExampleService(); this.ExampleModels = service.FindExampleModels(); }