private void openBatchScanButton_Click(object sender, RoutedEventArgs e) { if (MWVM.SelectedDeviceBatchVM.TheDeviceBatch != null) { var scheduler = TaskScheduler.FromCurrentSynchronizationContext(); Task.Factory.StartNew(() => { System.Diagnostics.Debug.WriteLine("opening DeviceBatchScanWindow for " + MWVM.SelectedDeviceBatchVM.TheDeviceBatch.Name); //DeviceBatchScanVM dbsvm = new DeviceBatchScanVM(MWVM.SelectedDeviceBatchVM.TheDeviceBatch); }).ContinueWith(async r => { DeviceBatchScanVM dbsvm = await DeviceBatchScanVM.CreateAsync(MWVM.SelectedDeviceBatchVM.TheDeviceBatch); DeviceBatchScanWindow window = new DeviceBatchScanWindow(dbsvm); window.Show(); }, scheduler); } else { System.Windows.Forms.MessageBox.Show("Please select a Device Batch"); } }
public DeviceBatchScanWindow(DeviceBatchScanVM batchScanVM) { this.DataContext = batchScanVM; DBSVM = batchScanVM; InitializeComponent(); }