private void RTScoreCalculatorList_ListChanged(object sender, EventArgs e) { // Avoid updating on every minor change to the list. if (_pendingUpdate) { return; } // Wait for the UI thread to become available again, and then update if (GraphSummary.IsHandleCreated) { GraphSummary.BeginInvoke(new Action(DelayedUpdate)); _pendingUpdate = true; } }
/// <summary> /// For execution of refinement on a background thread, with cancelation /// if a the document changes. /// </summary> private void RefineData() { // Called on a new thread LocalizationHelper.InitThread(); try { if (Refine(() => !IsValidFor(GraphSummary.DocumentUIContainer.Document))) { // Update the graph on the UI thread. Action <bool> update = UpdateGraph; GraphSummary.BeginInvoke(update, false); } } catch (OperationCanceledException) { } catch (Exception x) { Program.ReportException(x); } }