2using System.Threading.Tasks;
12 private readonly
bool liveUpdates =
false;
13 private readonly TimeSpan delay;
14 private DateTime scheduledFor = DateTime.MinValue;
15 private bool changed =
false;
24 : this(
Name, Delay, true, DefaultValue,
Model)
56 if (this.@value is
null && value is
null)
59 if (this.@value?.Equals(value) ??
false)
78 protected set => this.changed = value;
86 get => this.scheduledFor;
87 set => this.scheduledFor = value;
97 this.
OnAction?.Invoke(
this, EventArgs.Empty);
105 this.changed =
false;
108 return Task.CompletedTask;
Generic class for persistant properties
EventHandler OnAction
Event raised when action is executed.
DelayedActionProperty(string Name, TimeSpan Delay, T DefaultValue, IModel Model)
Generic class for persistant properties
DateTime ScheduledFor
When action is scheduled.
virtual Task Action()
Method called when it is time to execute action.
bool LiveUpdates
If updates to the parameter should be persisted live.
override T Value
Current value of the property
DelayedActionProperty(string Name, TimeSpan Delay, bool LiveUpdates, T DefaultValue, IModel Model)
Generic class for persistant properties
bool Changed
If the property value has changed and needs to be persisted.
Static class managing delayed actions.
static void Add(IDelayedAction Action, DateTime When)
Queues a delayed action. If previously queued, previously queued item will be removed.
Abstract base class for view models
virtual void RaisePropertyChanged(string PropertyName)
Raises the PropertyChanged event.
Generic class for properties
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Interface for delayed actions.
Interface for view models