コード例 #1
0
        private async Task StepTask()
        {
            for (int i = 0; i < _profile.Steps.Count; i++)
            {
                var step = _profile.Steps[i];

                if (step.Finished)
                {
                    //This could occurr if we had an unsuccessful
                    //brew and we are trying to continue the process.
                    continue;
                }

                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                              () =>
                {
                    CurrentStep = step;

                    //Check if theres a step after this
                    if (_profile.Steps.Count > i + 1)
                    {
                        NextStep = _profile.Steps[i + 1];
                    }
                    else
                    {
                        NextStep = null;
                    }
                });

                await CurrentStep.RunTaskAsync(_cancelToken);

                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                              () =>
                {
                    OnPropertyChanged("PercentageCompleted");
                });
            }

            Stop();
        }