public long AlbumSelector()
        {
            var albums = this.api.Photo.GetAlbums(new VkNet.Model.RequestParams.PhotoGetAlbumsParams {
            });

            dialogManager.DisplayMessage(albums);
            dialogManager.DisplayMessage("# of desired album: ");

            if (int.TryParse(dialogManager.Ask(), out int id))
            {
                return((id >= 0 && id < albums.Count) ?
                       albums[id].Id :
                       AlbumSelector());
            }
            else
            {
                return(AlbumSelector());
            }
        }
示例#2
0
        /// <summary>
        /// Run dialog service (is blocking)
        /// </summary>
        public void Run(bool useDirectInput = false)
        {
            if (_inputManager != null)
            {
                var initializationResponse = _inputManager.Initialize();
                ConsoleServices.PrintOutput(initializationResponse);
            }

            for (; ;)
            {
                var utterance = readUtterance();

                ResponseBase response;
                if (_manager == null)
                {
                    var parsedSentence = Dialog.UtteranceParser.Parse(utterance);
                    response = _inputManager.Input(parsedSentence);
                }
                else
                {
                    var parsedUtterance = parseUtterance(utterance);
                    if (parsedUtterance == null)
                    {
                        return;
                    }

                    if (useDirectInput)
                    {
                        response = _manager.Ask(utterance);
                    }
                    else
                    {
                        response = parsedUtterance.HandleManager(_manager);
                    }
                }
                ConsoleServices.PrintOutput(response);
            }
        }
示例#3
0
 protected override ResponseBase handleManager(IDialogManager manager)
 {
     return(manager.Ask(Question));
 }