private void ProcessActionsQueue() { //if (!_body.IsReady) return; var _lock = "lock"; lock (_lock) { if (_actionsStackCount >= 1) { return; } if (!ActionsQueue.Any()) { PhoneState.SetStandByOn(); return; } if (PhoneState.IsStandByOn) { PhoneState.SetStandByOff(); Task.Delay(1000).Wait(); } var nextAction = ActionsQueue[0]; ExecuteOnMainThread(() => ActionsQueue.RemoveAt(0)).Wait(); if (nextAction != null) { _actionsStackCount++; ExecuteAction(nextAction).Wait(); ExecuteAction(new SavedAction("rest")).Wait(); _actionsStackCount--; } ProcessActionsQueue(); } }