コード例 #1
0
 public override ActionBase GetAction()
 {
     if (this.TranslationLanguageComboBox.SelectedIndex >= 0 && !string.IsNullOrEmpty(this.TranslationTextTextBox.Text))
     {
         CultureInfo culture = (CultureInfo)this.TranslationLanguageComboBox.SelectedItem;
         TranslationResponseActionTypeEnum responseType = EnumHelper.GetEnumValueFromString <TranslationResponseActionTypeEnum>((string)this.ResponseActionComboBox.SelectedItem);
         if (responseType == TranslationResponseActionTypeEnum.Chat)
         {
             if (!string.IsNullOrEmpty(this.ChatResponseTextBox.Text))
             {
                 return(TranslationAction.CreateForChat(culture, this.TranslationTextTextBox.Text, this.AllowProfanityCheckBox.IsChecked.GetValueOrDefault(), this.ChatResponseTextBox.Text));
             }
         }
         else if (responseType == TranslationResponseActionTypeEnum.Command)
         {
             if (this.CommandResponseComboBox.SelectedIndex >= 0)
             {
                 return(TranslationAction.CreateForCommand(culture, this.TranslationTextTextBox.Text, this.AllowProfanityCheckBox.IsChecked.GetValueOrDefault(),
                                                           (CommandBase)this.CommandResponseComboBox.SelectedItem, this.CommandResponseArgumentsTextBox.Text));
             }
         }
         else if (responseType == TranslationResponseActionTypeEnum.SpecialIdentifier)
         {
             if (SpecialIdentifierStringBuilder.IsValidSpecialIdentifier(this.SpecialIdentifierResponseTextBox.Text))
             {
                 return(TranslationAction.CreateForSpecialIdentifier(culture, this.TranslationTextTextBox.Text, this.AllowProfanityCheckBox.IsChecked.GetValueOrDefault(),
                                                                     this.SpecialIdentifierResponseTextBox.Text));
             }
         }
     }
     return(null);
 }
コード例 #2
0
        private void ResponseActionComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (this.ResponseActionComboBox.SelectedIndex >= 0)
            {
                TranslationResponseActionTypeEnum responseType = EnumHelper.GetEnumValueFromString <TranslationResponseActionTypeEnum>((string)this.ResponseActionComboBox.SelectedItem);

                this.ChatResponseActionGrid.Visibility              = (responseType == TranslationResponseActionTypeEnum.Chat) ? Visibility.Visible : Visibility.Collapsed;
                this.CommandResponseActionGrid.Visibility           = (responseType == TranslationResponseActionTypeEnum.Command) ? Visibility.Visible : Visibility.Collapsed;
                this.SpecialIdentifierResponseActionGrid.Visibility = (responseType == TranslationResponseActionTypeEnum.SpecialIdentifier) ? Visibility.Visible : Visibility.Collapsed;
            }
        }
コード例 #3
0
 public TranslationAction(CultureInfo culture, string text, bool allowProfanity, TranslationResponseActionTypeEnum responseAction)
     : this()
 {
     this.Culture        = culture;
     this.Text           = text;
     this.AllowProfanity = allowProfanity;
     this.ResponseAction = responseAction;
 }