private void UpdateNavigationTargets([NotNull] IEditorNavigationSource source) { Requires.NotNull(source, nameof(source)); lock (this) { if (Updating) { return; } } try { Updating = true; var targets = source.GetNavigationTargets().ToArray(); Action action = () => UpdateNavigationTargets(targets); if (VisualElement.Dispatcher.Thread == Thread.CurrentThread) { action(); } else { VisualElement.Dispatcher.Invoke(action); } } finally { Updating = false; } }
private void UpdateNavigationTargets(IEditorNavigationSource source) { Contract.Requires <ArgumentNullException>(source != null, "source"); lock (this) { if (Updating) { return; } } try { Updating = true; var targets = source.GetNavigationTargets().ToArray(); Action action = () => UpdateNavigationTargets(targets); if (Dispatcher.Thread == Thread.CurrentThread) { action(); } else { Dispatcher.Invoke(action); } } finally { Updating = false; } }
private void UpdateNavigationTargets(IEditorNavigationSource source) { Contract.Requires<ArgumentNullException>(source != null, "source"); lock (this) { if (Updating) return; } try { Updating = true; var targets = source.GetNavigationTargets().ToArray(); Action action = () => UpdateNavigationTargets(targets); if (VisualElement.Dispatcher.Thread == Thread.CurrentThread) action(); else VisualElement.Dispatcher.Invoke(action); } finally { Updating = false; } }
private void OnNavigationTargetsChanged(object sender, EventArgs e) { IEditorNavigationSource source = (IEditorNavigationSource)sender; UpdateNavigationTargets(source); }