예제 #1
0
 // Clear button click event handler.
 private void ClearButton_Click(object sender, RoutedEventArgs e)
 {
     TextToTranslateTxtBox.Clear();
     TranslatedTextTxtBox.Clear();
     TextToTranslateTxtBox.Focus();
     TrnslLookUp.Clear();
 }
예제 #2
0
        // Translate button click event handler.
        private void TranslateButton_Click(object sender, RoutedEventArgs e)
        {
            if (TextToTranslateTxtBox.Text != string.Empty)
            {
                textToTrans = TextToTranslateTxtBox.Text;
                fromLang    = ((Language)FromLanguageCmbBox.SelectedValue).langCode;
                toLang      = ((Language)ToLanguageCmbBox.SelectedValue).langCode;

                TranslatedTextTxtBox.Clear();
                TranslateButton.IsEnabled = false;

                Thread td = new Thread(GetTranslation);
                td.Start();
            }
            else
            {
                MessageBox.Show("Enter text to translate.", "Translator", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                TextToTranslateTxtBox.Focus();
            }
        }