Beispiel #1
0
        public ReplWindow()
        {
            this.Width   = 450;
            this.Height  = 350;
            this.Title   = "YACQ Console";
            this.Content = this.textBox;
            this.textBox.AcceptsReturn   = true;
            this.textBox.BorderThickness = new Thickness(0);
            this.textBox.FontFamily      = new FontFamily("Consolas");
            this.textBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            this.textBox.VerticalScrollBarVisibility   = ScrollBarVisibility.Visible;
            this.textBox.TextWrapping = TextWrapping.Wrap;
            this.textBox.Text         = string.Format("YACQ {0} on Krile {1}\r\n", YacqServices.Version, typeof(App).Assembly.GetName().Version);
            this.textBox.Select(this.textBox.Text.Length, 0);
            this.textBox.PreviewKeyDown += this.textBox_PreviewKeyDown;
            this.symbolTable             = new SymbolTable(YacqFilter.FilterSymbols, typeof(Symbols))
            {
                { "*textbox*", YacqExpression.Constant(textBox) },
            };
            var rcPath = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                "yacq_lib\\rc.yacq"
                );

            if (File.Exists(rcPath))
            {
                YacqServices.ParseAll(this.symbolTable, File.ReadAllText(rcPath))
                .ForEach(e => YacqExpression.Lambda(e).Compile().DynamicInvoke());
                this.textBox.AppendText("rc.yacq was loaded.\r\n");
            }
            this.textBox.AppendText(">>> ");
        }