Pause Label Drawing, check/change state of "esri_mapping_labelPauseButton"

460
1
06-26-2019 07:36 AM
MikeRatcliffe
Occasional Contributor

Where are the SDK methods to Pause Label Drawing, or at least check/change the toggle state of "esri_mapping_labelPauseButton"?

I'm using iCommand methods to change the state of the toggle now, but the necessity is to ensure the label drawing engine doesn't interrupt custom processes included in an OnSketchCompleteAsync(Geometry geometry).

...similar to issues solved by MapView.DrawingPaused = true  methods, except now with the label engine.

0 Kudos
1 Reply
MikeRatcliffe
Occasional Contributor
        public static Func<Task> PauseLabels(string id)
        {
            IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper(id);
            if (wrapper.Checked == false)//if label drawing is NOT paused, pause them
            {
                if (wrapper is ICommand iCommand)
                {
                    if (iCommand.CanExecute(null))
                    {
                        iCommand.Execute(null);
                        return () => Task.FromResult(0);
                    }
                    return () => Task.FromResult(0);
                }
                return () => Task.FromResult(0);
            }
            return () => Task.FromResult(0);
        }

        public static Func<Task> ResumeLabels(string id)
        {
            IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper(id);
            if (wrapper.Checked == true)//if label drawing is paused, unpause them
            {
                if (wrapper is ICommand iCommand)
                {
                    if (iCommand.CanExecute(null))
                    {
                        iCommand.Execute(null);
                        return () => Task.FromResult(0);
                    }
                    return () => Task.FromResult(0);
                }
                return () => Task.FromResult(0);
            }
            return () => Task.FromResult(0);
        }

//called as:
            PauseLabels("esri_mapping_labelPauseButton");
//or:
            ResumeLabels("esri_mapping_labelPauseButton");‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This doesn't really work in the absence of a real method similar to "MapView.DrawingPaused = true."

0 Kudos