public override ActionBase GetAction()
 {
     if (this.ActionTypeComboBox.SelectedIndex >= 0)
     {
         StreamingPlatformActionType actionType = EnumHelper.GetEnumValueFromString <StreamingPlatformActionType>((string)this.ActionTypeComboBox.SelectedItem);
         if (actionType == StreamingPlatformActionType.Host)
         {
             if (!string.IsNullOrEmpty(this.HostChannelNameTextBox.Text))
             {
                 return(StreamingPlatformAction.CreateHostAction(this.HostChannelNameTextBox.Text));
             }
         }
         else if (actionType == StreamingPlatformActionType.Raid)
         {
             if (!string.IsNullOrEmpty(this.HostChannelNameTextBox.Text))
             {
                 return(StreamingPlatformAction.CreateRaidAction(this.HostChannelNameTextBox.Text));
             }
         }
         else if (actionType == StreamingPlatformActionType.RunAd)
         {
             if (this.AdLengthComboBox.SelectedIndex >= 0)
             {
                 return(StreamingPlatformAction.CreateRunAdAction((int)this.AdLengthComboBox.SelectedItem));
             }
         }
     }
     return(null);
 }
        public override ActionBase GetAction()
        {
            if (this.ActionTypeComboBox.SelectedIndex >= 0)
            {
                StreamingPlatformActionType actionType = EnumHelper.GetEnumValueFromString <StreamingPlatformActionType>((string)this.ActionTypeComboBox.SelectedItem);
                if (actionType == StreamingPlatformActionType.Host)
                {
                    if (!string.IsNullOrEmpty(this.HostChannelNameTextBox.Text))
                    {
                        return(StreamingPlatformAction.CreateHostAction(this.HostChannelNameTextBox.Text));
                    }
                }
                else if (actionType == StreamingPlatformActionType.Poll)
                {
                    if (!string.IsNullOrEmpty(this.PollQuestionTextBox.Text) && !string.IsNullOrEmpty(this.PollLengthTextBox.Text) &&
                        uint.TryParse(this.PollLengthTextBox.Text, out uint length) && length > 0)
                    {
                        List <string> answers = new List <string>();
                        answers.Add(this.PollAnswer1TextBox.Text);
                        answers.Add(this.PollAnswer2TextBox.Text);
                        answers.Add(this.PollAnswer3TextBox.Text);
                        answers.Add(this.PollAnswer4TextBox.Text);

                        IEnumerable <string> validAnswers = answers.Where(a => !string.IsNullOrEmpty(a));
                        if (validAnswers.Count() >= 2)
                        {
                            CommandBase command = null;
                            if (this.PollCommandNameComboBox.SelectedIndex >= 0)
                            {
                                command = (CommandBase)this.PollCommandNameComboBox.SelectedItem;
                            }

                            return(StreamingPlatformAction.CreatePollAction(this.PollQuestionTextBox.Text, length, validAnswers, command));
                        }
                    }
                }
            }
            return(null);
        }