protected override async Task OnInitializedAsync() { _folders = await FolderService.GetFoldersAsync(ModuleState.SiteId); if (PageState.QueryString.ContainsKey("id")) { _folderId = int.Parse(PageState.QueryString["id"]); } }
} = false; // optional - enable multiple file uploads - default false protected override async Task OnInitializedAsync() { if (!string.IsNullOrEmpty(Id)) { _id = Id; } if (!string.IsNullOrEmpty(Folder)) { _folders = new List <Folder> { new Folder { FolderId = -1, Name = Folder } }; FolderId = -1; } else { _folders = await FolderService.GetFoldersAsync(ModuleState.SiteId); } if (FileId != -1) { File file = await FileService.GetFileAsync(FileId); if (file != null) { FolderId = file.FolderId; } else { FileId = -1; // file does not exist } } await SetImage(); if (!string.IsNullOrEmpty(Filter)) { _filter = "." + Filter.Replace(",", ",."); } await GetFiles(); // create unique id for component _guid = Guid.NewGuid().ToString("N"); _fileinputid = _guid + "FileInput"; _progressinfoid = _guid + "ProgressInfo"; _progressbarid = _guid + "ProgressBar"; }
protected override async Task OnParametersSetAsync() { try { _folders = await FolderService.GetFoldersAsync(PageState.Site.SiteId); if (_folderId == -1 && _folders.Count > 0) { _folderId = _folders[0].FolderId; await GetFiles(); } } catch (Exception ex) { await logger.LogError(ex, "Error Loading Files {Error}", ex.Message); AddModuleMessage("Error Loading Files", MessageType.Error); } }
protected override async Task OnInitializedAsync() { try { _folders = await FolderService.GetFoldersAsync(PageState.Site.SiteId); if (PageState.QueryString.ContainsKey("id")) { _folderId = Int32.Parse(PageState.QueryString["id"]); Folder folder = await FolderService.GetFolderAsync(_folderId); if (folder != null) { _parentId = folder.ParentId ?? -1; _name = folder.Name; _isSystem = folder.IsSystem; _permissions = folder.Permissions; _createdBy = folder.CreatedBy; _createdOn = folder.CreatedOn; _modifiedBy = folder.ModifiedBy; _modifiedOn = folder.ModifiedOn; } } else { _parentId = _folders[0].FolderId; _permissions = string.Empty; } } catch (Exception ex) { await logger.LogError(ex, "Error Loading Folder {FolderId} {Error}", _folderId, ex.Message); AddModuleMessage("Error Loading Folder", MessageType.Error); } }