private async Task OpenWorkbookFormComplete(IDialogContext context, IAwaitable <OpenWorkbookForm> result) { OpenWorkbookForm form = null; try { form = await result; } catch { await context.PostAsync("You canceled opening a workbook. No problem! I can move on to something else"); return; } if (form != null) { // Get access token to see if user is authenticated ServicesHelper.AccessToken = await GetAccessToken(context); // Open workbook await WorkbookWorker.DoOpenWorkbookAsync(context, form.WorkbookName); } else { await context.PostAsync("Sorry, something went wrong (form is empty)"); } context.Wait(MessageReceived); }
private async Task OpenWorkbook_FormComplete(IDialogContext context, IAwaitable <OpenWorkbookForm> result) { OpenWorkbookForm form = null; try { form = await result; } catch { } if (form != null) { // Get access token to see if user is authenticated ServicesHelper.AccessToken = await GetAccessToken(context); // Open the workbook await WorkbookWorker.DoOpenWorkbookAsync(context, form.WorkbookName); context.Done <bool>(true); } else { await context.PostAsync("Okay! I will just sit tight until you tell me which workbook we should work with"); context.Done <bool>(false); } }
#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); }