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 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(); }; }