diff --git a/MP.SPEC/Components/FolderBrowser.razor b/MP.SPEC/Components/FolderBrowser.razor index 2aafaac3..bba9d046 100644 --- a/MP.SPEC/Components/FolderBrowser.razor +++ b/MP.SPEC/Components/FolderBrowser.razor @@ -8,7 +8,7 @@ - @if (ListFiles == null || ListFiles.Count == 0) + @if (ListRecords == null || ListRecords.Count == 0) { @@ -18,17 +18,18 @@ } else { - @foreach (var record in ListFiles) + @foreach (var record in ListRecords) { @record.Name - - + + @record.Extension @CalcSize(record.Length) } } - \ No newline at end of file + + \ No newline at end of file diff --git a/MP.SPEC/Components/FolderBrowser.razor.cs b/MP.SPEC/Components/FolderBrowser.razor.cs index 05eb2df4..1b1e52b7 100644 --- a/MP.SPEC/Components/FolderBrowser.razor.cs +++ b/MP.SPEC/Components/FolderBrowser.razor.cs @@ -41,6 +41,11 @@ namespace MP.SPEC.Components /// /// protected override void OnParametersSet() + { + ReloadData(); + } + + private void ReloadData() { // calcolo phisical path... string BasePathOdlReturn = ConfMan.GetValue("ServerConf:BasePathOdlReturn") ?? ConfMan.GetValue("OptConf:BasePathOdlReturn") ?? ""; @@ -50,17 +55,45 @@ namespace MP.SPEC.Components { // recupero come DirectoryInfo x avere tutte le informazioni su nome, tipo, size... DirectoryInfo dirInfo = new DirectoryInfo(PhysicalPath); - ListFiles = dirInfo.GetFiles().ToList(); + SearchRecords = dirInfo.GetFiles().ToList(); } + totalCount = SearchRecords.Count; + // filtro x display + ListRecords = SearchRecords + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); } + private int totalCount { get; set; } = 0; #endregion Protected Methods #region Private Properties - private List ListFiles { get; set; } = new List(); + private List ListRecords { get; set; } = new List(); + private List SearchRecords { get; set; } = new List(); private string PhysicalPath { get; set; } = ""; #endregion Private Properties + + private int currPage { get; set; } = 1; + + private bool isLoading { get; set; } = false; + + private int numRecord { get; set; } = 10; + protected async Task SetNumRec(int newNum) + { + numRecord = newNum; + currPage = 1; + ReloadData(); + await InvokeAsync(ReloadData); + } + + protected async Task SetPage(int newNum) + { + ReloadData(); + currPage = newNum; + await InvokeAsync(ReloadData); + } } } \ No newline at end of file diff --git a/MP.SPEC/Components/ListODL.razor b/MP.SPEC/Components/ListODL.razor index f6db2ba4..79b66d7c 100644 --- a/MP.SPEC/Components/ListODL.razor +++ b/MP.SPEC/Components/ListODL.razor @@ -68,7 +68,6 @@ else {
- @* *@
} } @@ -156,7 +155,7 @@ else
-