54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
using Sarand.Net.Standard.Base.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Sarand.Net.Mobile.Maui.Controls
|
|
{
|
|
//=======================================================================
|
|
public class SamTimePicker : TimePicker
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Definitions.
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
public SamTimePicker()
|
|
{
|
|
DefaultFontSize = FontSize;
|
|
Format = "HH:mm";
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
public String FormattedTime { get { return DateUtil.Format(DateTime.Today + Time, Format); } }
|
|
// Styling.
|
|
public double DefaultFontSize { get; }
|
|
|
|
//-------------------------------------------------------------------
|
|
// C o n t r o l E v e n t s
|
|
//-------------------------------------------------------------------
|
|
public class TimeChangedEventArgs : EventArgs { };
|
|
public event EventHandler<TimeChangedEventArgs>? TimeChanged;
|
|
protected override void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
|
{
|
|
if (propertyName.EqualsCI(TimePicker.TimeProperty.PropertyName))
|
|
{
|
|
base.OnPropertyChanged(propertyName);
|
|
if (TimeChanged != null) TimeChanged.Invoke(this, new TimeChangedEventArgs());
|
|
return;
|
|
}
|
|
base.OnPropertyChanged(propertyName);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|