private void LoadDictationButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"; fileDialog.ShowDialog(); if (fileDialog.FileName != "") { DictStrings = DictationParser.GetStrings(fileDialog.FileName); FlowDocument flowDocument = new FlowDocument(); Paragraph paragraph = new Paragraph(); foreach (var textString in DictStrings) { paragraph.Inlines.Add(textString); flowDocument.Blocks.Add(paragraph); paragraph.Inlines.Add("\n"); flowDocument.Blocks.Add(paragraph); } DictationRichBox.Document = flowDocument; } }
private void AddNewExcelButton_Click(object sender, RoutedEventArgs e) { ExcelCreatorWindow excelCreatorWindow = new ExcelCreatorWindow(); excelCreatorWindow.ShowDialog(); if (currentFile != "" && currentSheet != "") { DictationParser.CreateNewExcelFile(currentSheet, currentFile); } string fileName = Path.GetFileName(currentFile); IsLoadedFileLabel.Foreground = Brushes.Green; IsLoadedFileLabel.Content = fileName; }
private void WriteToExcel() { int counter = DictationParser.AddNewWordsToExcel(PreparedForExcelAddingList, currentFile); Dispatcher.InvokeAsync(() => { TypesChengeButton.IsEnabled = true; LoadDictationButton.IsEnabled = true; ParseDictationButton.IsEnabled = true; WriteWordsToExcelButton.IsEnabled = true; BarLabel.Foreground = Brushes.Green; BarLabel.Content = $"Успешная запись..."; MessageBox.Show($"Запись в Excel закончена успешно. Записано: {counter}", "Success", MessageBoxButton.OK, MessageBoxImage.Information); }); }
private void FindExistingWordsInOpcorpora() { DictationParser.GetOpcorporaWords(); wordslist = DictationParser.GetWordsFromDictationary(DictStrings); PreparedForExcelAddingList = DictationParser.MatchWordsFromOpcorporaAndDictationary(wordslist); Dispatcher.InvokeAsync(() => { TypesChengeButton.IsEnabled = true; LoadDictationButton.IsEnabled = true; ParseDictationButton.IsEnabled = true; WriteWordsToExcelButton.IsEnabled = true; BarLabel.Foreground = Brushes.Green; BarLabel.Content = $"Слов найдено: {PreparedForExcelAddingList.Count}"; MessageBox.Show($"Обработка слов закончена. Найдено: {PreparedForExcelAddingList.Count}.\n Для записи в Excel нажмите \"Записать слова\".", "Success", MessageBoxButton.OK, MessageBoxImage.Information); }); }