public virtual async Task RunTaskAsync(CancellationToken cancelToken) { var timer = new BrewTimer(); timer.Start(ElapsedSeconds); while (!Finished) { if (SubSteps.Any()) { var step = SubSteps.FirstOrDefault(s => ElapsedSeconds >= (s.LengthMinutes * 60) && !s.Finished); if (step != null) { step.RunTaskAsync(cancelToken); Debug.WriteLine($"Sub step completed at {step.LengthMinutes} minutes"); } } await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { //Gather information on how long the step takes ElapsedSeconds = timer.ElapsedSeconds; ElapsedMinutes = timer.ElapsedMinutes; }); await Task.Delay(100); } }
protected override Task <bool> IsApplicableImplAsync(IUpgradeContext context, CancellationToken token) { var result = context?.CurrentProject is not null && SubSteps.Any() && _configFilePaths.Select(p => Path.Combine(context.CurrentProject.FileInfo.DirectoryName, p)).Any(f => File.Exists(f)); return(Task.FromResult(result)); }