Пример #1
0
        private void SaveExerciseButton_Click(object sender, RoutedEventArgs e)
        {
            var saveFileDialog = new SaveFileDialog {
                Filter = "FEN files (*.fen)|*.fen"
            };

            if (saveFileDialog.ShowDialog() == true)
            {
                var fen      = GameController.GetFen();
                var filename = saveFileDialog.FileName;
                File.WriteAllText(filename, fen);

                var keywordWindow = new KeywordWindow();
                keywordWindow.ShowDialog();

                var keywords = keywordWindow.Keywords;

                Index.AddFile(filename, keywords);
                ExerciseManager.AddExercise(filename, keywords);
            }
        }
Пример #2
0
        private void SaveExerciseButton_Click(object sender, RoutedEventArgs e)
        {
            var input = FenTextBox.Text ?? string.Empty;
            var lines = input.Split(new[] { "\r\n", "\r", "\n" }, System.StringSplitOptions.RemoveEmptyEntries).ToList();

            var validLines = new List <string>();

            foreach (var line in lines)
            {
                if (CheckJonasFen(line))
                {
                    validLines.Add(line);
                }
            }

            var keywordWindow = new KeywordWindow();
            var res           = keywordWindow.ShowDialog();

            if (res.HasValue && res.Value)
            {
                var keywords = keywordWindow.Keywords;
                Index.SaveFens(validLines, keywords);
            }
        }