public async Task LookupTableRow(IDialogContext context, LuisResult result) { // Telemetry TelemetryHelper.TrackDialog(context, result, "Tables", "LookupTableRow"); string workbookId = String.Empty; context.UserData.TryGetValue <string>("WorkbookId", out workbookId); var name = LuisHelper.GetNameEntity(result.Entities); if (name != null) { context.UserData.SetValue <string>("TableName", name); context.UserData.SetValue <ObjectType>("Type", ObjectType.Table); context.UserData.SetValue <string>("Name", name); } Value = (LuisHelper.GetValue(result))?.ToString(); if (!(String.IsNullOrEmpty(workbookId))) { await TablesWorker.DoLookupTableRow(context, (string)Value); context.Wait(MessageReceived); } else { context.Call <bool>(new ConfirmOpenWorkbookDialog(), AfterConfirm_LookupTableRow); } }
public async Task SetActiveCellValue(IDialogContext context, LuisResult result) { // Telemetry TelemetryHelper.TrackDialog(context, result, "Cells", "SetActiveCellValue"); ObjectType?type = null; context.UserData.TryGetValue <ObjectType?>("Type", out type); var name = string.Empty; context.UserData.TryGetValue <string>("Name", out name); Value = LuisHelper.GetValue(result); string workbookId = String.Empty; context.UserData.TryGetValue <string>("WorkbookId", out workbookId); if (!(String.IsNullOrEmpty(workbookId))) { await NamedItemsWorker.DoSetNamedItemValue(context, Value); context.Wait(MessageReceived); } else { context.Call <bool>(new ConfirmOpenWorkbookDialog(), AfterConfirm_SetActiveCellValue); } }
public async Task SetCellStringValue(IDialogContext context, LuisResult result) { // Telemetry TelemetryHelper.TrackDialog(context, result, "Cells", "SetCellStringValue"); var cellAddress = LuisHelper.GetCellEntity(result.Entities); context.UserData.SetValue <string>("CellAddress", cellAddress); context.UserData.SetValue <ObjectType>("Type", ObjectType.Cell); context.UserData.SetValue <string>("Name", cellAddress); Value = LuisHelper.GetValue(result); string workbookId = String.Empty; context.UserData.TryGetValue <string>("WorkbookId", out workbookId); if (!(String.IsNullOrEmpty(workbookId))) { if (cellAddress != null) { await CellWorker.DoSetCellValue(context, Value); } else { await context.PostAsync($"You need to provide the name of a cell to set the value"); } context.Wait(MessageReceived); } else { context.Call <bool>(new ConfirmOpenWorkbookDialog(), AfterConfirm_SetCellStringValue); } }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously public async Task OpenWorkbook(IDialogContext context, LuisResult result) #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously { // Telemetry TelemetryHelper.TrackDialog(context, result, "Workbooks", "OpenWorkbook"); // Create the Open workbook form and extract the workbook name from the query var form = new OpenWorkbookForm(); form.WorkbookName = (string)(LuisHelper.GetValue(result)); // Call the OpenWorkbook Form context.Call <OpenWorkbookForm>( new FormDialog <OpenWorkbookForm>(form, OpenWorkbookForm.BuildForm, FormOptions.PromptInStart), OpenWorkbookFormComplete); }
public async Task SetNamedItemValue(IDialogContext context, LuisResult result) { // Telemetry TelemetryHelper.TrackDialog(context, result, "NamedItems", "SetNamedItemValue"); ObjectType type; if (!(context.UserData.TryGetValue <ObjectType>("Type", out type))) { type = ObjectType.NamedItem; context.UserData.SetValue <ObjectType>("Type", type); } var name = LuisHelper.GetNameEntity(result.Entities); if (name != null) { context.UserData.SetValue <string>("Name", name); } Value = LuisHelper.GetValue(result); string workbookId = String.Empty; context.UserData.TryGetValue <string>("WorkbookId", out workbookId); if (!(String.IsNullOrEmpty(name))) { string worksheetId = String.Empty; context.UserData.TryGetValue <string>("WorksheetId", out worksheetId); if (name != null) { await NamedItemsWorker.DoSetNamedItemValue(context, Value); } else { await context.PostAsync($"You need to provide a name to set the value"); } context.Wait(MessageReceived); } else { context.Call <bool>(new ConfirmOpenWorkbookDialog(), AfterConfirm_SetNamedItem); } }