private void tbtn_ASR_Checked(object sender, RoutedEventArgs e) { ReleaseDUILite(); IsAuth = false; var callback = new DUILiteCallback(engine_callback); bw = new BackgroundWorker(); bw.DoWork += delegate { manager.DUILiteConfig(); string authConfig = JsonHelper.ToJson(manager.AuthConfig); DUILiteAuth(authConfig, callback, null); }; bw.RunWorkerAsync(); Thread thread = new Thread(() => { while (!IsAuth) { Thread.Sleep(30); } this.Dispatcher.BeginInvoke((Action) delegate() { UpdateDUI(IsAuth); StartASR(); }); }); thread.Start(); }
public static extern void DUILiteAuth(string param, DUILiteCallback callback, string userdata);