Initial commit.
This commit is contained in:
10
Wino.Core.Domain/Models/Requests/IUIMessage.cs
Normal file
10
Wino.Core.Domain/Models/Requests/IUIMessage.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Wino.Core.Domain.Models.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for all messages to report UI changes from synchronizers to UI.
|
||||
/// None of these messages can't run a code that manipulates database.
|
||||
/// They are sent either from processor or view models to signal some other
|
||||
/// parts of the application.
|
||||
/// </summary>
|
||||
public interface IUIMessage;
|
||||
}
|
||||
27
Wino.Core.Domain/Models/Requests/RequestBase.cs
Normal file
27
Wino.Core.Domain/Models/Requests/RequestBase.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using Wino.Core.Domain.Entities;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Requests
|
||||
{
|
||||
public abstract record RequestBase<TBatchRequestType>(MailCopy Item, MailSynchronizerOperation Operation) : IRequest
|
||||
where TBatchRequestType : IBatchChangeRequest
|
||||
{
|
||||
public abstract IBatchChangeRequest CreateBatch(IEnumerable<IRequest> requests);
|
||||
public abstract void ApplyUIChanges();
|
||||
public abstract void RevertUIChanges();
|
||||
}
|
||||
|
||||
public abstract record FolderRequestBase(MailItemFolder Folder, MailSynchronizerOperation Operation) : IFolderRequest
|
||||
{
|
||||
public abstract void ApplyUIChanges();
|
||||
public abstract void RevertUIChanges();
|
||||
}
|
||||
|
||||
public abstract record BatchRequestBase(IEnumerable<IRequest> Items, MailSynchronizerOperation Operation) : IBatchChangeRequest
|
||||
{
|
||||
public abstract void ApplyUIChanges();
|
||||
public abstract void RevertUIChanges();
|
||||
}
|
||||
}
|
||||
15
Wino.Core.Domain/Models/Requests/ToggleRequestRule.cs
Normal file
15
Wino.Core.Domain/Models/Requests/ToggleRequestRule.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Models.MailItem;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a single rule for toggling user actions if needed.
|
||||
/// For example: If user wants to mark a mail as read, but it's already read, then it should be marked as unread.
|
||||
/// </summary>
|
||||
/// <param name="SourceAction"></param>
|
||||
/// <param name="TargetAction"></param>
|
||||
/// <param name="Condition"></param>
|
||||
public record ToggleRequestRule(MailOperation SourceAction, MailOperation TargetAction, Func<IMailItem, bool> Condition);
|
||||
}
|
||||
Reference in New Issue
Block a user