public MainWindow() { this.InitializeComponent(); //for viewer animation effect animatedViewer = new AnimatedViewer(this); //for changing pages viewControlHelper = ViewControlHelper.Instance; VoiceControlHelper.Initialize(); //initailize voice control //for gesture control GestureControlHelper.Initialize(); //initailize gesture control backgroundWorker1 = new BackgroundWorker(); backgroundWorker1.WorkerReportsProgress = true; backgroundWorker1.WorkerSupportsCancellation = true; backgroundWorker1.DoWork += new DoWorkEventHandler(this.backgroundWorker1_DoWork); backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged); backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted); backgroundWorker1.RunWorkerAsync(); backgroundWorker2 = new BackgroundWorker(); backgroundWorker2.WorkerReportsProgress = true; backgroundWorker2.WorkerSupportsCancellation = true; backgroundWorker2.DoWork += new DoWorkEventHandler(this.backgroundWorker2_DoWork); backgroundWorker2.ProgressChanged += new ProgressChangedEventHandler(this.backgroundWorker2_ProgressChanged); backgroundWorker2.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.backgroundWorker2_RunWorkerCompleted); //backgroundWorker2 is after backgroundWorker1 hitResultsList = new List <DependencyObject>(); opennesThreadshold = 20; needDebouncing = false; hoveredButton = null; hoveredInkCanvas = null; debouncingTimer = null; inkCanvasMouseDown = false; bgwk1Running = false; //needed since backgroundWorker1.IsBusy is always true, might need further investigation bgwk2Running = false; //needed since backgroundWorker2.IsBusy is always true, might need further investigation }
private void backgroundWorker2_ProgressChanged(object sender, ProgressChangedEventArgs e) { VoiceControlHelper.detectedVoiceParams = ((MyVoiceParams)e.UserState); VoiceControlHelper.RunVoiceControl(); }