예제 #1
0
        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;
            }
        }
예제 #4
0
        private void OnNavigationTargetsChanged(object sender, EventArgs e)
        {
            IEditorNavigationSource source = (IEditorNavigationSource)sender;

            UpdateNavigationTargets(source);
        }