public async Task GetNamedItemValue(IDialogContext context, LuisResult result)
        {
            // Telemetry
            TelemetryHelper.TrackDialog(context, result, "NamedItems", "GetNamedItemValue");

            var name = LuisHelper.GetNameEntity(result.Entities);

            if (!(String.IsNullOrEmpty(name)))
            {
                context.UserData.SetValue <string>("Name", name);
                context.UserData.SetValue <ObjectType>("Type", ObjectType.NamedItem);

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

                if (!(String.IsNullOrEmpty(workbookId)))
                {
                    await NamedItemsWorker.DoGetNamedItemValue(context);

                    context.Wait(MessageReceived);
                }
                else
                {
                    context.Call <bool>(new ConfirmOpenWorkbookDialog(), AfterConfirm_GetNamedItemValue);
                }
            }
            else
            {
                await context.PostAsync($"You need to provide a name to get the value");

                context.Wait(MessageReceived);
            }
        }
Esempio n. 2
0
        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 AfterConfirm_GetNamedItemValue(IDialogContext context, IAwaitable <bool> result)
 {
     if (await result)
     {
         await NamedItemsWorker.DoGetNamedItemValue(context);
     }
     context.Wait(MessageReceived);
 }
        public async Task ListNamedItems(IDialogContext context, LuisResult result)
        {
            // Telemetry
            TelemetryHelper.TrackDialog(context, result, "NamedItems", "ListNamedItems");

            string workbookId = String.Empty;

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

            if (!(String.IsNullOrEmpty(workbookId)))
            {
                await NamedItemsWorker.DoListNamedItems(context);

                context.Wait(MessageReceived);
            }
            else
            {
                context.Call <bool>(new ConfirmOpenWorkbookDialog(), AfterConfirm_ListNamedItems);
            }
        }