protected override Task <InputState> OnRecognizeInputAsync(DialogContext dc, CancellationToken cancellationToken) { var validateText = dc.State.GetValue <object>(VALUE_PROPERTY); if (!(validateText is string)) { return(Task.FromResult(InputState.Invalid)); } var culture = GetCulture(dc); List <ModelResult> results; var message = validateText.ToString(); switch (ProtocolType.GetValue(dc.State)) { case InternetProtocolInputType.IpAddress: results = SequenceRecognizer.RecognizeIpAddress(message, culture); break; case InternetProtocolInputType.Url: results = SequenceRecognizer.RecognizeURL(message, culture); break; default: throw new ArgumentOutOfRangeException(); } if (results == null || results.Count <= 0) { return(Task.FromResult(InputState.Unrecognized)); } var result = results[0].Resolution["value"].ToString(); if (ResultProperty != null) { dc.State.SetValue(ResultProperty.GetValue(dc.State), result); } return(Task.FromResult(InputState.Valid)); }