Example #1
0
        public async Task GetCellValue(IDialogContext context, LuisResult result)
        {
            // Telemetry
            TelemetryHelper.TrackDialog(context, result, "Cells", "GetCellValue");

            var cellAddress = result.Entities[0].Entity.ToUpper();

            context.UserData.SetValue <string>("CellAddress", cellAddress);

            context.UserData.SetValue <ObjectType>("Type", ObjectType.Cell);
            context.UserData.SetValue <string>("Name", cellAddress);

            string workbookId = String.Empty;

            context.UserData.TryGetValue <string>("WorkbookId", out workbookId);

            if (!(String.IsNullOrEmpty(workbookId)))
            {
                await CellWorker.DoGetCellValue(context);

                context.Wait(MessageReceived);
            }
            else
            {
                context.Call <bool>(new ConfirmOpenWorkbookDialog(), AfterConfirm_GetCellValue);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
 public async Task AfterConfirm_GetCellValue(IDialogContext context, IAwaitable <bool> result)
 {
     if (await result)
     {
         await CellWorker.DoGetCellValue(context);
     }
     context.Wait(MessageReceived);
 }