Initial commit.
This commit is contained in:
30
Wino.Core.Domain/Models/Reader/EditorToolbarSection.cs
Normal file
30
Wino.Core.Domain/Models/Reader/EditorToolbarSection.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Wino.Core.Domain.Enums;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Reader
|
||||
{
|
||||
public class EditorToolbarSection
|
||||
{
|
||||
public EditorToolbarSectionType SectionType { get; set; }
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (SectionType)
|
||||
{
|
||||
case EditorToolbarSectionType.None:
|
||||
return Translator.EditorToolbarOption_None;
|
||||
case EditorToolbarSectionType.Format:
|
||||
return Translator.EditorToolbarOption_Format;
|
||||
case EditorToolbarSectionType.Insert:
|
||||
return Translator.EditorToolbarOption_Insert;
|
||||
case EditorToolbarSectionType.Draw:
|
||||
return Translator.EditorToolbarOption_Draw;
|
||||
case EditorToolbarSectionType.Options:
|
||||
return Translator.EditorToolbarOption_Options;
|
||||
default:
|
||||
return "Unknown Editor Option";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Wino.Core.Domain/Models/Reader/FilterOption.cs
Normal file
16
Wino.Core.Domain/Models/Reader/FilterOption.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Wino.Core.Domain.Enums;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Reader
|
||||
{
|
||||
public class FilterOption
|
||||
{
|
||||
public FilterOptionType Type { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
public FilterOption(string title, FilterOptionType type)
|
||||
{
|
||||
Title = title;
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Wino.Core.Domain/Models/Reader/MailRenderModel.cs
Normal file
25
Wino.Core.Domain/Models/Reader/MailRenderModel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using MimeKit;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Reader
|
||||
{
|
||||
/// <summary>
|
||||
/// Final model to be passed to renderer page.
|
||||
/// Data here are created based on rendering settings.
|
||||
/// </summary>
|
||||
public class MailRenderModel
|
||||
{
|
||||
public string RenderHtml { get; }
|
||||
public MailRenderingOptions MailRenderingOptions { get; }
|
||||
public List<MimePart> Attachments { get; set; } = new List<MimePart>();
|
||||
|
||||
public string UnsubscribeLink { get; set; }
|
||||
public bool CanUnsubscribe => !string.IsNullOrEmpty(UnsubscribeLink);
|
||||
|
||||
public MailRenderModel(string renderHtml, MailRenderingOptions mailRenderingOptions = null)
|
||||
{
|
||||
RenderHtml = renderHtml;
|
||||
MailRenderingOptions = mailRenderingOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Wino.Core.Domain/Models/Reader/MailRenderingOptions.cs
Normal file
19
Wino.Core.Domain/Models/Reader/MailRenderingOptions.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace Wino.Core.Domain.Models.Reader
|
||||
{
|
||||
/// <summary>
|
||||
/// Rendering options for mail.
|
||||
/// </summary>
|
||||
public class MailRenderingOptions
|
||||
{
|
||||
private const bool DefaultLoadImageValue = true;
|
||||
private const bool DefaultLoadStylesValue = true;
|
||||
|
||||
public bool LoadImages { get; set; } = DefaultLoadImageValue;
|
||||
public bool LoadStyles { get; set; } = DefaultLoadStylesValue;
|
||||
|
||||
// HtmlDocument.Load call is redundant if all the settings are in default values.
|
||||
// Therefore we will purify the HTML only if needed.
|
||||
|
||||
public bool IsPurifyingNeeded() => LoadImages != DefaultLoadImageValue || LoadStyles != DefaultLoadStylesValue;
|
||||
}
|
||||
}
|
||||
6
Wino.Core.Domain/Models/Reader/ReaderFontModel.cs
Normal file
6
Wino.Core.Domain/Models/Reader/ReaderFontModel.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Wino.Core.Domain.Enums;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Reader
|
||||
{
|
||||
public record ReaderFontModel(ReaderFont Font, string FontFamilyName);
|
||||
}
|
||||
29
Wino.Core.Domain/Models/Reader/SortingOption.cs
Normal file
29
Wino.Core.Domain/Models/Reader/SortingOption.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Models.Comparers;
|
||||
using Wino.Core.Domain.Models.MailItem;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Reader
|
||||
{
|
||||
public class SortingOption
|
||||
{
|
||||
public SortingOptionType Type { get; set; }
|
||||
public string Title { get; set; }
|
||||
public IComparer<IMailItem> Comparer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Type == SortingOptionType.ReceiveDate)
|
||||
return new DateComparer();
|
||||
else
|
||||
return new NameComparer();
|
||||
}
|
||||
}
|
||||
|
||||
public SortingOption(string title, SortingOptionType type)
|
||||
{
|
||||
Title = title;
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user