Skip to main content

TimeModal class

Namespace: Arlecchino.Modals.Setting · Assembly: Arlecchino

A time of day, edited as hours and minutes on a 24-hour clock. Everything wraps: stepping past midnight comes back around instead of stopping.

public sealed class TimeModal : SegmentedModal

Inherits from SegmentedModal

Constructors

MemberSummary
TimeModal()

Properties

MemberSummary
OnSubmitCalled with the time that was confirmed.
SegmentCountHours and minutes; seconds are not edited here.
SeparatorSegments are separated the way a clock is written.
ValueThe time as it stands. Defaults to midnight.

Methods

MemberSummary
Add(int)Steps by whole hours or minutes depending on the active segment, wrapping around the clock.
ApplyTypedValue(int, int)Stores a typed segment, wrapping input that is too large rather than refusing it.
Draw(ModalFrame)
SegmentLength(int)Two digits for both hours and minutes.
SegmentTexts()The time as two-digit hours and minutes.
Submit()

Constructors in detail

TimeModal()

Obsolete

Constructors of types with required members are not supported in this version of your compiler.

public TimeModal();

Properties in detail

OnSubmit

public Action<TimeOnly> OnSubmit { get; init; }

Called with the time that was confirmed.

Type Action<T><TimeOnly>

SegmentCount

public virtual int SegmentCount { get; }

Hours and minutes; seconds are not edited here.

Type int

Separator

public override string Separator { get; }

Segments are separated the way a clock is written.

Type string

Value

public TimeOnly Value { get; set; }

The time as it stands. Defaults to midnight.

Type TimeOnly

Methods in detail

Add(int)

public virtual void Add(int delta);

Steps by whole hours or minutes depending on the active segment, wrapping around the clock.

Parameters

NameTypeDescription
deltaintHow far to step; negative goes back.

ApplyTypedValue(int, int)

public virtual void ApplyTypedValue(int segment, int value);

Stores a typed segment, wrapping input that is too large rather than refusing it.

Parameters

NameTypeDescription
segmentintIndex of the segment that was typed into.
valueintThe digits, parsed.

Draw(ModalFrame)

public override void Draw(ModalFrame frame);

Parameters

NameTypeDescription
frameModalFrame

SegmentLength(int)

public virtual int SegmentLength(int segment);

Two digits for both hours and minutes.

Parameters

NameTypeDescription
segmentintIndex of the segment.

Returns int — Its digit count.

SegmentTexts()

public virtual string[] SegmentTexts();

The time as two-digit hours and minutes.

Returns string[] — One string per segment.

Submit()

public virtual void Submit();