public DateComboBoxDialog(DateTime dateTime, DateTimePickerMode mode) : base(Gtk.WindowType.Popup) { this.mode = mode; this.CreateControls(); if (HasDate) { calendar.Date = dateTime; } if (HasTime) { hourSpin.Value = dateTime.Hour; minutesSpin.Value = dateTime.Minute; secondsSpin.Value = dateTime.Second; UpdateClock(); } this.ButtonPressEvent += delegate(object o, Gtk.ButtonPressEventArgs args) { if (args.Event.Type == Gdk.EventType.ButtonPress) { // single click only! Close(); } }; }
//-------------------------------------- // Public Methods //-------------------------------------- /// <summary> /// Displays DateTimePickerUI with DateTimePicker Mode. /// ///<param name="mode">An object that contains the IOSDateTimePicker mode.</param> /// </summary> public static void Show(DateTimePickerMode mode, Action <DateTime> callback) { OnPickerClosed = callback; #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE _ISN_ShowDP((int)mode); #endif }
public static ModeValues FromMode(DateTimePickerMode mode, DateTimePickerTimeMode timeMode) { switch (mode) { case DateTimePickerMode.Date: return(new ModeValues { Mode = mode, TimeMode = timeMode, Format = "dd/MM/yyyy", Mask = "99/99/9999", MaskType = MaskedEditType.Date, Width = new Unit("70px") }); case DateTimePickerMode.DateTime: return(new ModeValues { Mode = mode, TimeMode = timeMode, Format = "dd/MM/yyyy HH:mm", Mask = "99/99/9999 99:99", MaskType = MaskedEditType.DateTime, Width = new Unit("103px") }); case DateTimePickerMode.Month: return(new ModeValues { Mode = mode, TimeMode = timeMode, Format = "MM/yyyy", Mask = "99/9999", MaskType = MaskedEditType.None, Width = new Unit("53px") }); case DateTimePickerMode.Time: return(new ModeValues { Mode = mode, TimeMode = timeMode, Format = "HH:mm", Mask = "99:99", MaskType = MaskedEditType.Time, Width = new Unit("38px") }); } return(null); }
internal void Initialize(string label, string data, DateTimePickerMode mode, string initial, string min, string max) { Label = label; Data = data; Mode = mode; Initial = initial; Min = min; Max = max; }
internal void Initialize(string label, string data, DateTimePickerMode mode, string initial, string min, string max) { Label = label?.Substring(0, Math.Min(label.Length, 20)); Data = data.Substring(0, Math.Min(data.Length, 300)); Mode = mode; Initial = initial; Min = min; Max = max; }
public DateTimePickerTemplateAction(string label, string data, DateTimePickerMode mode, DateTime?initial = null, DateTime?min = null, DateTime?max = null) { var format = GetDateTimeFormat(mode); Initialize(label, data, mode, initial == null ? null : ((DateTime)initial).ToString(format), min == null ? null : ((DateTime)min).ToString(format), max == null ? null : ((DateTime)max).ToString(format)); }
/// <summary> /// Displays DateTimePickerUI with DateTimePicker Mode and pre-set date. /// ///<param name="mode">An object that contains the IOSDateTimePicker mode</param> ///<param name="name">An object DateTime that contains pre-set date</param> /// </summary> public static void Show(DateTimePickerMode mode, DateTime dateTime, Action <DateTime> callback) { OnPickerClosed = callback; DateTime sTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); double unixTimestamp = (dateTime - sTime).TotalSeconds; #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE _ISN_ShowDPWithTime((int)mode, unixTimestamp); #endif }
public static DateTimePickerParameters WithDates(DateTimePickerMode mode, DateTimeOffset current, DateTimeOffset min, DateTimeOffset max) { if (min > max) { throw new ArgumentException("Max date must be later than Min date."); } return(new DateTimePickerParameters { Mode = mode, CurrentDate = current, MinDate = min, MaxDate = max }); }
internal static string GetDateTimeFormat(DateTimePickerMode mode) { var format = ""; switch (mode) { case DateTimePickerMode.Date: format = "yyyy-MM-dd"; break; case DateTimePickerMode.Time: format = "HH:mm"; break; case DateTimePickerMode.Datetime: format = "yyyy-MM-ddTHH:mm"; break; } return(format); }
/// <summary> /// ImageCarouselTemplate でのみ利用可 /// </summary> /// <param name="data">ポストバックで返される文字列</param> /// <param name="mode"></param> /// <param name="initial">(省略可能) 日付または時刻の初期値</param> /// <param name="min">(省略可能) 選択可能な日付または時刻の最小値。maxの値より小さい必要があります。</param> /// <param name="max">(省略可能) 選択可能な日付または時刻の最大値。minの値より大きい必要があります。</param> public DateTimePickerAction(string data, DateTimePickerMode mode, DateTime?initial = null, DateTime?min = null, DateTime?max = null) { Data = data; Mode = mode; if (initial == null && max == null && min == null) { return; } var format = mode switch { DateTimePickerMode.Date => "yyyy-MM-dd", DateTimePickerMode.Time => "HH:mm", DateTimePickerMode.DateTime => "yyyy-MM-ddTHH:mm", _ => throw new ArgumentOutOfRangeException() }; Initial = initial?.ToString(format); Max = max?.ToString(format); Min = min?.ToString(format); }
public DateComboBoxDialog (DateTime dateTime, DateTimePickerMode mode) : base(Gtk.WindowType.Popup) { this.mode = mode; this.CreateControls (); if (HasDate) { calendar.Date = dateTime; } if (HasTime) { hourSpin.Value = dateTime.Hour; minutesSpin.Value = dateTime.Minute; secondsSpin.Value = dateTime.Second; UpdateClock (); } this.ButtonPressEvent += delegate(object o, Gtk.ButtonPressEventArgs args) { if (args.Event.Type == Gdk.EventType.ButtonPress) { // single click only! Close (); } }; }
public DateTimePickerDataPack(DateTimePickerMode dateTimePickerMode, DateTime dateTime) { this.mode = dateTimePickerMode; this.dateVal = dateTime; }
public static string AsCssClassName(this DateTimePickerMode self) { return($"DateTimePickerMode_{self.ToString()}"); }
public DateTimePickerTemplateAction(string label, string data, DateTimePickerMode mode, string initial = null, string min = null, string max = null) { Initialize(label, data, mode, initial, min, max); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyCellTypeDateTime"/> class. /// </summary> public PropertyCellTypeDateTime() { Mode = DateTimePickerMode.Date; }
/// <summary> /// Initializes a new instance of the <see cref="DateTimePickerAction"/> class. /// </summary> /// <param name="mode">The mode of the Datetime picker action.</param> public DateTimePickerAction(DateTimePickerMode mode) { _mode = mode; }