예제 #1
0
        public TranslatedPokemonDto Map(Pokemon pokemon)
        {
            TranslationType translationType = pokemon.Description == null ? TranslationType.None
                : pokemon.Description.TranslationType;

            return(new TranslatedPokemonDto()
            {
                Name = pokemon.Name,
                Description = pokemon.Description?.Text,
                TranslationType = translationType.ToString(),
                Habitat = pokemon.Habitat.ToString(),
                IsLegendary = pokemon.IsLegendary
            });
        }
예제 #2
0
        public TranslationSourceView(TranslationManager translationManager, TranslationType type, Text textEntry)
        {
            InitializeComponent();
            _translationManager = translationManager;
            _translationManager.TranslationFail += OnTranslationFailed;

            Type = type;
            if (Type == TranslationType.Yandex_API)
            {
                SourceLabel.Content = "Powered by Yandex.Translate";
                LinkLabel.Content   = _YANDEX_LINK;
            }
            else
            {
                SourceLabel.Content = Type.ToString();
            }

            textEntry.TextChanged  += TextEntry_TextChanged;
            TranslationTextBox.Text = _translationManager.TextEntryManager.CurrentText.GetTranslation(Type);
        }