-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- `Books`: Added a book store which loads book lists from `*.csv` files and each book have a unique code. They can be searched by their code, title & authors. - QuestionEntry`: added new properties and `Clone` method. `Importance` is autogenerated from number of times asked when `HasPreviouslyBeenAsked` is `False`. `ProbableCases` is now a `List<string>` - FindFlyout: A flyout control which can be used to find text. Currently being used for QBank Editor data. - Added the ability to duplicate entries in both `DataGrid` and `ListEditorControl` - Save button now saves all topics instead of the selected ones. - Certain controls are enabled only when required.
- Loading branch information
1 parent
0cfa22c
commit f16e3db
Showing
18 changed files
with
906 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using CsvHelper; | ||
using Symptum.Core.Subjects.QuestionBank; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Symptum.Core.Subjects.Books | ||
{ | ||
public class BookStore | ||
{ | ||
public static ObservableCollection<Book> Books { get; private set; } = []; | ||
|
||
public static void SaveBooks(string path) | ||
{ | ||
using var writer = new StreamWriter(path); | ||
using var csv = new CsvWriter(writer, CultureInfo.InvariantCulture); | ||
csv.WriteHeader<Book>(); | ||
csv.NextRecord(); | ||
foreach (var book in Books) | ||
{ | ||
csv.WriteRecord(book); | ||
csv.NextRecord(); | ||
} | ||
} | ||
|
||
public static void LoadBooks(string path) | ||
{ | ||
if (!File.Exists(path) || Path.GetExtension(path).ToLower() != ".csv") return; | ||
|
||
using var reader = new StreamReader(path); | ||
using var csv = new CsvReader(reader, CultureInfo.InvariantCulture); | ||
var books = csv.GetRecords<Book>(); | ||
foreach (var book in books) | ||
{ | ||
Books.Add(book); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.