private async Task InvokeActions() { try { while (!ActionList.Items.IsEmpty) { if (ActionList.Items[0] is ActionConfig action) { if (double.IsNaN(action.range1)) { await AsyncMethods.DriveAsync( action.v, action.w, TimeSpan.FromSeconds(action.range0), x => _windowContext.Progress = x, e => _windowContext.ErrorInfo = e.Message ).ConfigureAwait(true); } else { await AsyncMethods.DriveAsync( action.v, action.w, action.range0, action.range1, x => _windowContext.Progress = x, e => _windowContext.ErrorInfo = e.Message ).ConfigureAwait(true); } } else if (ActionList.Items[0] is RudderControlConfig rudderControl) { await AsyncMethods.AdjustRudderAsync( rudderControl.value, x => _windowContext.Progress = x, e => _windowContext.ErrorInfo = e.Message ).ConfigureAwait(true); } ActionList.Dispatch(it => { try { it.Items.RemoveAt(0); } catch (ArgumentOutOfRangeException) { } }); } } finally { task = null; } }