コード例 #1
0
        private void TextEntry_TextChanged(object sender, TxtChangedEventArgs e)
        {
            if (e.TranslationType.HasValue && e.ChangeType == TextChangeType.TranslationSource)
            {
                if (e.TranslationType.Value == Type)
                {
                    try {
                        Dispatcher.Invoke(() => {
                            string src = null;
                            if ((src = _translationManager.TextEntryManager.CurrentText.GetTranslation(Type)) != null)
                            {
                                ProcessSourceSFX(src);
                            }
                            SFXListBox.Items.Refresh();
                            RefreshButton.IsEnabled = true;

                            WorkingRect.Visibility = Visibility.Hidden;
                            WorkingRect.ToolTip    = null;

                            ErrorRect.Visibility = Visibility.Hidden;
                            ErrorRect.ToolTip    = null;

                            SuccessRect.Visibility = Visibility.Visible;
                        });
                    }
                    catch (Exception ex) {
                        OnTranslationFailed(this, new TranslationFailEventArgs(ex, Type));
                    }
                }
            }
        }
コード例 #2
0
        private void TextEntry_TextChanged(object sender, TxtChangedEventArgs args)
        {
            if (args.TranslationType.HasValue && args.ChangeType == TextChangeType.TranslationSource)
            {
                if (args.TranslationType.Value == Type)
                {
                    try {
                        Dispatcher.Invoke(() => {
                            TranslationTextBox.Text = args.Text;
                            RefreshButton.IsEnabled = true;

                            WorkingRect.Visibility = Visibility.Hidden;
                            WorkingRect.ToolTip    = null;

                            ErrorRect.Visibility = Visibility.Hidden;
                            ErrorRect.ToolTip    = null;

                            SuccessRect.Visibility = Visibility.Visible;
                        });
                    }
                    catch (Exception e) {
                        OnTranslationFailed(this, new TranslationFailEventArgs(e, Type));
                    }
                }
            }
        }
コード例 #3
0
        private void TextEntry_TextChanged(object sender, TxtChangedEventArgs e)
        {
            if (e.TranslationType.HasValue && e.ChangeType == TextChangeType.TranslationSource)
            {
                if (e.TranslationType.Value == Type)
                {
                    try {
                        Dispatcher.Invoke(() => {
                            string src = null;
                            try {
                                if ((src = _translationManager.TextEntryManager.CurrentText.GetTranslation(Type)) != null)
                                {
                                    DictEntries = JsonConvert.DeserializeObject <List <JPDictionaryEntry> >(src);
                                }

                                RefreshButton.IsEnabled = true;

                                WorkingRect.Visibility = Visibility.Hidden;
                                WorkingRect.ToolTip    = null;

                                ErrorRect.Visibility = Visibility.Hidden;
                                ErrorRect.ToolTip    = null;

                                SuccessRect.Visibility = Visibility.Visible;
                            }
                            catch (Exception ex) {
                                RefreshButton.IsEnabled = true;

                                WorkingRect.Visibility = Visibility.Hidden;
                                WorkingRect.ToolTip    = null;

                                ErrorRect.Visibility = Visibility.Visible;
                                ErrorRect.ToolTip    = "Error while processing source.";

                                SuccessRect.Visibility = Visibility.Hidden;
                            }
                        });
                    }
                    catch (Exception ex) {
                        OnTranslationFailed(this, new TranslationFailEventArgs(ex, Type));
                    }
                }
            }
            else if (e.ChangeType == TextChangeType.Parse)
            {
                Dispatcher.Invoke(() => {
                    JishoLinkLabel.Content = _JISHO_URL + Uri.EscapeDataString(e.Text);
                });
            }
        }
コード例 #4
0
 private void OnTextContentChanged(object sender, TxtChangedEventArgs e)
 {
     if (e.ChangeType == TextChangeType.Parse)
     {
         if (ParsedTextBox.Text != e.Text)
         {
             ParsedTextBox.Text = e.Text;
         }
         RefreshParseButton.IsEnabled   = true;
         VerticalToggleSwitch.IsEnabled = true;
     }
     else if (e.ChangeType == TextChangeType.Translation)
     {
         TranslatedTextBox.Text = e.Text;
     }
 }