Ejemplo n.º 1
0
        private void Window_Exit(object sender, CancelEventArgs e)
        {
            if (_documentPath != string.Empty)
            {
                File.WriteAllText(_documentPath, textEditor.Text);
            }

            Serializing.WriteToBinaryFile <string>(Serializing.AssemblyDirectory + "/lastDocument.txt", _documentPath);
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            _engine = new SkryptEngine();

            //_outputter = new Output.TextBoxOutputter(Terminal);
            //Console.SetOut(_outputter);

            var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                    @"..\..\SkryptHighlighting.xml");

            using (XmlTextReader reader = new XmlTextReader(new StreamReader(path))) {
                textEditor.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance);
            }

            try {
                _documentPath   = Serializing.ReadFromBinaryFile <string>(Serializing.AssemblyDirectory + "/lastDocument.txt");
                textEditor.Text = File.ReadAllText(_documentPath);
            } catch {
                _documentPath = string.Empty;
            }

            RoutedCommand newCmd = new RoutedCommand();

            newCmd.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(newCmd, OnSave));

            newCmd = new RoutedCommand();
            newCmd.InputGestures.Add(new KeyGesture(Key.N, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(newCmd, OnNew));

            newCmd = new RoutedCommand();
            newCmd.InputGestures.Add(new KeyGesture(Key.R, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(newCmd, OnRun));
        }