Skip to content

Commit a7f3d0f

Browse files
committed
Fixed filtering issue
1 parent 53fb3f2 commit a7f3d0f

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

CutCode/DataBase/DataBaseManager.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public bool DelCode(CodeBoxModel code)
188188
"Html", "Java", "Javascript", "Kotlin", "Php", "C", "Ruby", "Rust","Sql", "Swift"
189189
};
190190

191-
public ObservableCollection<CodeBoxModel> OrderCode(string order)
191+
public async Task<ObservableCollection<CodeBoxModel>> OrderCode(string order)
192192
{
193193
int ind = AllOrderKind.IndexOf(order);
194194
ObservableCollection<CodeBoxModel> lst;
@@ -212,7 +212,6 @@ public ObservableCollection<CodeBoxModel> OrderCode(string order)
212212
if (ind == 0 || ind == 1) ChangeSort(AllOrderKind[ind]);
213213
}
214214

215-
//if (ind < 2) AllCodes = lst;
216215
return lst;
217216
}
218217

CutCode/Interfaces/IDataBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface IDataBase
1616
CodeBoxModel AddCode(string title, string desc, string code, string langType);
1717
bool EditCode(CodeBoxModel code);
1818
bool DelCode(CodeBoxModel code);
19-
ObservableCollection<CodeBoxModel> OrderCode(string order);
19+
Task<ObservableCollection<CodeBoxModel>> OrderCode(string order);
2020
bool FavModify(CodeBoxModel code);
2121
Task<ObservableCollection<CodeBoxModel>> SearchCode(string text, string from);
2222

CutCode/ViewModels/HomeViewModel.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,10 @@ public string CurrentSort2
188188
}
189189
}
190190

191-
private void ComboBoxItemSelected(string kind)
191+
private async void ComboBoxItemSelected(string kind)
192192
{
193-
if(AllCodes.Count > 0)
194-
{
195-
AllCodes = database.OrderCode(kind);
196-
VisChange("Not found :(");
197-
}
193+
AllCodes = await database.OrderCode(kind);
194+
VisChange("Not found :(");
198195
}
199196

200197
public async void SearchCommand(string text)

0 commit comments

Comments
 (0)