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
| Member | Summary |
|---|---|
TimeModal() |
Properties
| Member | Summary |
|---|---|
OnSubmit | Called with the time that was confirmed. |
SegmentCount | Hours and minutes; seconds are not edited here. |
Separator | Segments are separated the way a clock is written. |
Value | The time as it stands. Defaults to midnight. |
Methods
| Member | Summary |
|---|---|
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()
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
| Name | Type | Description |
|---|---|---|
delta | int | How 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
| Name | Type | Description |
|---|---|---|
segment | int | Index of the segment that was typed into. |
value | int | The digits, parsed. |
Draw(ModalFrame)
public override void Draw(ModalFrame frame);
Parameters
| Name | Type | Description |
|---|---|---|
frame | ModalFrame |
SegmentLength(int)
public virtual int SegmentLength(int segment);
Two digits for both hours and minutes.
Parameters
| Name | Type | Description |
|---|---|---|
segment | int | Index 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();