|
@@ -10,10 +10,16 @@
|
|
|
private bool isSearching = false;
|
|
|
private ProgressBar searchProgressBar;
|
|
|
|
|
|
- private string resultText;
|
|
|
- private IGrouping<FeDisc, FeTrack>[] resultEntries;
|
|
|
+ private static string resultText;
|
|
|
+ private static IGrouping<FeDisc, FeTrack>[] resultEntries;
|
|
|
+
|
|
|
+ private DiscDialog dlgDisc;
|
|
|
+ private PlaylistAddDialog dlgPlaylistAdd;
|
|
|
}
|
|
|
|
|
|
+<DiscDialog @ref="dlgDisc" Disc="CurrentDisc"></DiscDialog>
|
|
|
+<PlaylistAddDialog @ref="dlgPlaylistAdd"></PlaylistAddDialog>
|
|
|
+
|
|
|
<div class="row">
|
|
|
<div class="col-12">
|
|
|
<fieldset class="border rounded-3 p-2">
|
|
@@ -26,11 +32,11 @@
|
|
|
Value="@searchExpression"
|
|
|
ValueExpression="@(()=>searchExpression)"
|
|
|
@oninput="SearchChanged"
|
|
|
- onsearch="@SearchDone">
|
|
|
+ onsearch="@SearchGo">
|
|
|
</InputText>
|
|
|
<label>Search expression</label>
|
|
|
</div>
|
|
|
- <button @onclick="@SearchDone" class="btn btn-outline-primary" type="button">Search</button>
|
|
|
+ <button @onclick="@SearchGo" class="btn btn-outline-primary" type="button">Search</button>
|
|
|
</div>
|
|
|
<div class="row mt-3">
|
|
|
<label for="staticEmail" class="col-sm-2 col-form-label">Track set</label>
|
|
@@ -60,12 +66,12 @@
|
|
|
</InputRadioGroup>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="row mt-3">
|
|
|
- <label for="staticEmail" class="col-sm-2 col-form-label">Debug</label>
|
|
|
- <div class="col-sm-10">
|
|
|
- <button @onclick="()=>isSearching=true">Show progressbar</button>
|
|
|
- </div>
|
|
|
+ @*<div class="row mt-3">
|
|
|
+ <label for="staticEmail" class="col-sm-2 col-form-label">Debug</label>
|
|
|
+ <div class="col-sm-10">
|
|
|
+ <button class="btn btn-primary" @onclick="()=>isSearching=true">Show progressbar</button>
|
|
|
</div>
|
|
|
+ </div>*@
|
|
|
</fieldset>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -88,20 +94,48 @@
|
|
|
<legend class="float-none w-auto px-2 d-flex flex-row align-items-center">
|
|
|
<span>Result</span>
|
|
|
</legend>
|
|
|
- <span>@resultText</span>
|
|
|
+
|
|
|
+ <div class="mb-3 text-center">@resultText</div>
|
|
|
+
|
|
|
@if (resultEntries?.Length > 0)
|
|
|
{
|
|
|
foreach (var item in resultEntries)
|
|
|
{
|
|
|
var disc = item.Key;
|
|
|
|
|
|
- <div>
|
|
|
- @item.Key.Name
|
|
|
- @foreach (var tr in item)
|
|
|
- {
|
|
|
- <div> @tr.Name </div>
|
|
|
- }
|
|
|
- </div>
|
|
|
+ <table class="table w-100">
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td><img src="@disc.CoverPath" style="height:50px" /></td>
|
|
|
+ <td colspan="4" class="w-100">@item.Key.Name</td>
|
|
|
+ <td colspan="2" class="text-end">
|
|
|
+ <button class="btn btn-primary" @onclick="()=>dlgDisc.Show(disc)">
|
|
|
+ <i class="bi bi-window-stack"></i>
|
|
|
+ </button>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+
|
|
|
+ @foreach (var tr in item.OrderBy(p => p.Name))
|
|
|
+ {
|
|
|
+ <tr>
|
|
|
+ <td></td>
|
|
|
+ <td><FileIcon FileName="@tr.Key"></FileIcon></td>
|
|
|
+ <td class="w-100">
|
|
|
+ <a href="@tr.Path" target="@FnzConst.PlayPageTarget">
|
|
|
+ <HighLightKeyword Text="@tr.GetTitleOrFilename()" Keywords="@(new []{ searchExpression})"></HighLightKeyword>
|
|
|
+ </a>
|
|
|
+ </td>
|
|
|
+ <td>@tr.Tag.Duration.SecondToDur()</td>
|
|
|
+ <td>@tr.Tag.Length.BytesToFileSize()</td>
|
|
|
+ <td class="text-center">
|
|
|
+ <button type="button" class="btn btn-link" style="padding:0.1rem" @onclick="()=>dlgPlaylistAdd.Show(tr)">
|
|
|
+ <i class="bi bi-folder-plus"></i>
|
|
|
+ </button>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ }
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
}
|
|
|
}
|
|
|
</fieldset>
|
|
@@ -109,21 +143,23 @@
|
|
|
</div>
|
|
|
|
|
|
@code {
|
|
|
- private async Task SearchDone()
|
|
|
+ private async Task SearchGo()
|
|
|
{
|
|
|
isSearching = true;
|
|
|
StateHasChanged();
|
|
|
|
|
|
await Task.Delay(1);
|
|
|
|
|
|
- var filters = new List<Func<FeTrack, bool>> { p => p.TrackSetKey == searchTrackSetKey };
|
|
|
-
|
|
|
- //TODO: Expression implement
|
|
|
- if (string.IsNullOrEmpty(searchExpression) == false) filters.Add(p => p.Name.Contains(searchExpression));
|
|
|
-
|
|
|
var filteredList = new List<FeTrack>(searchLimitCount);
|
|
|
var matchedCount = 0;
|
|
|
var flagPlus = false;
|
|
|
+
|
|
|
+ var filters = new List<Func<FeTrack, bool>> { p => p.TrackSetKey == searchTrackSetKey };
|
|
|
+ //TODO: Expression implement
|
|
|
+ if (string.IsNullOrEmpty(searchExpression) == false) {
|
|
|
+ filters.Add(p => p.GetTitleOrFilename().Contains(searchExpression,StringComparison.OrdinalIgnoreCase));
|
|
|
+ }
|
|
|
+
|
|
|
for (var i = 0; i < DataSet.AllTracks.Length && isSearching; i++)
|
|
|
{
|
|
|
var item = DataSet.AllTracks[i];
|
|
@@ -143,6 +179,8 @@
|
|
|
await searchProgressBar.SetProgress((float)i / DataSet.AllTracks.Length, $"Searching {i + 1}/{DataSet.AllTracks.Length} matched:{matchedCount}");
|
|
|
}
|
|
|
|
|
|
+ //TODO: search in disc name
|
|
|
+
|
|
|
resultText = $"Result for {searchExpression.NullOrEmptyEscape("<NONE>")} on {searchTrackSetKey} limit {searchLimitCount} of {matchedCount}{(flagPlus ? "+" : "")}";
|
|
|
|
|
|
resultEntries = filteredList
|
|
@@ -159,7 +197,8 @@
|
|
|
if (firstRender)
|
|
|
{
|
|
|
AllTrackSet = DataSet.AllTracksSet.GroupBy(p => p.Key).ToDictionary(p => p.Key, p => p.First().Name);
|
|
|
- await SearchDone();
|
|
|
+ if (resultEntries == null) await SearchGo();
|
|
|
+ else StateHasChanged();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -175,7 +214,7 @@
|
|
|
{
|
|
|
if (searchTrackSetKey == value) return;
|
|
|
searchTrackSetKey = value;
|
|
|
- SearchDone();
|
|
|
+ SearchGo();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -186,8 +225,7 @@
|
|
|
{
|
|
|
if (searchLimitCount == value) return;
|
|
|
searchLimitCount = value;
|
|
|
- SearchDone();
|
|
|
+ SearchGo();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-}
|
|
|
+}
|