using DialogOptions = AIStudio.Dialogs.DialogOptions; namespace AIStudio.Assistants.BeyondFactsLab; public partial class BeyondFactsLabAssistant { /// /// Opens the dialog with which the person shares the preparation shown with the research team of the lab. /// private Task ShareAsync() => this.ShowShareDialogAsync(false); /// /// Offers to share the preparation once the person confirmed the work state of the last step for the first time, /// as the lab is done then; confirming it again later asks no more. /// /// The ID of the preparation. private async Task OfferSharingAsync(Guid projectId) { try { var workState = await this.Store.LoadWorkStateAsync(projectId, BflStep.RESULTS); if (workState is not { LastRevision: 1, Confirmed: not null }) return; } catch (InvalidDataException exception) { this.Logger.LogWarning(exception, "Could not read the work state of the last step of a preparation in the BeyondFacts Lab."); return; } await this.ShowShareDialogAsync(true); } /// /// Shows the dialog with which the person shares the preparation shown. /// /// Whether the lab asks right after the last step, so that it thanks the person first. private async Task ShowShareDialogAsync(bool afterCompletion) { if (this.selectedProject?.Project is not { } project) return; var parameters = new DialogParameters { { dialog => dialog.ProjectId, project.ProjectId }, { dialog => dialog.AfterCompletion, afterCompletion }, }; await this.DialogService.ShowAsync(T("Share with the research team"), parameters, DialogOptions.FULLSCREEN); } }