private static async Task <string> GetStock(string StockSymbol) { double?dblStockValue = await YahooDialog.GetStockRateAsync(StockSymbol); if (dblStockValue == null) { return(string.Format("This \"{0}\" is not an valid stock symbol", StockSymbol)); } else { return(string.Format("Stock Price of {0} is {1}", StockSymbol, dblStockValue)); } }
public virtual async Task GetStockListen(IDialogContext context, IAwaitable <IMessageActivity> argument) { var StockSymbol = await argument; string StockRateString; StockLUIS StLUIS = await YahooDialog.GetEntityFromLUIS(StockSymbol.Text); if (StLUIS.intents.Count() > 0 && StLUIS.entities.Count() > 0) { switch (StLUIS.intents[0].intent) { case "StockPrice": StockRateString = await YahooDialog.GetStock(StLUIS.entities[0].entity); break; case "StockPrice2": StockRateString = await YahooDialog.GetStock(StLUIS.entities[0].entity); break; default: StockRateString = "Sorry, I am not getting you..."; break; } } else { StockRateString = "Sorry, I am not getting you..."; } await context.PostAsync(StockRateString); context.Wait(GetStockListen); //double? dblStockValue = await YahooDialog.GetStockRateAsync(StockSymbol.Text); //if (dblStockValue == null) //{ // await context.PostAsync($"This \"{StockSymbol.Text}\" is not an valid stock symbol"); // context.Wait(GetStock); //} //else //{ // await context.PostAsync($"Stock : {StockSymbol.Text}\n Price : {dblStockValue}"); // context.Wait(GetStock); //} }