Beispiel #1
0
        static void Main(string[] args)
        {
            wcfInstance = new DTMFServiceCtrl();
            host        = new ServiceHost(wcfInstance);
            host.Open();

            detector = new DTMFDetector();
            wcfInstance.onStopDetect  += wcfInstance_onStopDetect;
            wcfInstance.onStartDetect += wcfInstance_onStartDetect;


            detector.ToneDetected += detector_ToneDetected;
            detector.EndRecording += detector_EndRecording;
            detector.DetectSilence = false;

            detecting = false;
            try
            {
                interval = Convert.ToInt16(ConfigurationManager.AppSettings["service_address"]);
            }
            catch (Exception e)
            {
                interval = 1;
            }
            timer = new Timer(SelfNotification, null, 0, interval * 60000);

            Console.WriteLine("***DTMFServiceCtrl Started***");
            Console.WriteLine("***Press <ENTER> To EXIT***");
            Console.ReadKey();
        }
Beispiel #2
0
        public Service1()
        {
            InitializeComponent();
            detector = new DTMFDetector();

            wcfInstance = new DTMFServiceCtrl();
            wcfInstance.onStopDetect  += wcfInstance_onStopDetect;
            wcfInstance.onStartDetect += wcfInstance_onStartDetect;
            host = new ServiceHost(wcfInstance);

            detector.ToneDetected += detector_ToneDetected;
            detector.EndRecording += detector_EndRecording;
            detector.DetectSilence = false;

            detecting = false;
            try
            {
                interval = Convert.ToInt16(ConfigurationManager.AppSettings["service_address"]);
                var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                System.Configuration.AppSettingsSection section = config.AppSettings;
                detecting = Convert.ToBoolean(section.Settings["detecting"].Value);
            }
            catch (Exception e) {
                interval = 1;
            }
            if (detecting)
            {
                detector.StartDetect();
                wcfInstance.StartDetect();
            }
            timer = new Timer(SelfNotification, null, 0, interval * 60000);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var d = new DTMFDetector();

            d.ToneDetected += d_ToneDetected;
            d.StartDetect();
            Console.WriteLine("Press <Enter> to exit");
            ConsoleKeyInfo c;

            while ((c = Console.ReadKey()).Key != ConsoleKey.Enter)
            {
                Console.WriteLine("Press <Enter> to exit");
            }
        }