public async Task SelectWorksheet(IDialogContext context, LuisResult result) { // Telemetry TelemetryHelper.TrackDialog(context, result, "Worksheets", "SelectWorksheet"); string workbookId = String.Empty; context.UserData.TryGetValue <string>("WorkbookId", out workbookId); WorksheetName = LuisHelper.GetNameEntity(result.Entities); if (!(String.IsNullOrEmpty(workbookId))) { if (!(String.IsNullOrEmpty(WorksheetName))) { await WorksheetWorker.DoSelectWorksheetAsync(context, WorksheetName); context.Wait(MessageReceived); } else { // Call the SelectWorksheet Form SelectWorksheetForm.Worksheets = await WorksheetWorker.GetWorksheetNamesAsync(context, workbookId); context.Call <SelectWorksheetForm>( new FormDialog <SelectWorksheetForm>(new SelectWorksheetForm(), SelectWorksheetForm.BuildForm, FormOptions.PromptInStart), SelectWorksheet_FormComplete); } } else { context.Call <bool>(new ConfirmOpenWorkbookDialog(), AfterConfirm_SelectWorksheet); } }
public async Task AfterConfirm_SelectWorksheet(IDialogContext context, IAwaitable <bool> result) { if (await result) { // Get access token to see if user is authenticated ServicesHelper.AccessToken = await context.GetAccessToken(ConfigurationManager.AppSettings["ActiveDirectory.ResourceId"]); string workbookId = String.Empty; context.UserData.TryGetValue <string>("WorkbookId", out workbookId); // Call the SelectWorksheet Form SelectWorksheetForm.Worksheets = await WorksheetWorker.GetWorksheetNamesAsync(context, workbookId); context.Call <SelectWorksheetForm>( new FormDialog <SelectWorksheetForm>(new SelectWorksheetForm(), SelectWorksheetForm.BuildForm, FormOptions.PromptInStart), SelectWorksheet_FormComplete); } context.Wait(MessageReceived); }