@@ -165,9 +165,9 @@ protected async Task SetActiveIndex(MudStep step)
165165 await ActiveStepChanged . InvokeAsync ( ) ;
166166 }
167167
168- protected async Task SetActiveIndex ( int count , bool firstCompleted = false )
168+ protected async Task SetActiveIndex ( int count , bool firstCompleted = false , bool skipPreventProcess = false )
169169 {
170- if ( PreventStepChange . Invoke ( ) == true )
170+ if ( skipPreventProcess == false && PreventStepChange != null && PreventStepChange . Invoke ( ) == true )
171171 {
172172 return ;
173173 }
@@ -210,33 +210,33 @@ protected async Task SetActiveIndex(int count, bool firstCompleted = false)
210210
211211 public async Task CompleteStep ( int index , bool moveToNextStep = true )
212212 {
213- if ( PreventStepChange . Invoke ( ) == true )
213+ if ( PreventStepChange != null && PreventStepChange . Invoke ( ) == true )
214214 {
215215 return ;
216216 }
217217
218218 Steps [ index ] . SetStatus ( StepStatus . Completed ) ;
219219 if ( IsAllStepsCompleted ( ) )
220220 {
221- await SetActiveIndex ( 1 , true ) ;
221+ await SetActiveIndex ( 1 , true , true ) ;
222222 }
223223 else if ( moveToNextStep )
224224 {
225- await SetActiveIndex ( 1 ) ;
225+ await SetActiveIndex ( 1 , skipPreventProcess : true ) ;
226226 }
227227 }
228228
229229 public async Task SkipStep ( int index , bool moveToNextStep = true )
230230 {
231- if ( PreventStepChange . Invoke ( ) == true )
231+ if ( PreventStepChange != null && PreventStepChange . Invoke ( ) == true )
232232 {
233233 return ;
234234 }
235235
236236 Steps [ index ] . SetStatus ( StepStatus . Skipped ) ;
237237 if ( moveToNextStep )
238238 {
239- await SetActiveIndex ( 1 ) ;
239+ await SetActiveIndex ( 1 , skipPreventProcess : true ) ;
240240 }
241241 }
242242
0 commit comments