Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 public TranslationActionControl(TranslationAction action) : this()
 {
     this.action = action;
 }
 public TranslationActionControl(ActionContainerControl containerControl, TranslationAction action) : this(containerControl) { this.action = action; }