Exemple #1
0
        private void OnRun(object sender, RoutedEventArgs e)
        {
            Console.Clear();

            if (_documentPath != string.Empty)
            {
                File.WriteAllText(_documentPath, textEditor.Text);
            }

            var engine = new SkryptEngine();

            engine.AddType(typeof(Canvas.Drawing));
            var code = textEditor.Text;

            try {
                engine.Parse(code);
            }
            catch (Exception exception) {
                if (exception.GetType() == typeof(SkryptException))
                {
                    if (((SkryptException)exception).Token != null)
                    {
                        textEditor.CaretOffset = ((SkryptException)exception).Token.Start;
                    }
                }
            }
        }