Ejemplo n.º 1
0
        public bool NewSession(CommandLine commandLine)
        {
            NewSessionDialog newSessionDialog = new NewSessionDialog(this, commandLine);

            bool response = newSessionDialog.Run();

            if (response)
            {
                if (runtimeThread != null)
                {
                    runtimeThread.Shutdown();
                }

                Runtime runtime = new Runtime(
                    newSessionDialog.CompileParser,
                    newSessionDialog.DebugParser,
                    newSessionDialog.DebugParseTrees,
                    newSessionDialog.DebugGrammar,
                    true);

                runtimeThread = new RuntimeThread(runtime);
                runtimeThread.ImportStandard = newSessionDialog.ImportStandard;

                files = newSessionDialog.Files;

                runtimeThread.RunningEvent      += OnRuntimeThreadRunning;
                runtimeThread.FinishedEvent     += OnRuntimeThreadFinished;
                runtimeThread.RuntimeErrorEvent += OnRuntimeError;

                viewParseTrace.Visible = runtime.TraceParser;

                if (runtime.TraceParser)
                {
                    runtime.ParseTrace.ProgressChangedEvent += OnProgressChanged;

                    parseTraceWindow = new ParseTraceWindow(runtimeThread);
                    parseTraceWindow.TransientFor = this;

                    parseTraceWindow.SourceSelected += OnSourceSelected;
                    parseTraceWindow.Hidden         += delegate { viewParseTrace.Active = false; };
                }

                viewParseTree.Visible = runtime.TraceParseTrees;

                if (runtime.TraceParseTrees)
                {
                    parseTreeWindow = new ParseTreeWindow(runtimeThread);
                    parseTreeWindow.TransientFor = this;

                    parseTreeWindow.SourceSelected += OnSourceSelected;
                    parseTreeWindow.ObjectViewed   += OnObjectViewed;
                    parseTreeWindow.Hidden         += delegate { viewParseTree.Active = false; };
                }

                viewGrammar.Visible = runtime.TraceGrammar;

                if (runtime.TraceGrammar)
                {
                    grammarWindow = new GrammarWindow(runtimeThread);
                    grammarWindow.TransientFor = this;

                    grammarWindow.SourceSelected += OnSourceSelected;
                    grammarWindow.ObjectViewed   += OnObjectViewed;
                    grammarWindow.Hidden         += delegate { viewGrammar.Active = false; };
                }
            }

            newSessionDialog.Destroy();
            return(response);
        }
Ejemplo n.º 2
0
        public bool NewSession(CommandLine commandLine)
        {
            NewSessionDialog newSessionDialog = new NewSessionDialog(this, commandLine);
            
            bool response = newSessionDialog.Run();
            
            if (response)
            {
                if (runtimeThread != null)
                    runtimeThread.Shutdown();
                
                Runtime runtime = new Runtime(
                    newSessionDialog.CompileParser,
                    newSessionDialog.DebugParser,
                    newSessionDialog.DebugParseTrees,
                    newSessionDialog.DebugGrammar,
                    true);
                
                runtimeThread = new RuntimeThread(runtime);
                runtimeThread.ImportStandard = newSessionDialog.ImportStandard;
                
                files = newSessionDialog.Files;

                runtimeThread.RunningEvent += OnRuntimeThreadRunning;
                runtimeThread.FinishedEvent += OnRuntimeThreadFinished;
                runtimeThread.RuntimeErrorEvent += OnRuntimeError;
                
                viewParseTrace.Visible = runtime.TraceParser;
                
                if (runtime.TraceParser)
                {
                    runtime.ParseTrace.ProgressChangedEvent += OnProgressChanged;
                    
                    parseTraceWindow = new ParseTraceWindow(runtimeThread);
                    parseTraceWindow.TransientFor = this;
                    
                    parseTraceWindow.SourceSelected += OnSourceSelected;
                    parseTraceWindow.Hidden += delegate { viewParseTrace.Active = false; };
                }
                
                viewParseTree.Visible = runtime.TraceParseTrees;
                
                if (runtime.TraceParseTrees)
                {
                    parseTreeWindow = new ParseTreeWindow(runtimeThread);
                    parseTreeWindow.TransientFor = this;
                    
                    parseTreeWindow.SourceSelected += OnSourceSelected;
                    parseTreeWindow.ObjectViewed += OnObjectViewed;
                    parseTreeWindow.Hidden += delegate { viewParseTree.Active = false; };
                }
                
                viewGrammar.Visible = runtime.TraceGrammar;
                
                if (runtime.TraceGrammar)
                {
                    grammarWindow = new GrammarWindow(runtimeThread);
                    grammarWindow.TransientFor = this;

                    grammarWindow.SourceSelected += OnSourceSelected;
                    grammarWindow.ObjectViewed += OnObjectViewed;
                    grammarWindow.Hidden += delegate { viewGrammar.Active = false; };
                }
            }
            
            newSessionDialog.Destroy();
            return response;
        }