コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: nXu/nbrainfuck
        /// <summary>
        /// Handles the Click event of the StopDebug control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void StopDebug_Click(object sender, RoutedEventArgs e)
        {
            // Dereference the debugger object and let the GC collect it
            this.bfd = null;

            // GUI
            this.ShowCommonElements_StopRun();
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: nXu/nbrainfuck
        /// <summary>
        /// Starts debugging.
        /// </summary>
        private void DoStartDebug()
        {
            if (this.StartDebug.IsEnabled)
            {
                // Return if no code
                if (this.BEditor.Text.Length < 1)
                    return;

                // Set GUI
                this.HideCommonElements_StartRun();
                this.InterpreterMenu.IsEnabled = false;
                this.StartDebug.IsEnabled = false;
                this.Title = "NXU Brainfuck Developer - Debugging";
                this.DebuggerTab.IsEnabled = true;
                this.RightTab.SelectedIndex = 1;

                // Output action
                Action<int> output = this.GetOutputMethod();

                // Input action
                Func<int> input = this.GetInputMethod();
                if (input == null)
                    return;

                // Initialize debugger
                this.bfd = new BFDebugger(30000, input, output, this.BEditor.Text);

                // Display debug infos
                this.DisplayDebugInfo();

                // Last GUI steps for debugging
                this.StopDebug.IsEnabled = true;
                this.NextStep.IsEnabled = true;
                this.RunUntilBP.IsEnabled = true;
            }
        }