private static Model.AsyncOperationInstance simulateWork(Model.AsyncOperationFinishedHandler finishedCallback) { var p = new Model.AsyncOperationInstance(true, finishedCallback); p.IsProgressIndeterminate = false; p.StatusDescription = "MainWindow_Title"; p.StatusOutput = "Output1234"; p.IsProgressIndeterminate = false; var timer = new System.Windows.Threading.DispatcherTimer(); timer.Tick += (sender, args) => { p.Progress += 20; if (p.Progress >= 100 || p.IsCancelRequested) { (sender as DispatcherTimer).Stop(); p.success(); } }; timer.Interval = new TimeSpan(0, 0, 1); timer.Start(); return(p); }
private static Model.AsyncOperationInstance simulateWork(Model.AsyncOperationFinishedHandler finishedCallback) { var p = new Model.AsyncOperationInstance(true,finishedCallback); p.IsProgressIndeterminate = false; p.StatusDescription = "MainWindow_Title"; p.StatusOutput = "Output1234"; p.IsProgressIndeterminate = false; var timer = new System.Windows.Threading.DispatcherTimer(); timer.Tick += (sender, args) => { p.Progress += 20; if (p.Progress >= 100 || p.IsCancelRequested) { (sender as DispatcherTimer).Stop(); p.success(); } }; timer.Interval = new TimeSpan(0, 0, 1); timer.Start(); return p; }