-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
132 additions
and
191 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 |
---|---|---|
@@ -1,21 +1,20 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace BibleApp.Models | ||
{ | ||
public sealed partial class BibleUiModel : ObservableObject | ||
public sealed partial class BibleUiModel : List<BookUiModel> | ||
{ | ||
//[ObservableProperty] | ||
//private string translation = default!; | ||
|
||
//[ObservableProperty] | ||
//private IList<BookUiModel> books = new List<BookUiModel>(); | ||
public string Translation { get; } = default!; | ||
|
||
public string Translation { get; set; } = default!; | ||
public BibleUiModel(string translation) : base(new List<BookUiModel>()) | ||
{ | ||
Translation = translation; | ||
} | ||
|
||
public ObservableCollection<BookUiModel> Books { get; set; } = new(); | ||
public BibleUiModel(List<BookUiModel> books, string translation) : base(books) | ||
{ | ||
Translation = translation; | ||
} | ||
|
||
public override string ToString() => | ||
$"Bible: {Translation} ({Books.Count} books)"; | ||
$"Bible: {Translation} ({this.Count} books)"; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,46 +1,33 @@ | ||
using Bible.Reader.Models; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace BibleApp.Models | ||
{ | ||
public sealed partial class BookUiModel : ObservableObject | ||
[ObservableObject] | ||
public sealed partial class BookUiModel : List<ChapterUiModel> | ||
{ | ||
//[ObservableProperty] | ||
//private int id; | ||
public int Id { get; } | ||
|
||
//[ObservableProperty] | ||
//private string name = default!; | ||
public string Name { get; } = default!; | ||
|
||
//[ObservableProperty] | ||
//private IList<ChapterUiModel> chapters = new List<ChapterUiModel>(); | ||
public ObservableCollection<int> ChapterNumbers { get; } | ||
|
||
public int Id { get; set; } | ||
|
||
public string Name { get; set; } = default!; | ||
|
||
public ObservableCollection<ChapterUiModel> Chapters { get; set; } = new(); | ||
|
||
|
||
private int _chapterCount = 1; | ||
public int ChapterCount | ||
public BookUiModel(int id, string name, int chapterCount) : base(new List<ChapterUiModel>()) | ||
{ | ||
get => _chapterCount; | ||
init | ||
{ | ||
if (SetProperty(ref _chapterCount, value)) | ||
{ | ||
_chapterNumbers = new(ParallelEnumerable.Range(1, _chapterCount)); | ||
OnPropertyChanged(nameof(ChapterNumbers)); | ||
} | ||
} | ||
Id = id; | ||
Name = name; | ||
ChapterNumbers = new(Enumerable.Range(1, chapterCount)); | ||
} | ||
|
||
Lazy<IEnumerable<int>>? _chapterNumbers; | ||
|
||
public ObservableCollection<int> ChapterNumbers => | ||
new(_chapterNumbers?.Value ?? [1]); | ||
|
||
public BookUiModel(List<ChapterUiModel> chapters, int id, string name) : base(chapters) | ||
{ | ||
Id = id; | ||
Name = name; | ||
ChapterNumbers = new(Enumerable.Range(1, chapters.Count)); | ||
} | ||
|
||
public override string ToString() => | ||
$"Book #{Id}, {Name} ({ChapterCount} chapters)"; | ||
$"Book #{Id}, {Name} ({this.Count} chapters)"; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,21 +1,22 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace BibleApp.Models | ||
{ | ||
public sealed partial class ChapterUiModel : ObservableObject | ||
public sealed partial class ChapterUiModel : List<VerseUiModel> | ||
{ | ||
//[ObservableProperty] | ||
//private int id; | ||
public int Id { get; } | ||
|
||
//[ObservableProperty] | ||
//private IList<VerseUiModel> verses = new List<VerseUiModel>(); | ||
public string? Copyright { get; set; } | ||
|
||
public int Id { get; set; } | ||
public ChapterUiModel(int id) : base(new List<VerseUiModel>()) | ||
{ | ||
Id = id; | ||
} | ||
|
||
public ObservableCollection<VerseUiModel> Verses { get; set; } = new(); | ||
public ChapterUiModel(List<VerseUiModel> verses, int id) : base(verses) | ||
{ | ||
Id = id; | ||
} | ||
|
||
public override string ToString() => | ||
$"Chapter {Id} ({Verses.Count} verses)"; | ||
$"Chapter {Id} ({this.Count} verses)"; | ||
} | ||
} |
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.