예제 #1
0
        private void btn_change_url_Click(object sender, RoutedEventArgs e)
        {
            if (!_clientProxy.IsRecognizing)
            {
                string   url_new    = textbox_url.Text;
                string[] config_arr = url_new.Split('/');
                protocol     = config_arr[0];
                host         = config_arr[1];
                port         = config_arr[2];
                _clientProxy = new AsrtClientProxy(host, port, protocol);
                _clientProxy.SetRecorderDevice(0);
                _clientProxy.OnReceiveText += SpeechRecognizer_OnReceiveText;

                System.IO.File.WriteAllText(filename_conf, protocol + "\n" + host + "\n" + port);
            }
        }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();

            MessageBox.Visibility = Visibility.Collapsed;
            System.Threading.Thread.Sleep(1000); //延迟启动1秒,以便人们看清闪屏上的字

            if (System.IO.File.Exists(filename_conf))
            {
                string[] conf_lines = System.IO.File.ReadAllLines(filename_conf);
                protocol         = conf_lines[0];
                host             = conf_lines[1];
                port             = conf_lines[2];
                textbox_url.Text = protocol + "/" + host + "/" + port;
            }
            _clientProxy = new AsrtClientProxy(host, port, protocol);
            _clientProxy.SetRecorderDevice(0);
            _clientProxy.OnReceiveText += SpeechRecognizer_OnReceiveText;
            Console.WriteLine("MainWindow运行");
        }