void vm_ExperimentCompleted(object sender, ExperimentEventArgs e) { Action method = () => { System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer(System.Windows.Threading.DispatcherPriority.ApplicationIdle); timer.Interval = TimeSpan.FromMilliseconds(1000); timer.Tick += (o, s) => { e.Dispatcher.Dispose(); }; timer.Start(); }; this.Dispatcher.BeginInvoke(method, null); }
void OnExperimentCompleted(object sender, ExperimentEventArgs e) { if (ExperimentCompleted != null) ExperimentCompleted(this, e); }
void OnExperimentCompleted(object sender, ExperimentEventArgs e) { //update property BenchmarkExperiment completed using main gui dispatcher so //that it enables button immediately Application.Current.Dispatcher.Invoke( new Action(() => { BenchmarkExperimentCompleted = true; }) ); SelectedBenchmark.BenchmarkExperiment.ExperimentCompleted -= OnExperimentCompleted; }