public void DoCompareSchemaCommand(object sender) { if (LeftProfile != null && RightProfile != null) { ThreadStart dbCompareThread = delegate() { try { List <TableComparison> missingTables = DbComparisons.CompareSchema(LeftProfile, RightProfile, (prog, table) => Application.Current.Dispatcher.BeginInvoke(new Action <double, TableComparison>(UpdateComparisonProgress), DispatcherPriority.Normal, prog, table)); Application.Current.Dispatcher.BeginInvoke(new Action <double, List <TableComparison> >(FinishComparison), DispatcherPriority.Normal, 100, missingTables); } catch (Exception e) { Application.Current.Dispatcher.BeginInvoke(new Action <Exception>(HandleTableComparisonException), DispatcherPriority.Normal, e); } }; _isComparingSchemas = true; OperationProgress = 0; ComparisonTables.Clear(); new Thread(dbCompareThread).Start(); } }