Esempio n. 1
0
        internal async Task <bool> AsynchronousBreak(RemoteBreakpointInfo info)
        {
            using SemaphoreSlim semaphore = new SemaphoreSlim(0, 1);
            void resumeHandler(object sender, EventArgs e)
            {
                semaphore.Release();
            }

            await Dispatcher.UIThread.InvokeAsync(() =>
            {
                EditorControl.ActiveBreakpoint = info.BreakpointSpan.Start - PreSource.Length - 1;
                EditorControl.SetSelection(info.BreakpointSpan.End - PreSource.Length - 1, 0);
                BreakpointPanel.SetContent(info);
                BreakpointPanel.ResumeClicked += resumeHandler;
                this.FindAncestorOfType <Window>().Closing += resumeHandler;
                OpenSidePanel();
            });

            await semaphore.WaitAsync();

            bool tbr = false;

            await Dispatcher.UIThread.InvokeAsync(() =>
            {
                tbr = BreakpointPanel.IgnoreFurtherOccurrences;
                CloseSidePanel();
                BreakpointPanel.ResumeClicked -= resumeHandler;
                this.FindAncestorOfType <Window>().Closing -= resumeHandler;
                EditorControl.ActiveBreakpoint              = -1;
            });

            semaphore.Dispose();

            return(tbr);
        }
        public void SetContent(RemoteBreakpointInfo breakpointInfo)
        {
            this.FindControl <StackPanel>("LocalVariablesContainer").Children.Clear();
            this.FindControl <ToggleButton>("IgnoreFurtherOccurrences").IsChecked = false;

            foreach (KeyValuePair <string, (string, VariableTypes, object)> kvp in (from el in breakpointInfo.LocalVariables orderby el.Key ascending select el))
            {
                this.FindControl <StackPanel>("LocalVariablesContainer").Children.Add(new VariableExpander(kvp.Value.Item1, kvp.Key, kvp.Value.Item2, kvp.Value.Item3, breakpointInfo.LocalVariableDisplayParts[kvp.Key], this.FindControl <ToggleButton>("ToggleNonPublicVisibility"), breakpointInfo.PropertyOrFieldGetter, breakpointInfo.ItemsGetter)
                {
                    Margin = new Thickness(0, 0, 5, 0)
                });
            }
        }