Beispiel #1
0
        private void OpenFile_OnClick(object sender, RoutedEventArgs e)
        {
            var tab = MathTab.Open();

            if (tab == null)
            {
                return;
            }

            TabControl.Items.Add(tab);
            SelectNewTab();
        }
Beispiel #2
0
        public static MathTab Open()
        {
            var openFile = new OpenFileDialog {
                Filter = "Mathos Parser File (*.mpf)|*.mpf|Any File (*.*)|*.*", CheckFileExists = true
            };

            if (openFile.ShowDialog() != true)
            {
                return(null);
            }

            var tab = new MathTab(Path.GetFileName(openFile.FileName))
            {
                _savedBefore = true, _filePath = openFile.FileName
            };

            tab._editor.Text = File.ReadAllText(openFile.FileName);
            tab.RemoveSaveHeader();

            return(tab);
        }