forked from CodeBeamOrg/CodeBeam.MudBlazor.Extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWatchExample2.razor
More file actions
53 lines (47 loc) · 2.09 KB
/
WatchExample2.razor
File metadata and controls
53 lines (47 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
@namespace MudExtensions.Docs.Examples
@inject ISnackbar Snackbar
@using MudBlazor.Extensions
@using MudExtensions.Utilities
<MudGrid>
<MudItem xs="12" sm="8">
<MudStack Class="mud-width-full" AlignItems="AlignItems.Center">
<MudWatch @ref="_watch" Interval="TimeSpan.FromSeconds(1)" Mode="WatchMode.Watch"
Wheel="_wheel" ShowHour="_showHour" ShowMinute="_showMinute" ShowSecond="_showSecond" ShowMillisecond="_showMillisecond"
TimeZone="_selectedTimeZone" />
</MudStack>
</MudItem>
<MudItem xs="12" sm="4">
<MudStack Spacing="4">
<MudSelectExtended @bind-Value="_selectedTimeZone" Label="TimeZone" Dense="true" SearchBox="true" ToStringFunc="@(tz => $"{tz.DisplayName} ({tz.Id})")">
@foreach (var tz in _timeZones)
{
<MudSelectItemExtended Value="tz">
@tz.DisplayName (@tz.Id)
</MudSelectItemExtended>
}
</MudSelectExtended>
<MudSwitchM3 @bind-Value="_wheel" Color="Color.Secondary" Label="Wheel" />
<div class="d-flex flex-wrap gap-4">
<MudSwitchM3 @bind-Value="_showHour" Color="Color.Secondary" Label="Show Hour" />
<MudSwitchM3 @bind-Value="_showMinute" Color="Color.Secondary" Label="Show Minute" />
<MudSwitchM3 @bind-Value="_showSecond" Color="Color.Secondary" Label="Show Second" />
<MudSwitchM3 @bind-Value="_showMillisecond" Color="Color.Secondary" Label="Show Millisecond" />
</div>
</MudStack>
</MudItem>
</MudGrid>
@code {
MudWatch _watch = new();
bool _wheel;
bool _showHour = true;
bool _showMinute = true;
bool _showSecond = true;
bool _showMillisecond = false;
private List<TimeZoneInfo> _timeZones = new();
private TimeZoneInfo _selectedTimeZone = TimeZoneInfo.Utc;
protected override void OnInitialized()
{
_timeZones = TimeZoneInfo.GetSystemTimeZones().ToList();
_selectedTimeZone = TimeZoneInfo.Local;
}
}