@using Microsoft.AspNetCore.Components.Routing @using ModelsLib @using MudBlazor @inject NavigationManager Navigation @rendermode InteractiveServer @inject IWebHostEnvironment Env @inject PhotoService ShootingDb @inject IDialogService DialogService Photo Sharing Helrira Projets Contact Rechercher Photo Sharing Helrira Projets Contact @code { private string Id { get; set; } = ""; private bool _drawerOpen = false; private async Task OpenSearchDialogAsync() { try { var parameters = new DialogParameters(); parameters.Add("OnSearch", EventCallback.Factory.Create(this, SendSelectionMobil)); var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; var dialogRef = await DialogService.ShowAsync("", parameters, options); var result = await dialogRef.Result; if (!result.Canceled) { Console.WriteLine("Résultat : " + result.Data); } } catch (Exception ex) { Console.WriteLine("ERREUR DIALOG : " + ex.Message); Console.WriteLine(ex.StackTrace); } } void ToggleDrawer() => _drawerOpen = !_drawerOpen; /// /// a la validation de la saisie /// private async void SendSelectionMobil(string value) { Id = value; //si une saisie est faite dans le champs SendSelection(); } /// /// a la validation de la saisie /// private async void SendSelection() { //si une saisie est faite dans le champs if (!string.IsNullOrWhiteSpace(Id)) { string idSaisie = Id.ToLower().Trim();//passage en full minuscule + suppression espace var path = Path.Combine(Env.WebRootPath, "Photos", idSaisie); bool dossierExiste = Directory.Exists(path);//verification de présence du dossier if (dossierExiste) { ShootingData datas = ShootingDb.GetInfosShooting(idSaisie); if (datas == null) { await ShootingDb.AddShootingInfoPerDefault(idSaisie); } else { if (datas.IsPhotosSelected) { Navigation.NavigateTo($"/Share?Id={idSaisie}");//redirection vers le shooting post retouche } else { Navigation.NavigateTo($"/PhotoSelect?Id={idSaisie}");//redirection vers le shooting à selectionné } } } else { Navigation.NavigateTo($"/PhotoSelectError");//redirection vers page d'erreur } } } }