Ejemplo n.º 1
0
 private void RunProgram(object obj)
 {
     try
     {
         RunProgramParameters param = obj as RunProgramParameters;
         program            = new RebelProgram(param.Program, param.IO);
         program.DebugMode  = param.DebugMode;
         program.DebugStep += program_DebugStep;
         program.Run();
         Dispatcher.Invoke(ProgramDone);
     }
     catch (Exception ex)
     {
         Dispatcher.Invoke(() => MessageBox.Show(ex.Message));
     }
 }
Ejemplo n.º 2
0
        private void Start(bool debugMode)
        {
            inputQueue   = new BlockingCollection <string>();
            stepContinue = new AutoResetEvent(false);
            new TextRange(rtbConsole.Document.ContentStart, rtbConsole.Document.ContentEnd).Text = "";
            new TextRange(rtbInput.Document.ContentStart, rtbInput.Document.ContentEnd).Text     = "";
            RunProgramParameters param = new RunProgramParameters();

            param.Program   = new TextRange(rtbCode.Document.ContentStart, rtbCode.Document.ContentEnd).Text.TrimEnd('\r', '\n');
            param.DebugMode = debugMode;
            param.IO        = new DebuggerIO(inputQueue, EchoToConsole, Dispatcher);
            Thread thread = new Thread(RunProgram);

            thread.IsBackground = true;
            thread.Start(param);
            btnStartStep.Visibility = Visibility.Collapsed;
            btnStartRun.Visibility  = Visibility.Collapsed;
            btnPause.Visibility     = Visibility.Visible;
            btnStop.Visibility      = Visibility.Visible;
        }