Exemplo n.º 1
0
        //private async void startAsyncSimilarWordDeleting()
        //{
        //    await Task.Run(() =>
        //    {
        //    string similar = textBox_SimilarDelete.Text;
        //    List<string> list_withDeleteWord = null;
        //    foreach (List<string> similarWords in LL_SimilarWordsFromText)
        //    {
        //        if (similarWords.Contains(similar))
        //        {
        //            list_withDeleteWord = similarWords;
        //            break;
        //        }
        //    }
        //    if (list_withDeleteWord != null)
        //    {
        //        LL_SimilarWordsFromText.Remove(list_withDeleteWord);
        //        list_withDeleteWord.Remove(similar);
        //        LL_SimilarWordsFromText.Add(list_withDeleteWord);
        //    }
        //    StreamWriter writer = new StreamWriter(SIMILAR_WORDS_FILE);
        //    if (writer != null)
        //    {
        //        using (writer)
        //        {
        //            foreach (List<string> similarWords in LL_SimilarWordsFromText)
        //            {
        //                foreach (string word in similarWords)
        //                {
        //                    writer.Write(word + ", ");
        //                }
        //                writer.WriteLine();
        //            }

        //        }

        //        writer.Close();
        //    }
        //    });
        //}

        private void MainForm_Load(object sender, EventArgs e)
        {
            startAsyncReadingHelp();
            listBox_HelpParts.Items.Clear();
            foreach (string key in Dic_help.Keys)
            {
                listBox_HelpParts.Items.Add(key);
            }

            FileInfoWorker.setDataFilesInfO(pronounDriver.PRONOUN_DATA_FILE_NAME, STR_TIERE_UPPER_WORD_FILE_NAME, label_PronounBasse, label_UpperCaseWords, label_TiereWords);
        }
Exemplo n.º 2
0
        private async void asyncStartFileReading()
        {
            string filePath = getUserFile();

            if (filePath != null)
            {
                PreProcessData.filePath = filePath;
                try
                {
                    PreProcessData.setFileFormat(filePath.Split('.')[1]);
                }
                catch (FileFormatException)
                {
                    HistoryWorker.appendLnToHistory(richTextBox_FileHistory, MSG_ERROR_FILE_READING_FORMAT);
                    Button_UploadFile.Enabled = true;
                    return;
                }
                HistoryWorker.appendLnToHistory(richTextBox_FileHistory, MSG_STARTED_FILE_LOADING);

                switch (PreProcessData.fileFormat)
                {
                case FileFormat_en.eTXT:
                    await Task.Run(() => startTxtReading(filePath));

                    break;

                case FileFormat_en.eDOCX:
                    await Task.Run(() => startDocxReading(filePath));

                    break;
                }

                HistoryWorker.appendLnToHistory(richTextBox_FileHistory, MSG_SUCCESS_FILE_LOADED);

                FileInfoWorker.setFileInfo(filePath, Label_FileName, Label_FileSize, label_QuantitySentences, label_creationTime, label_FolderName, label_LatestWriteTime);
            }

            Button_UploadFile.Enabled = true;
            setEnabledAllTabs(true);
        }