Skip to content

DateRangeChoice

Class in Oadm.Sdk.Client.Controls · Oadm.Sdk.Client.dll

The date range of a log or list (DateRangeButton, SDK 0.15.0): the presets Last hour, Today, Last 24 hours, Last 7 days and All, or Custom with From and To (date and 24-hour time, this computer’s time). A preset is relative: DateRangeChoice.Resolve gives its instants at the moment of the query. The button text says the applied range (“All”, “Last 24 hours”, “12 Nov 09:00 – 14 Nov 18:00”); DateRangeChoice.Changed fires when it changes. Not kept: All at each start. The Custom fields validate like every form (To after From, the error directly below To).

public sealed class DateRangeChoice : ValidatingViewModel

Inherits ValidatingViewModel

DateRangeChoice(TimeProvider? time = null)

A range of All.

Parameters

  • time: The clock and this computer’s time zone (tests pass a fake one); null: the system’s.
IRelayCommand ApplyCustomCommand { get; }

Gets an IRelayCommand instance wrapping DateRangeChoice.ApplyCustom.

IRelayCommand<DateRangePreset> ChooseCommand { get; }

Gets an IRelayCommand<T> instance wrapping DateRangeChoice.Choose.

DateTimeOffset? FromDate { get; set; }

The From day (the time of day comes from FromTime).

string? FromError { get; }

The visible error of From (below its pickers).

TimeSpan? FromTime { get; set; }

The From time of day (24 hours).

bool IsAll { get; }

No range: every entry.

bool IsCustomShown { get; }

From and To show in the flyout.

bool IsOpen { get; set; }

The flyout is open (bound two-way by the button).

DateRangePreset Marked { get; set; }

The choice marked in the open flyout; Custom shows From and To.

static IReadOnlyList<DateRangeOption> Options { get; }

The choices of the flyout, in order.

DateRangePreset Preset { get; private set; }

The applied range.

string Text { get; }

The button text: “All”, “Last 24 hours”, “12 Nov 09:00 – 14 Nov 18:00”.

DateTimeOffset? ToDate { get; set; }

The To day (the time of day comes from ToTime).

string? ToError { get; }

The visible error of To.

TimeSpan? ToTime { get; set; }

The To time of day (24 hours).

void ApplyCustom()

Applies From and To (Apply in the flyout); shows the errors instead while they are not valid.

void Choose(DateRangePreset preset)

Marks a choice in the flyout: a preset applies at once and closes it; Custom shows From and To.

void OnOpening()

The flyout opens: it marks the applied range and fills From and To with it (or with today).

void Reset()

Back to All (logout).

(DateTimeOffset? From, DateTimeOffset? To) Resolve()

The instants of the applied range now: From (null = from the oldest) and To (null = up to now). Today starts at midnight of this computer’s day.

void SetCustom(DateTimeOffset from, DateTimeOffset to)

Sets a custom range directly (tests, a range another page hands over).

event EventHandler? Changed

The applied range changed (a preset was chosen or Custom applied).