There is a team that, according to a selected book, finds students who have been given a book.
if (SelectItem is Book book) FormSource = from st in students from fm in forms where fm.IDBook == book.ID && fm.IDForm == st.ID select new { st.ID, st.FullName, st.Group, fm.DateOfIssue }; SelectItem is the selected item in the datagrid books.
students and forms are an ObservableCollection preloaded from the database.
_library.Students.Load(); _library.Forms.Load(); FormSource is an ItemSource DataGrid on which the students to whom this book is issued are displayed.
Since I will have many students and forms for them, I need to perform this task asynchronously. It is desirable that the FormSource updated gradually. And still need to somehow cancel the running task when you re-execute the command.
The complete project on github. Criticism is welcome.
нужно данную задачу выполнять асинхронноWhat does this mean in your understanding? - tym32167Task.Run(()=>{....})and it will be executed on the thread pool - tym32167CancellationTokento cancel the operation - tym32167