protected void GetSections(ContentSelector selector) { RegexOptions options = RegexOptions.Multiline; var index = 0; var sectionMatches = Regex.Matches(selector.CleanedContent, REGEX_FIND_SELECTOR_SECTION, options); foreach (Match sectionMatch in sectionMatches) { var sectionGroup = sectionMatch.Groups["section"]; if (!sectionGroup.Success) { continue; } var subSectionMatches = Regex.Matches(sectionGroup.Value, REGEX_FIND_SELECTOR_SUB_SECTION, options); foreach (Match subSectionMatch in subSectionMatches) { var subSectionGroup = subSectionMatch.Groups["section"]; if (!subSectionGroup.Success) { continue; } if (string.IsNullOrEmpty(subSectionGroup.Value)) { continue; } var section = GetSection(subSectionGroup.Value, index); selector.Sections.Add(section); } } }
public void WhenScriptSetting(ResolvedString text, ContentSelector selector) => Executor.Execute(() => { var e = WebDriver.Select(selector); e.Should().NotBeNull(); Add(text, new WebElementWrapper(e.WebElement)); });
private void KmlUtilForm_Shown(object sender, EventArgs e) { if (!this.DesignMode) { ContentSelector.setLocale(catalog); if (kml != null) { ContentSelector.initFromKml(kml); } } }
private async Task <DialogTurnResult> DisplayQnAResult(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var dialogOptions = GetDialogOptionsValue(stepContext); var qnaDialogResponseOptions = dialogOptions[QnADialogResponseOptions] as QnADialogResponseOptions; var reply = stepContext.Context.Activity.Text; if (reply.Equals(qnaDialogResponseOptions.CardNoMatchText, StringComparison.OrdinalIgnoreCase)) { await stepContext.Context.SendActivityAsync(qnaDialogResponseOptions.CardNoMatchResponse, cancellationToken : cancellationToken).ConfigureAwait(false); return(await stepContext.EndDialogAsync().ConfigureAwait(false)); } // If previous QnAId is present, replace the dialog var previousQnAId = Convert.ToInt32(dialogOptions[PreviousQnAId]); if (previousQnAId > 0) { return(await stepContext.ReplaceDialogAsync(QnAMakerDialogName, dialogOptions, cancellationToken).ConfigureAwait(false)); } // If response is present then show that response, else default answer. if (stepContext.Result is List <QueryResult> response && response.Count > 0) { if (!response.First().Answer.Contains("{")) { await stepContext.Context.SendActivityAsync(response.First().Answer, cancellationToken : cancellationToken).ConfigureAwait(false); } else { var customResponse = ContentSelector.getAnswer((stepContext.Context.Activity).CreateReply(), response.First().Answer, TelemetryClient); await stepContext.Context.SendActivityAsync(customResponse, cancellationToken : cancellationToken).ConfigureAwait(false); } } else { await stepContext.Context.SendActivityAsync(qnaDialogResponseOptions.NoAnswer, cancellationToken : cancellationToken).ConfigureAwait(false); } return(await stepContext.EndDialogAsync().ConfigureAwait(false)); }
/// <summary> /// Virtual method for extra inits /// </summary> protected override void AfterFileOpenerChanged() { ContentSelector.initFromKml(kml); }