I have implemented a loading dialog for several tasks that take various amounts of time to complete based on the query complexity and results. How can I close this dialog when a global variable IE: taskLoading
changes from true to false? if that is not possible, how can I call for a specific dialog to be closed when a task completes assuming it is open? I do not want to use a timer that may close before the task has completed. I do not want users interacting with the app while a task is loading.
This is my current code:
await DialogService.OpenAsync<LoadingDialog>($"LOADING...", null, new DialogOptions(){ CloseDialogOnEsc = false });
BuildEvidenceRequest($".\\SharefileAPI\\Deliverable_Templates\\EvidenceRequestTemplate.docx",$"{getFrameworksResult.Where(f => f.Id == evidencerequest.FrameworkId).FirstOrDefault().Framework1}",$"{evidencerequest.ClientName}",$"{evidencerequest.ClientWebsite}",$"{evidencerequest.ClientStreet}",$"{evidencerequest.ClientCity}",$"{evidencerequest.ClientState}",$"{evidencerequest.ClientZip}",$"{evidencerequest.POCFirstName}",$"{evidencerequest.POCLastName}",$"{evidencerequest.POCTitle}",$"{evidencerequest.POCEmail}",$"{evidencerequest.POCPhone}",$"{evidencerequest.AssessorFirstName}",$"{evidencerequest.AssessorLastName}",$"{evidencerequest.AssessorTitle}",$"{evidencerequest.AssessorEmail}",$"{evidencerequest.AssessorPhone}",$"{evidencerequest.AMFirstName}",$"{evidencerequest.AMLastName}",$"{evidencerequest.AMTitle}",$"{evidencerequest.AMEmail}",$"{evidencerequest.AMPhone}",$"{evidencerequest.Date.GetValueOrDefault().Date.ToShortDateString()}",$"{evidencerequest.Version}");
evidencerequest.IsPrinted = true;
evidencerequest.PrintDate = DateTime.Now;
var userDataUpdateEvidenceRequestResult = await UserData.UpdateEvidenceRequest(evidencerequest.Id, evidencerequest);
DialogService.Close(null);
I should also add that I want the tasks from the parent page/dialog to complete while the loading dialog is open. Currently, while the loading dialog is open, no tasks will complete which defeats the purpose.
Thanks!