// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        public void init()
        {
            ui.log("Recognizer.init()");

            commandHandler = ui.commandHandler;
            grammarHandler = ui.grammarHandler;
            grammarHandler.init();

            // Setup speech recognition engine
            sre = setupSpeechRecognitionEngine();
            sre.MaxAlternates      = 0;
            sre.AudioLevelUpdated += new EventHandler <AudioLevelUpdatedEventArgs>(audioLevelHandler);
            sre.SpeechRecognized  += new EventHandler <SpeechRecognizedEventArgs>(speechRecognititionHandler);



            //setupGrammarAndCommands();

            sre.AudioLevelUpdated += new EventHandler <AudioLevelUpdatedEventArgs>(audioLevelHandler);
        }
        //public globalKeyboardHook gkh;


        public UIForm1()
        {
            InitializeComponent();

            /*
             * formNewCommand = new FormNewCommand(this);
             * formClipboard = new FormClipboard(this);
             * formKey = new FormKey(this);
             * formAutoType = new FormAutoType(this);
             * formApplication = new FormApplication(this);
             */

            formManager = new FormManager(this);

            profileHandler = new ProfileHandler(this);
            windowHandler  = new WindowHandler(this);
            commandHandler = new CommandHandler(this);
            recognizer     = new Recognizer(this);
            grammarHandler = new GrammarHandler(this);

            recognizer.init();

            /*
             * process flow
             * 1. Recognizer
             * 2. Command Handler lookup
             *
             * 1. Form1 Load profile
             * 2. Command handler parse xml
             * 3. GrammarHandler process commands
             */

            //cbProfiles.SelectedIndexChanged  += new System.EventHandler(profileSelectionChangeHandler);



            loadProfile("default");
        }