Ejemplo n.º 1
0
        private async Task HandleAnotherFileAsync(CallbackQuery query, AddFileAction addFileAction)
        {
            await _telegramBotClient.AnswerCallbackQueryAsync(query.Id);

            if (addFileAction == AddFileAction.Yes)
            {
                await _telegramBotClient.SendTextMessageAsync(_chatId, "Just send me the next file!",
                                                              replyToMessageId : query.Message.MessageId);
            }
            else
            {
                _workerService.QueueItem(new WorkItem
                {
                    ChatId           = _chatId.Identifier,
                    ConversationType = _conversationType,
                    DocumentAction   = _documentAction,
                    Files            = _files
                });

                await _telegramBotClient.SendTextMessageAsync(_chatId, "Please be patient, your conversation is in progress. You can start over again, I'll ping you as soon as I'm done.",
                                                              replyToMessageId : query.Message.MessageId);

                InProgress = false;
            }
        }
Ejemplo n.º 2
0
        public LauncherContext()
        {
            FolderList       = new ObservableCollection <FolderModel>();
            FileList         = new ObservableCollection <FileModel>();
            SearchEngineList = new ObservableCollection <WebsiteModel>();
            WebsiteList      = new ObservableCollection <WebsiteModel>();

            AddFileCommand = new DelegateCommand(() =>
            {
                AddFileAction?.Invoke();
            });

            var va = VirtualAssistant.Instance;

            RemoveFileCommand = new DelegateCommand(() =>
            {
                try
                {
                    va.SettingsManager[Constants.ApplicationList].Remove(SelectedFile.Name);
                    FileList.Remove(SelectedFile);
                }
                catch (Exception exception)
                {
                    VirtualAssistant.Instance.Logger.Error(exception);
                }
            });

            AddFolderCommand = new DelegateCommand(() =>
            {
                AddFolderAction?.Invoke();
            });

            RemoveFolderCommand = new DelegateCommand(() =>
            {
                try
                {
                    va.SettingsManager[Constants.DirectoryList].Remove(SelectedFolder.Name);
                    FolderList.Remove(SelectedFolder);
                }
                catch (Exception exception)
                {
                    VirtualAssistant.Instance.Logger.Error(exception);
                }
            });

            AddSearchEngineCommand = new DelegateCommand(() =>
            {
                AddSearchEngineAction?.Invoke();
            });

            RemoveSearchEngineCommand = new DelegateCommand(() =>
            {
                try
                {
                    va.SettingsManager[Constants.SearchEngineList].Remove(SelectedSearchEngine.Name);
                    SearchEngineList.Remove(SelectedSearchEngine);
                }
                catch (Exception exception)
                {
                    VirtualAssistant.Instance.Logger.Error(exception);
                }
            });

            AddWebsiteCommand = new DelegateCommand(() =>
            {
                AddWebsiteAction?.Invoke();
            });

            RemoveWebsiteCommand = new DelegateCommand(() =>
            {
                try
                {
                    va.SettingsManager[Constants.WebsiteList].Remove(SelectedWebsite.Name);
                    WebsiteList.Remove(SelectedWebsite);
                }
                catch (Exception exception)
                {
                    VirtualAssistant.Instance.Logger.Error(exception);
                }
            });
        }