-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#116 SIQuester: allow to create package preview
Remove outdated HTML exports
- Loading branch information
1 parent
c14eb40
commit b74d746
Showing
18 changed files
with
287 additions
and
1,206 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,43 @@ | ||
using SIPackages; | ||
|
||
namespace SIQuester.ViewModel; | ||
|
||
public sealed class PreviewViewModel | ||
{ | ||
public SIDocument Document { get; private set; } | ||
|
||
public SortedDictionary<string, int> Content { get; } = new(); | ||
|
||
public int QuestionCount { get; private set; } | ||
|
||
public PreviewViewModel(SIDocument document) | ||
{ | ||
Document = document; | ||
var questionCount = 0; | ||
|
||
foreach (var round in document.Package.Rounds) | ||
{ | ||
foreach (var theme in round.Themes) | ||
{ | ||
foreach (var question in theme.Questions) | ||
{ | ||
questionCount++; | ||
|
||
foreach (var contentItem in question.GetContent()) | ||
{ | ||
if (Content.TryGetValue(contentItem.Type, out var value)) | ||
{ | ||
Content[contentItem.Type] = value + 1; | ||
} | ||
else | ||
{ | ||
Content[contentItem.Type] = 1; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
QuestionCount = questionCount; | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/SIQuester/SIQuester/Converters/ContentTypeConverter.cs
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,21 @@ | ||
using SIPackages.Core; | ||
using SIPackages.Properties; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
|
||
namespace SIQuester.Converters; | ||
|
||
public sealed class ContentTypeConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => value switch | ||
{ | ||
ContentTypes.Text => Properties.Resources.Text, | ||
ContentTypes.Image => Resources.Image, | ||
ContentTypes.Audio => Resources.Audio, | ||
ContentTypes.Video => Resources.Video, | ||
ContentTypes.Html => Resources.Html, | ||
_ => value | ||
}; | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); | ||
} |
Oops, something went wrong.