Example #1
0
 public GitUnstageCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, IGitBusiness gitBusiness)
     : base(settingAgent, "Unstage", new[] { "unstage", "remove", "soft reset", "reset soft" })
 {
     _repositoryBusiness = repositoryBusiness;
     _talkAgent          = talkAgent;
     _gitBusiness        = gitBusiness;
 }
Example #2
0
 public GitStatusCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, IGitBusiness gitBusiness)
     : base(settingAgent, "Status", new[] { "status" })
 {
     _repositoryBusiness = repositoryBusiness;
     _talkAgent          = talkAgent;
     _gitBusiness        = gitBusiness;
 }
Example #3
0
 public GitOpenCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, IQuestionAgent questionAgent, ITalkAgent talkAgent)
     : base(settingAgent, "Open", new[] { "open repo", "open repository" })
 {
     _repositoryBusiness = repositoryBusiness;
     _questionAgent      = questionAgent;
     _talkAgent          = talkAgent;
 }
Example #4
0
        public CommandAgent(IEventHub eventHub, ISettingAgent settingAgent)
        {
            _eventHub = eventHub;
            _commands = new List <IGitBitchCommand>();

            _eventHub.StartTalkingEvent   += EventHub_StartTalkingEvent;
            _eventHub.DoneTalkingEvent    += EventHub_DoneTalkingEvent;
            _eventHub.StartListeningEvent += EventHub_StartListeningEvent;
            _eventHub.DoneListeningEvent  += EventHub_DoneListeningEvent;
            _eventHub.StartWorkingEvent   += EventHub_StartWorkingEvent;
            _eventHub.DoneWorkingEvent    += EventHub_DoneWorkingEvent;

            _speechRecognitionEngine = new SpeechRecognitionEngine();

            _speechRecognitionEngine.SpeechRecognized           += SpeechRecognized;
            _speechRecognitionEngine.SpeechDetected             += SpeechDetected;
            _speechRecognitionEngine.SpeechRecognitionRejected  += SpeechRecognitionRejected;
            _speechRecognitionEngine.SpeechHypothesized         += SpeechHypothesized;
            _speechRecognitionEngine.AudioStateChanged          += AudioStateChanged;
            _speechRecognitionEngine.EmulateRecognizeCompleted  += EmulateRecognizeCompleted;
            _speechRecognitionEngine.LoadGrammarCompleted       += LoadGrammarCompleted;
            _speechRecognitionEngine.RecognizeCompleted         += RecognizeCompleted;
            _speechRecognitionEngine.RecognizerUpdateReached    += RecognizerUpdateReached;
            _speechRecognitionEngine.AudioLevelUpdated          += AudioLevelUpdated;
            _speechRecognitionEngine.AudioSignalProblemOccurred += AudioSignalProblemOccurred;

            _eventHub.InvokeAudioInputStateChangedEvent(Source.CommandAgent, _voiceListenerWorking ? ListeningAudioState.NotListening : ListeningAudioState.MicrophoneMuted);
        }
Example #5
0
 public GitRebaseCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, IGitBusiness gitBusiness)
     : base(settingAgent, "Rebase", new[] { "rebase" })
 {
     _repositoryBusiness = repositoryBusiness;
     _talkAgent          = talkAgent;
     _gitBusiness        = gitBusiness;
 }
Example #6
0
 public GitStashCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, IGitBusiness gitBusiness, IQuestionAgent questionAgent)
     : base(settingAgent, "Stash", new[] { "stash", "stash save", "save stash", "save to stash" })
 {
     _repositoryBusiness = repositoryBusiness;
     _talkAgent          = talkAgent;
     _gitBusiness        = gitBusiness;
     _questionAgent      = questionAgent;
 }
Example #7
0
 public GitStashPopCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, IGitBusiness gitBusiness, IQuestionAgent questionAgent)
     : base(settingAgent, "Pop", new[] { "stash pop", "pop", "pop the stash", "pop stash" })
 {
     _repositoryBusiness = repositoryBusiness;
     _talkAgent          = talkAgent;
     _gitBusiness        = gitBusiness;
     _questionAgent      = questionAgent;
 }
Example #8
0
 public GitResetHardCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, IGitBusiness gitBusiness, IQuestionAgent questionAgent)
     : base(settingAgent, "Reset", new[] { "reset hard", "hard reset" })
 {
     _repositoryBusiness = repositoryBusiness;
     _talkAgent          = talkAgent;
     _gitBusiness        = gitBusiness;
     _questionAgent      = questionAgent;
 }
Example #9
0
 public GitPullCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, IGitBusiness gitBusiness, IQuestionAgent questionAgent)
     : base(settingAgent, "pull", new[] { "pull" })
 {
     _repositoryBusiness = repositoryBusiness;
     _talkAgent          = talkAgent;
     _gitBusiness        = gitBusiness;
     _questionAgent      = questionAgent;
 }
Example #10
0
 public GitCommitCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, IGitBusiness gitBusiness, IQuestionAgent questionAgent)
     : base(settingAgent, "Commit", new[] { "commit", "stage and commit", "stage commit", "amend" })
 {
     _repositoryBusiness = repositoryBusiness;
     _talkAgent          = talkAgent;
     _gitBusiness        = gitBusiness;
     _questionAgent      = questionAgent;
 }
Example #11
0
        public GitSelectCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent)
            : base(settingAgent, "Select", new string[] { })
        {
            _repositoryBusiness = repositoryBusiness;
            _talkAgent          = talkAgent;

            var repos = settingAgent.GetSettings <string>("Repositories");

            foreach (var repo in repos)
            {
                var rawPhrases = GetRawList();
                AddPhrases(repo.Key, rawPhrases.Select(x => x.Replace("{RepositoryName}", repo.Key)).ToArray());
            }

            repositoryBusiness.RepositoryAddedEvent += RepositoryBusiness_RepositoryAddedEvent;
        }
Example #12
0
        protected GitBitchCommand(ISettingAgent settingAgent, string name, string[] phrases = null)
        {
            _settingAgent = settingAgent;
            _name         = name;
            var greetingName    = settingAgent.GetSetting(Constants.Greeting, Constants.DefaultGreeting);
            var requireGreeting = settingAgent.GetSetting(Constants.RequireGreeting, false);

            _greeting = new Tuple <string, bool>(greetingName, requireGreeting);

            var bitchName        = settingAgent.GetSetting(Constants.BitchName, Constants.DefaultBitchName);
            var requireBitchName = settingAgent.GetSetting(Constants.RequireBitchName, true);

            _bitchName = new Tuple <string, bool>(bitchName, requireBitchName);

            AddPhrases(string.Empty, phrases ?? new string[] { });
        }
Example #13
0
 public QuestionAgent(ITalkAgent talkAgent, ISettingAgent settingAgent, IEventHub eventHub)
 {
     _talkAgent    = talkAgent;
     _settingAgent = settingAgent;
     _eventHub     = eventHub;
 }
Example #14
0
 public GitScanCommand(ISettingAgent settingAgent, IGitRepoAgent gitRepoAgent)
     : base(settingAgent, "Scan", new[] { "scan" })
 {
     _gitRepoAgent = gitRepoAgent;
 }
Example #15
0
 public TalkAgent(ISettingAgent settingAgent, IEventHub eventHub)
 {
     _settingAgent = settingAgent;
     _eventHub     = eventHub;
 }
Example #16
0
 public ChangeNameCommand(ISettingAgent settingAgent, ITalkAgent talkAgent)
     : base(settingAgent, "Change name", new[] { "change name" })
 {
     _talkAgent = talkAgent;
 }
Example #17
0
 public CloseCommand(ISettingAgent settingAgent, IQuestionAgent questionAgent, ITalkAgent talkAgent)
     : base(settingAgent, "Close", new[] { "close", "exit", "quit", "bye", "goodbye", "stop" })
 {
     _questionAgent = questionAgent;
     _talkAgent     = talkAgent;
 }
Example #18
0
 public LockMachineCommand(ISettingAgent settingAgent)
     : base(settingAgent, "Lock", new[] { "lock machine" })
 {
 }
Example #19
0
 public AutoStartCommand(ISettingAgent settingAgent, IQuestionAgent questionAgent, ITalkAgent talkAgent)
     : base(settingAgent, "Autostart", new[] { "enable autostart", "disable autostart", "autostart on", "autostart off", "autostart" })
 {
     _questionAgent = questionAgent;
     _talkAgent     = talkAgent;
 }
Example #20
0
 public GenericCommand(ISettingAgent settingAgent, string name, string[] phrases, Action action)
     : base(settingAgent, name, phrases)
 {
     _action = action;
 }
Example #21
0
 public GitListCommand(ISettingAgent settingAgent, ITalkAgent talkAgent)
     : base(settingAgent, "List", new[] { "list repos", "list repositories", "what repositories are there" })
 {
     _talkAgent = talkAgent;
 }
Example #22
0
 public HelpCommand(ISettingAgent settingAgent, ITalkAgent talkAgent, ICommandAgent commandAgent)
     : base(settingAgent, "Help", new[] { "help" })
 {
     _talkAgent    = talkAgent;
     _commandAgent = commandAgent;
 }
Example #23
0
 public RepositoryBusines(IDataRepository dataRepository, ISettingAgent settingAgent)
 {
     _dataRepository         = dataRepository;
     _settingAgent           = settingAgent;
     _selectedRepositoryName = _settingAgent.GetSetting <string>("LastSelected", null);
 }
Example #24
0
        public static async Task <string> GetSelectedPathAsync(IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, ISettingAgent settingAgent)
        {
            var gitRepoPath = repositoryBusiness.GetSelectedPath();

            if (string.IsNullOrEmpty(gitRepoPath))
            {
                var repos = settingAgent.GetSettings <string>("Repositories");
                if (!repos.Any())
                {
                    await talkAgent.SayAsync("You need to open a repository before you can ask for status.");
                }
                else
                {
                    await talkAgent.SayAsync("You need to select a repository before you can ask for status.");
                }
            }

            return(gitRepoPath);
        }