Exemplo n.º 1
0
        public JavaScriptForm()
        {
            InitializeComponent();

            Editors = new EditorCollection(_dockPanel);

            _dockPanel.Theme = new VS2012LightTheme();

            _outputControl = new OutputControl();

            _outputControl.Show(_dockPanel, DockState.DockBottom);

            _localsControl = new VariablesControl
            {
                Text = "Locals"
            };

            _localsControl.Show(_dockPanel, DockState.DockBottom);

            _globalsControl = new VariablesControl
            {
                Text = "Globals"
            };

            _globalsControl.Show(_dockPanel, DockState.DockBottom);

            _callStackControl = new CallStackControl();

            _callStackControl.Show(_dockPanel, DockState.DockBottom);

            ResetTabs();

            SetDebugger(null);
        }
Exemplo n.º 2
0
        public static void Show(IWin32Window owner, JavaScriptException exception)
        {
            if (owner == null)
            {
                throw new ArgumentNullException(nameof(owner));
            }
            if (exception == null)
            {
                throw new ArgumentNullException(nameof(exception));
            }

            using (var form = new ExceptionForm())
            {
                form._exceptionThrown.Text       = String.Format(form._exceptionThrown.Text, GetType(exception));
                form._additionalInformation.Text = String.Format(form._additionalInformation.Text, GetMessage(exception));
                form._location.Text = String.Format(form._location.Text, GetLocation(exception));

                if (exception.DebugInformation == null || exception.DebugInformation.Globals.Count == 0)
                {
                    form.Showing += (s, e) =>
                    {
                        int dockPanelHeight = form._dockPanel.Height;
                        form._dockPanel.Dispose();
                        form.MinimumSize = new Size(0, form.Height - dockPanelHeight);
                        form.MaximumSize = new Size(int.MaxValue, form.Height - dockPanelHeight);
                    };
                }
                else
                {
                    var callStack = new CallStackControl();
                    callStack.LoadCallStack(exception.DebugInformation);
                    form.ShowPanel(callStack);
                    var globalVariables = new VariablesControl
                    {
                        Text = "Globals"
                    };
                    globalVariables.LoadVariables(exception.DebugInformation, VariablesMode.Globals);
                    form.ShowPanel(globalVariables);
                    var localVariables = new VariablesControl
                    {
                        Text = "Locals"
                    };
                    localVariables.LoadVariables(exception.DebugInformation, VariablesMode.Locals);
                    form.ShowPanel(localVariables);

                    callStack.DockHandler.Activate();
                }

                form.ShowDialog(owner);
            }
        }