/// <summary> /// Performs asynchronous search with the current criteria and populates the list. /// </summary> /// <param name="preserveSelection">A flag indicating whether or not to preserve selection.</param> /// <param name="token">Cancellation token.</param> /// <returns>True on success, false in case of errors.</returns> public virtual async Task <bool> SearchAsync(bool preserveSelection, CancellationToken token = default) { if (List == null) { return(false); } try { List.Validate(true); ErrorList msgList = List.GetValidationErrors(); msgList.AbortIfHasErrors(); var res = await List.ReadAsync(new DataObject.CrudOptions { PreserveSelection = preserveSelection }, token); msgList.MergeWith(res); Errors = msgList; return(!msgList.HasErrors()); } catch (Exception ex) { Errors = ErrorParser.FromException(ex); return(false); } }
/// <summary> /// Performs the search with the current criteria and populates the list /// </summary> /// <param name="preserveSelection">A flag indicating whether or not to preserve selection.</param> /// <returns>True on success, false in case of errors.</returns> public virtual bool Search(bool preserveSelection) { if (List == null) { return(false); } try { List.Validate(true); ErrorList msgList = List.GetValidationErrors(); msgList.AbortIfHasErrors(); msgList.MergeWith(List.Read(new DataObject.CrudOptions { PreserveSelection = preserveSelection })); Errors = msgList; return(!msgList.HasErrors()); } catch (Exception ex) { Errors = ErrorParser.FromException(ex); return(false); } }