Ejemplo n.º 1
0
        /// <summary>
        /// invocator event GettingOneTranslationComplete
        /// </summary>
        /// <param name="e">result of translator</param>
        protected virtual void OnGettingOneTranslationComplete(TranslationEventArgs e)
        {
            var handler = this.GettingOneTranslationComplete;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 2
0
        protected virtual void LoadTranslation(object ct)
        {
            CancellationToken cancelTok = (CancellationToken)ct;

            if (this.DictResult != null)
            {
                this.DictResult.Clear();
            }

            ApiDictionary apiDict = new ApiDictionary(this.apiKeyDict);

            this.DictResult = apiDict.GetTranslation(Lang.EnRu, this.wordKey);

            int loadedFilesCount = 0;

            for (int i = 0; i < this.DictResult.Count; i++)
            {
                if (!cancelTok.IsCancellationRequested)
                {
                    foreach (YTranslation translation in this.DictResult[i].Translations)
                    {
                        TranslationEventArgs e = new TranslationEventArgs
                        {
                            PartOfSpeach  = this.DictResult[i].AttrPartOfSpeech,
                            Transcription = this.DictResult[i].AttrTranscription
                        };
                        e.Translation = translation.AttrTranslation;
                        this.OnGettingOneTranslationComplete(e);
                        loadedFilesCount++;
                    }
                }
                else
                {
                    cancelTok.ThrowIfCancellationRequested();
                }
            }

            if (!cancelTok.IsCancellationRequested)
            {
                this.OnGettingTranslationComplete(loadedFilesCount);
            }
        }
Ejemplo n.º 3
0
 void _translator_TranslationCompleted(object sender, TranslationEventArgs e)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 4
0
 private void LoaderTranslationGettingOneTranslationComplite(object sender, TranslationEventArgs e)
 {
     this.view.ListTransAddTranslation(e.Translation, e.PartOfSpeach, e.Transcription);
 }
Ejemplo n.º 5
0
        public void OnLanguageChanged(object sender, TranslationEventArgs e)
        {
            Translation translation = (Translation)sender;

            this.labelOutdatedLanguage.Visible = translation.IsOutdated();
        }