Exemple #1
0
        public async void TranslateFile()
        {
            TranslationState = TranslationState.started;

            int    counter = 0;
            string line    = string.Empty;

            StreamReader reader = new StreamReader(Path);

            while ((line = reader.ReadLine()) != null)
            {
                TranslationJob job = new TranslationJob
                {
                    Id           = this.Id,
                    OriginalWord = line
                };
                job.LineNumber = counter++;

                job = await TranslateJob(job);

                //TODO: do as Task?
                Handler.ProcessTranslationJob(job);
            }

            reader.Close();
            reader.Dispose();

            TranslationState = TranslationState.done;

            //===== Notify the parent that we have completed our translation file =====
            Handler.TranslationObjectCompleted();
        }