public TCCircleDateTimeSelector() { InitializeComponent(); colorRotaryProxy = new LabelColorRotaryProxy(SettingColorLabel); type = DateTimeType.Date; SettingValueTypeLabel.Text = type.ToString(); SettingValueType.IsToggled = true; SettingValueType.Toggled += (s, e) => { type = SettingValueType.IsToggled ? DateTimeType.Date : DateTimeType.Time; SettingValueTypeLabel.Text = type.ToString(); }; TimeTextPage.Appearing += (s, e) => { StringBuilder sb = new StringBuilder(); if (TimeSelector.ValueType == DateTimeType.Date) { if (TimeSelector.IsVisibleOfYear) { sb.AppendLine($"{TimeSelector.DateTime.Year} Year"); } if (TimeSelector.IsVisibleOfMonth) { sb.AppendLine($"{TimeSelector.DateTime.Month} Month"); } if (TimeSelector.IsVisibleOfDate) { sb.AppendLine($"{TimeSelector.DateTime.Day} Day"); } } else { if (TimeSelector.IsVisibleOfHour) { sb.AppendLine($"{TimeSelector.DateTime.Hour} Hour"); } if (TimeSelector.IsVisibleOfMinute) { sb.AppendLine($"{TimeSelector.DateTime.Minute} Minute"); } if (TimeSelector.IsVisibleOfAmPm) { sb.AppendLine($"{(TimeSelector.DateTime.Hour < 12 ? "AM" : "PM")}"); } } sb.AppendLine(); sb.AppendLine($"Max = {(TimeSelector.ValueType == DateTimeType.Date ? TimeSelector.MaximumDate.ToString("yyyy-MM-dd") : TimeSelector.MaximumDate.ToString("HH:mm"))}"); sb.AppendLine($"Min = {(TimeSelector.ValueType == DateTimeType.Date ? TimeSelector.MinimumDate.ToString("yyyy-MM-dd") : TimeSelector.MinimumDate.ToString("HH:mm"))}"); TimeText.Text = sb.ToString(); }; }
public override void Process(TagHelperContext context, TagHelperOutput output) { context.ThrowIfNull(); output.ThrowIfNull(); var modelExplorer = For.ModelExplorer; var attributes = new Dictionary <string, object> { { PlaceholderAttributeName, Placeholder ?? modelExplorer.Metadata.Description ?? modelExplorer.Metadata.DisplayName }, { "class", "layui-input" } }; if (modelExplorer.Metadata != null && modelExplorer.Metadata.IsRequired) { attributes["required"] = "required"; } var value = modelExplorer.Model ?? Value; if (value is DateTime) { value = ((DateTime)value).ToString(DateTimeType.GetDisplayName()); } var inputTagBuilder = _generator.GenerateTextBox(ViewContext, modelExplorer, For.Name, value, Format, attributes); var dateTimeTypeStr = DateTimeType.ToString(); var idStr = TagBuilder.CreateSanitizedId(For.Name, _generator.IdAttributeDotReplacement); output.TagName = "div"; output.TagMode = TagMode.StartTagAndEndTag; output.Attributes.Add("id", $"{idStr}_div"); output.Attributes.Add("class", InputDisplay.GetDisplayName()); output.Content.SetHtmlContent(inputTagBuilder); output.PostElement.SetHtmlContent($@"<script type='text/javascript'> layui.use('laydate', function () {{ var laydate = layui.laydate; laydate.render({{ elem: '#{idStr}', type: '{dateTimeTypeStr}' }}); }}); </script>"); }
public void AssertEquals(ManyDataTypesPoco actualRow) { Assert.AreEqual(StringType, actualRow.StringType); Assert.AreEqual(GuidType, actualRow.GuidType); Assert.AreEqual(DateTimeType.ToString(), actualRow.DateTimeType.ToString()); // 'ToString' rounds to the nearest second Assert.AreEqual(DateTimeOffsetType.ToString(), actualRow.DateTimeOffsetType.ToString()); Assert.AreEqual(BooleanType, actualRow.BooleanType); Assert.AreEqual(DecimalType, actualRow.DecimalType); Assert.AreEqual(DoubleType, actualRow.DoubleType); Assert.AreEqual(FloatType, actualRow.FloatType); Assert.AreEqual(IntType, actualRow.IntType); Assert.AreEqual(Int64Type, actualRow.Int64Type); Assert.AreEqual(TimeUuidType, actualRow.TimeUuidType); Assert.AreEqual(NullableTimeUuidType, actualRow.NullableTimeUuidType); Assert.AreEqual(DictionaryStringLongType, actualRow.DictionaryStringLongType); Assert.AreEqual(DictionaryStringStringType, actualRow.DictionaryStringStringType); Assert.AreEqual(ListOfGuidsType, actualRow.ListOfGuidsType); Assert.AreEqual(ListOfStringsType, actualRow.ListOfStringsType); }
public TCCircleDateTimeSelector() { InitializeComponent(); colorRotaryProxy = new LabelColorRotaryProxy(SettingColorLabel); SettingColorLabel.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => SettingPage.SetValue(CircleSurfaceEffectBehavior.RotaryFocusObjectProperty, colorRotaryProxy)) }); SettingScroller.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => SettingPage.SetValue(CircleSurfaceEffectBehavior.RotaryFocusObjectProperty, SettingScroller)) }); type = DateTimeType.Date; SettingValueTypeLabel.Text = type.ToString(); SettingValueType.IsToggled = true; SettingValueType.Toggled += (s, e) => { type = SettingValueType.IsToggled ? DateTimeType.Date : DateTimeType.Time; SettingValueTypeLabel.Text = type.ToString(); }; TimeTextPage.Appearing += (s, e) => { StringBuilder sb = new StringBuilder(); if (TimeSelector.ValueType == DateTimeType.Date) { if (TimeSelector.IsVisibleOfYear) { sb.AppendLine($"{TimeSelector.DateTime.Year} Year"); } if (TimeSelector.IsVisibleOfMonth) { sb.AppendLine($"{TimeSelector.DateTime.Month} Month"); } if (TimeSelector.IsVisibleOfDate) { sb.AppendLine($"{TimeSelector.DateTime.Day} Day"); } } else { if (TimeSelector.IsVisibleOfHour) { sb.AppendLine($"{TimeSelector.DateTime.Hour} Hour"); } if (TimeSelector.IsVisibleOfMinute) { sb.AppendLine($"{TimeSelector.DateTime.Minute} Minute"); } if (TimeSelector.IsVisibleOfAmPm) { sb.AppendLine($"{(TimeSelector.DateTime.Hour < 12 ? "AM" : "PM")}"); } } sb.AppendLine(); sb.AppendLine($"Marker = {ColorHexConverter.ToHexString(TimeSelector.MarkerColor)}"); sb.AppendLine($"Max = {(TimeSelector.ValueType == DateTimeType.Date ? TimeSelector.MaximumDate.ToString("yyyy-MM-dd") : TimeSelector.MaximumDate.ToString("HH:mm"))}"); sb.AppendLine($"Min = {(TimeSelector.ValueType == DateTimeType.Date ? TimeSelector.MinimumDate.ToString("yyyy-MM-dd") : TimeSelector.MinimumDate.ToString("HH:mm"))}"); TimeText.Text = sb.ToString(); }; }