public AddPartPage(Page Owner, StringEventHandler Callback)
 {
     this.owner          = Owner;
     this.callback       = Callback;
     this.BindingContext = this;
     InitializeComponent();
 }
        public FrmTester()
        {
            InitializeComponent();
            log = new TextBoxStreamWriter(txtConsole);

            modules = new Dictionary<string, ConnectionManager>();
            autoResponders = new List<AutoResponder>();
            prompters = new List<Prompter>();
            dataReceived = new ProducerConsumer<ReceivedPacket>(100);
            receivedResponses = new List<Response>();
            quickCommands = new List<QuickCommand>();

            ValidateAddModuleButton();
            ValidateAddAutoResponderButton();
            ValidateAddPrompterButton();
            ValidateStartPerformanceTest();
            ValidateAddQuickCommandButton();
            SelectModule(null);
            SelectResponder(null);
            SelectPrompter(null);
            SelectQuickCommand(null);

            dlgConsole = new StringEventHandler(Console);
            dlgMainThreadTask = new ThreadStart(MainThreadTask);
            dlgGetPromptDialog = new GetPromptDialogCaller(GetPromptDialog);
            dlgShowPromptDialog = new ShowPromptDialogCaller(ShowPromptDialog);

            stopwatch = new Stopwatch();
            mainThread = new Thread(dlgMainThreadTask);
            mainThread.IsBackground = true;
            mainThread.Start();
        }
Exemple #3
0
        public FrmTester()
        {
            InitializeComponent();
            log = new TextBoxStreamWriter(txtConsole);

            modules           = new Dictionary <string, ConnectionManager>();
            autoResponders    = new List <AutoResponder>();
            prompters         = new List <Prompter>();
            dataReceived      = new ProducerConsumer <ReceivedPacket>(100);
            receivedResponses = new List <Response>();
            quickCommands     = new List <QuickCommand>();

            ValidateAddModuleButton();
            ValidateAddAutoResponderButton();
            ValidateAddPrompterButton();
            ValidateStartPerformanceTest();
            ValidateAddQuickCommandButton();
            SelectModule(null);
            SelectResponder(null);
            SelectPrompter(null);
            SelectQuickCommand(null);

            dlgConsole          = new StringEventHandler(Console);
            dlgMainThreadTask   = new ThreadStart(MainThreadTask);
            dlgGetPromptDialog  = new GetPromptDialogCaller(GetPromptDialog);
            dlgShowPromptDialog = new ShowPromptDialogCaller(ShowPromptDialog);

            stopwatch  = new Stopwatch();
            mainThread = new Thread(dlgMainThreadTask);
            mainThread.IsBackground = true;
            mainThread.Start();
        }
        public void Publishes_to_handler()
        {
            var aggregator = new Hub();

            var handler = new StringEventHandler();    
            aggregator.Subscribe(handler);

            var sent = aggregator.Publish(new StringEvent("Foo"));
            Assert.IsTrue(sent);
            Assert.IsTrue(handler.Handled);
        }
Exemple #5
0
        /// <summary>
        /// Server general de comunicaciones con ALUTRACK. Aqui se centralizan todas las conexiones y
        /// desconexiones.
        /// </summary>
        public LAYERLenel(Aplicacion v_app,StringEventHandler v_logHandler)
        {
            mainApp = v_app;
            m_LOGHandler = v_logHandler;
            //MapZONADEFCompletePath  = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + @"\MapZONEDEF.html";

            MapZONADEFCompletePath = Path.GetDirectoryName(Application.ExecutablePath) + @"\MapZONEDEF.html";
            MapLENELCompletePath = Path.GetDirectoryName(Application.ExecutablePath) + @"\MapLENEL.html";
            ComunicationLayer = new LAYERCommunication(v_app,v_logHandler);
            repositorioBuffer = new Dictionary<string,byte[]>();
        }
Exemple #6
0
        public void Same_instance_subscribed_twice()
        {
            var hub = new Hub();
            var h1  = new StringEventHandler();

            hub.Subscribe(h1);
            hub.Subscribe(h1);
            var result = hub.Publish(new StringEvent("value"));

            Assert.True(h1.Handled == 2);
            Assert.True(result);
        }
Exemple #7
0
        public void Same_instance_through_manifold()
        {
            var hub = new Hub();
            var h   = new StringEventHandler();

            hub.Subscribe((object)h);
            hub.Subscribe((object)h);
            var result = hub.Publish(new StringEvent("value"));

            Assert.Equal(2, h.Handled);
            Assert.True(result);
        }
Exemple #8
0
            // ============================================
            // PUBLIC Constructors
            // ============================================
            public CmdParser(PeerSocket peer, ArrayList xmlCmds)
            {
                // Initialize Events (None)
                Error = null;

                // Initialize Members
                this.xmlCmds = xmlCmds;
                this.peer    = peer;

                // Start Command Parser Thread
                this.thread = new Thread(new ThreadStart(ParseXml));
                this.thread.Start();
            }
            // ============================================
            // PUBLIC Constructors
            // ============================================
            public CmdParser(PeerSocket peer, ArrayList xmlCmds)
            {
                // Initialize Events (None)
                Error = null;

                // Initialize Members
                this.xmlCmds = xmlCmds;
                this.peer = peer;

                // Start Command Parser Thread
                this.thread = new Thread(new ThreadStart(ParseXml));
                this.thread.Start();
            }
Exemple #10
0
        public void Publishes_to_handler()
        {
            var aggregator = new Hub();

            var handler = new StringEventHandler();

            aggregator.Subscribe(handler);

            var sent = aggregator.Publish(new StringEvent("Foo"));

            Assert.True(sent);
            Assert.Equal(1, handler.Handled);
        }
Exemple #11
0
        public void Two_identical_handlers()
        {
            var hub = new Hub();
            var h1  = new StringEventHandler();
            var h2  = new StringEventHandler();

            hub.Subscribe(h1);
            hub.Subscribe(h2);
            var result = hub.Publish(new StringEvent("value"));

            Assert.True(h1.Handled == 1);
            Assert.True(h2.Handled == 1);
            Assert.True(result);
        }
Exemple #12
0
        public void Two_handlers_for_the_same_event_type()
        {
            var hub = new Hub();
            var h1  = new StringEventHandler();
            var h2  = new StringEventHandler2();

            hub.Subscribe(h1);
            hub.Subscribe(h2);
            var result = hub.Publish(new StringEvent("value"));

            Assert.True(h1.Handled == 1);
            Assert.True(h2.Handled == 1);
            Assert.True(result);
        }
Exemple #13
0
        /// <summary>
        /// Inicializo las estructuras de datos que se llenarán en RAM con el loadData
        /// Y las variables de configuracion usando la clase SystemConfiguration
        /// </summary>
        public dataManager(Aplicacion v_app, StringEventHandler v_logHandler)
        {
            conexion = "Data Source=" + SystemConfiguration.DataSource + "; Initial Catalog=" + SystemConfiguration.DataBaseName + "; User ID=" + SystemConfiguration.DBUserName+";password="+SystemConfiguration.DBPassword;

            mainApp = v_app;
            m_LOGHandler = v_logHandler;
            //XMLDataPath = v_XMLPath;
            //imagePath = v_imagePath;

            reglasAcceso = new Dictionary<string, KeyValuePair<string, string>>();

            camposLenelCamposSistema = new Dictionary<string, string>();

            listaTarjetas = null;
            listaEmpleados = null;

            ultimasPosGPS = new Dictionary<string, string>();
        }
        /// <summary>
        /// Initializes a new instance of the TextBoxStreamWriter class
        /// </summary>
        /// <param name="output">The TextBox object to dump the contents to</param>
        /// <param name="logFile">The path of the file to which dump the contents to</param>
        /// <param name="maxLines">The maximum number of lines the output TextBox object will display</param>
        public TextBoxStreamWriterBase(TextBox output, string logFile, int maxLines)
        {
            this.maxLines = maxLines;
            if (output != null)
            {
                this.output             = output;
                output.Disposed        += new EventHandler(output_Disposed);
                output.HandleDestroyed += new EventHandler(output_HandleDestroyed);
                output.HandleCreated   += new EventHandler(output_HandleCreated);
            }
            pending        = new ProducerConsumer <StringToken>(100);
            waitingHadle   = new StringBuilder(1024);
            AppendStringEH = new StringEventHandler(AppendString);
            OpenLogFileStream(logFile, out this.logFile);

            appendDate = false;
            this.verbosityThreshold = 5;
            this.defaultPriority    = 5;
            this.disposed           = false;
            this.disposing          = false;
            SetupThread();
        }
Exemple #15
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;
        }
 public LAYERCommunication(Aplicacion v_app, StringEventHandler v_logHandler)
 {
     mainApp = v_app;
     m_LOGHandler = v_logHandler;
 }
        public void Receive(StringEventHandler callback,
							 ExceptionEventHandler exCallback,
							 string split)
        {
            Debug.Assert(split != null);
            Debug.Assert(callback != null);
            Debug.Assert(exCallback != null);

            this.callback = callback;
            this.exCallback = exCallback;
            this.split = Regex.Escape(split);
            this.doSplit = true;

            Receive();
        }
 /// <summary>
 /// Server general de comunicaciones con ALUTRACK. Aqui se centralizan todas las conexiones y
 /// desconexiones.
 /// </summary>
 public LAYERAlutrack(Aplicacion v_app,StringEventHandler v_logHandler)
 {
     mainApp = v_app;
     m_LOGHandler = v_logHandler;
     repositorioBuffer = new Dictionary<string,byte[]>();
     ComunicationLayer = new LAYERCommunication(v_app,v_logHandler);
 }    
        // ===================================
        // PUBLIC Methods
        // ===================================
        public void Receive(StringEventHandler callback,
							 ExceptionEventHandler exCallback)
        {
            Debug.Assert(callback != null);
            Debug.Assert(exCallback != null);

            this.callback = callback;
            this.exCallback = exCallback;
            this.doSplit = false;

            Receive();
        }
Exemple #20
0
        public FrmSpRec()
        {
            InitializeComponent();
            this.Icon = Properties.Resources.MicRed;

            dlgSpeechHypothesized            = new SpeechRecognizedEH(reco_SpeechHypothesized);
            dlgSpeechRecognitionRejected     = new SpeechRecognizedEH(reco_SpeechRecognitionRejected);
            dlgSpeechRecognized              = new SpeechRecognizedEH(reco_SpeechRecognized);
            dlgFileSpeechHypothesized        = new FileSpeechRecognizedEH(reco_FileSpeechHypothesized);
            dlgFileSpeechRecognitionRejected = new FileSpeechRecognizedEH(reco_FileSpeechRecognitionRejected);
            dlgFileSpeechRecognized          = new FileSpeechRecognizedEH(reco_FileSpeechRecognized);
            dlgAudioLevelChanged             = new AudioLevelChangedEH(reco_AudioLevelChanged);
            dlgGrammarLoaded = new SpeechRecognizedStatusChangedEH(reco_GrammarLoaded);
            dlgLoadGrammar   = new LoadGrammarCaller(LoadGrammar);

            if (System.Environment.OSVersion.Version.Major < 6)
            {
                reco = new SpeechRecognizer51();
                if (!System.IO.File.Exists(Application.StartupPath + "\\Interop.SpeechLib.dll"))
                {
                    MessageBox.Show("Could not find Interop.SpeechLib.dll\r\npplication will exit", "SP-REC", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                    return;
                }
            }
            else
            {
                reco = new SpeechRecognizer53();
                ((SpeechRecognizer53)reco).FileSpeechHypothesized        += dlgFileSpeechHypothesized;
                ((SpeechRecognizer53)reco).FileSpeechRecognitionRejected += dlgFileSpeechRecognitionRejected;
                ((SpeechRecognizer53)reco).FileSpeechRecognized          += dlgFileSpeechRecognized;
            }
            reco.SpeechRecognized          += dlgSpeechRecognized;
            reco.SpeechRecognitionRejected += dlgSpeechRecognitionRejected;
            reco.SpeechHypothesized        += dlgSpeechHypothesized;
            reco.GrammarLoaded             += dlgGrammarLoaded;
            reco.StatusChanged             += new SpeechRecognizedStatusChangedEH(reco_StatusChanged);
            reco.AudioLevelChanged         += dlgAudioLevelChanged;

            string[] profiles = reco.Profiles;
            foreach (string profileName in profiles)
            {
                cmbProfiles.Items.Add(profileName);
            }
            cmbProfiles.SelectedItem         = reco.SelectedProfile;
            volumeTreshold                   = 0;
            currentRecognitionMaxVolumeLevel = 0;
            expectedPhraseList               = new List <ExpectedPhrase>();
            updateConsoleEH                  = new StringEventHandler(Console);

            cmdMan = new CommandManager();
            cnnMan = new ConnectionManager(MODULE_NAME, 2020, cmdMan);

            cnnMan.ClientConnected    += new TcpClientConnectedEventHandler(cnnMan_ClientConnected);
            cnnMan.ClientDisconnected += new TcpClientDisconnectedEventHandler(cnnMan_ClientDisconnected);
            cnnMan.Connected          += new TcpClientConnectedEventHandler(cnnMan_Connected);
            cnnMan.Disconnected       += new TcpClientDisconnectedEventHandler(cnnMan_Disconnected);
            cnnMan.DataReceived       += new ConnectionManagerDataReceivedEH(cnnMan_DataReceived);

            cmdMan.SharedVariablesLoaded += new SharedVariablesLoadedEventHandler(cmdMan_SharedVariablesLoaded);
            cmdMan.CommandExecuters.Add(new GrammarCommandExecuter(reco));
            cmdMan.CommandExecuters.Add(new StatusCommandExecuter(reco));
            cmdMan.CommandExecuters.Add(new Rec_EnaCommandExecuter(reco));
            cmdMan.CommandExecuters.Add(new WordsCommandExecuter(reco));
            cmdMan.CommandExecuters.Add(new FreeDictationCommandExecuter(reco));
            cmdMan.CommandExecuters.Add(new AudioFileCommandExecuter(reco));
            cmdMan.CommandExecuters.Add(new MaxAlternatesCommandExecuter(reco));
            cmdMan.CommandExecuters.Add(new AutoSaveCommandExecuter(reco));

            ControlsEnabled         = false;
            nudVolumeTreshold.Value = volumeTreshold;

            InitializeSapi53Components();
        }
		private void SetupEventHandlers()
		{
			this.FormClosing += new FormClosingEventHandler(FrmRecoHuman_FormClosing);

			dlgUpdateControlCameras = new VoidEventHandler(UpdateControlCameras);
			dlgListCameras = new VoidEventHandler(ListCameras);
			dlgUpdateSettings = new VoidEventHandler(UpdateSettings);
			dlgUpdateVideoControls = new VoidEventHandler(UpdateVideoControls);
			dlgRecognitionResultUpdate = new VideoControlUpdateEH(RecognitionResultUpdate);
			dlgRecognitionResultUpdate2 = new VideoControlUpdate2EH(RecognitionResultUpdate);
			dlgRecognitionResultUpdate3 = new VideoControlUpdate3EH(RecognitionResultUpdate);
			dlgRecognitionResultUpdate4 = new VideoControlUpdate4EH(RecognitionResultUpdate);
			dlgShowRecognitionResults = new ShowRecognitionResultsEH(ShowRecognitionResults);
			dlgShowDetectionResults = new ShowDetectionResultsEH(ShowDetectionResults);
			dlgUpdateKnownFacesPanel = new VoidEventHandler(UpdateKnownFacesPanel);
			dlgShowVLComponentsStatus = new VoidEventHandler(ShowVLComponentsStatus);
			dlgCloseRequest = new VoidEventHandler(CloseRequest);
			updateConsoleEH = new StringEventHandler(Console);
		}