public Task <bool> MoveUpProfileAsync() { Debug.WriteLine("MoveUp start!"); if (!TryGetTargetProfile(out ProfileItem targetProfile)) { return(Task.FromResult(false)); } var oldPosition = targetProfile.Position; var newPosition = oldPosition - 1; if (newPosition < 0) { return(Task.FromResult(false)); } return(WorkAsync(targetProfile, x => _worker.SetProfilePositionAsync(x, newPosition))); }
public async Task <bool> MoveUpProfileAsync() { Debug.WriteLine("MoveUp start!"); var targetProfile = Profiles.FirstOrDefault(x => x.IsTarget); if (targetProfile == null) { return(false); } var oldPosition = targetProfile.Position; var newPosition = oldPosition - 1; if (newPosition < 0) { return(false); } return(await WorkAsync( x => _worker.SetProfilePositionAsync(x, newPosition), x => Profiles.Contains(x) && (x.Position < oldPosition), targetProfile)); }