private void ExecuteGetMemberCommand(object sender, ExecutedRoutedEventArgs e) { //ViewData = new NijieMemberViewModel() { MemberId = ViewData.MemberId }; ModernDialog d = new ModernDialog(); d.Content = "Loading data..."; d.Closed += new EventHandler((s, ex) => { if (!ViewData.HasError) { ViewData.Status = "Still loading..."; } }); var ctx = SynchronizationContext.Current; System.Threading.ThreadPool.QueueUserWorkItem( (x) => { ViewData.GetMember(ctx); this.Dispatcher.BeginInvoke( new Action <MemberPage>((y) => { this.DataContext = ViewData; d.Close(); if (ViewData.Images != null) { ViewData.Status = String.Format("Loaded: {0} images.", ViewData.Images.Count); ViewData.HasError = false; } else if (!ViewData.HasError) { // unknown error ViewData.Status = "Failed to parse images."; ViewData.HasError = true; } }), new object[] { this } ); }, null ); d.ShowDialog(); }