예제 #1
0
		private void SetupCommandManager()
		{
			cxAuto = new PfAuto(engine);
			cxFind = new PfFind(engine);
			cxRemember = new PfRemember(engine);
			cxShutdown = new PfShutdown(engine);
			cxSleep = new PfSleep(engine);

			commandManager = new CommandManager();
			commandManager.CommandExecuters.Add(cxAuto);
			commandManager.CommandExecuters.Add(cxFind);
			commandManager.CommandExecuters.Add(cxRemember);
			commandManager.CommandExecuters.Add(cxShutdown);
			commandManager.CommandExecuters.Add(cxSleep);
		}
예제 #2
0
        /// <summary>
        ///  Initializes a new instance of FrmSocketSpeech
        /// </summary>
        public FrmSocketSpeech()
        {
            x64 = IntPtr.Size == 8;
            InitializeComponent();
            //if (x64 && Loq7SpeechGenerator.LoquendoInstalled)
            //if (Loq7SpeechGenerator.LoquendoInstalled)
            //	spGen = new Loq7SpeechGenerator();
            //else
            spGen = new SapiSpeechGenerator();
            spGen.SpeakStarted   += new SpeakStartedEventHandler(spGen_SpeakStarted);
            spGen.SpeakCompleted += new SpeakCompletedEventHandler(spGen_SpeakCompleted);
            spGen.VoiceChanged   += new VoiceChangedEventHandler(spGen_VoiceChanged);
            spGen.SpeakProgress  += new SpeakProgressEventHandler(spGen_SpeakProgress);

            //if(!x64)
            audioPlayer = new AudioPlayer32();
            //else
            //	audioPlayer = new AudioPlayer64();

            TcpPortIn        = 2052;
            TcpPortOut       = 2052;
            TcpServerAddress = System.Net.IPAddress.Parse("127.0.0.1");

            commandManager = new PacItoCommandManager();
            commandManager.SharedVariablesLoaded += new SharedVariablesLoadedEventHandler(commandManager_SharedVariablesLoaded);
            commandManager.Started               += new CommandManagerStatusChangedEventHandler(commandManager_Started);
            commandManager.Stopped               += new CommandManagerStatusChangedEventHandler(commandManager_Stopped);
            connectionManager                     = new ConnectionManager(2052, commandManager);
            connectionManager.ClientConnected    += new TcpClientConnectedEventHandler(connectionManager_ClientConnected);
            connectionManager.ClientDisconnected += new TcpClientDisconnectedEventHandler(connectionManager_ClientDisconnected);
            connectionManager.Connected          += new TcpClientConnectedEventHandler(connectionManager_Connected);
            //connectionManager.DataReceived += new ConnectionManagerDataReceivedEH(connectionManager_DataReceived);
            connectionManager.Disconnected += new TcpClientDisconnectedEventHandler(connectionManager_Disconnected);

            cexAread    = new SpgAreadCommandExecuter(spGen);
            cexAsay     = new SpgAsayCommandExecuter(spGen);
            cexRead     = new SpgReadCommandExecuter(spGen);
            cexSay      = new SpgSayCommandExecuter(spGen);
            cexShutUp   = new SpgShutUpCommandExecuter(spGen, audioPlayer);
            cexVoice    = new SpgVoiceCommandExecuter(spGen);
            cexAplay    = new SpgAplayCommandExecuter(audioPlayer);
            cexPlay     = new SpgPlayCommandExecuter(audioPlayer);
            cexPlayLoop = new SpgPlayLoopCommandExecuter(audioPlayer);

            cexReadCompatible = new SpgReadCommandExecuter("read", spGen);
            cexSayCompatible  = new SpgAsayCommandExecuter("say", spGen);

            commandManager.CommandExecuters.Add(cexAread);
            commandManager.CommandExecuters.Add(cexAsay);
            commandManager.CommandExecuters.Add(cexRead);
            commandManager.CommandExecuters.Add(cexSay);
            commandManager.CommandExecuters.Add(cexShutUp);
            commandManager.CommandExecuters.Add(cexVoice);
            commandManager.CommandExecuters.Add(cexAplay);
            commandManager.CommandExecuters.Add(cexPlay);
            commandManager.CommandExecuters.Add(cexPlayLoop);
            commandManager.CommandExecuters.Add(cexSayCompatible);
            commandManager.CommandExecuters.Add(cexReadCompatible);

            dlgConsole           = new StringEventHandler(Console);
            dlgUpdateVoiceCombo  = new VoidEventHandler(UpdateVoiceCombo);
            dlgSetTextboxText    = new SetTextboxTextCallback(SetTextboxText);
            dlgAppendTextboxText = new SetTextboxTextCallback(AppendTextboxText);
            dlgUpdatePB          = new DoubleEventHandler(UpdateProgressBar);

            AutoDisableSpRec = false;
        }