Merge pull request #496 from irihitech/time

Fix various nullable issue.
This commit is contained in:
Dong Bin
2024-11-29 21:48:17 +08:00
committed by GitHub
4 changed files with 6 additions and 3 deletions

View File

@@ -140,7 +140,7 @@ public class DateTimePicker : DatePickerBase
} }
} }
private void OnTimeSelectedChanged(object sender, TimeChangedEventArgs e) private void OnTimeSelectedChanged(object? sender, TimeChangedEventArgs e)
{ {
if (SelectedDate is null) if (SelectedDate is null)
{ {

View File

@@ -93,7 +93,7 @@ public class TimePicker : TimePickerBase, IClearControl
SyncTimeToText(SelectedTime); SyncTimeToText(SelectedTime);
} }
private void OnPresenterTimeChanged(object sender, TimeChangedEventArgs e) private void OnPresenterTimeChanged(object? sender, TimeChangedEventArgs e)
{ {
if (_suppressTextPresenterEvent) return; if (_suppressTextPresenterEvent) return;
SetCurrentValue(SelectedTimeProperty, e.NewTime); SetCurrentValue(SelectedTimeProperty, e.NewTime);

View File

@@ -156,7 +156,7 @@ public class TimeRangePicker : TimePickerBase, IClearControl
SyncTimeToText(EndTime, false); SyncTimeToText(EndTime, false);
} }
private void OnPresenterTimeChanged(object sender, TimeChangedEventArgs e) private void OnPresenterTimeChanged(object? sender, TimeChangedEventArgs e)
{ {
if (_suppressTextPresenterEvent) return; if (_suppressTextPresenterEvent) return;
SetCurrentValue(Equals(sender, _startPresenter) ? StartTimeProperty : EndTimeProperty, e.NewTime); SetCurrentValue(Equals(sender, _startPresenter) ? StartTimeProperty : EndTimeProperty, e.NewTime);

View File

@@ -26,6 +26,7 @@ public class Test
window.Show(); window.Show();
var form = window.FindControl<Form>("Form"); var form = window.FindControl<Form>("Form");
Assert.NotNull(form);
var logicalChildren = form.GetLogicalChildren().ToList(); var logicalChildren = form.GetLogicalChildren().ToList();
Assert.True(logicalChildren.All(a=>a is FormItem)); Assert.True(logicalChildren.All(a=>a is FormItem));
Assert.IsType<TextBox>(logicalChildren[0].LogicalChildren[0]); Assert.IsType<TextBox>(logicalChildren[0].LogicalChildren[0]);
@@ -65,6 +66,7 @@ public class Test
window.Show(); window.Show();
var form = window.FindControl<Form>("Form"); var form = window.FindControl<Form>("Form");
Assert.NotNull(form);
var logicalChildren = form.GetLogicalChildren().ToList(); var logicalChildren = form.GetLogicalChildren().ToList();
Assert.True(logicalChildren.All(a=>a is FormGroup)); Assert.True(logicalChildren.All(a=>a is FormGroup));
var formGroup = (FormGroup)logicalChildren[0]; var formGroup = (FormGroup)logicalChildren[0];
@@ -108,6 +110,7 @@ public class Test
window.Show(); window.Show();
var form = window.FindControl<Form>("Form"); var form = window.FindControl<Form>("Form");
Assert.NotNull(form);
var logicalChildren = form.GetLogicalChildren().ToList(); var logicalChildren = form.GetLogicalChildren().ToList();
Assert.True(logicalChildren.All(a=>a is FormItem || a is FormGroup)); Assert.True(logicalChildren.All(a=>a is FormItem || a is FormGroup));
Assert.IsType<TextBox>(logicalChildren[0].LogicalChildren[0]); Assert.IsType<TextBox>(logicalChildren[0].LogicalChildren[0]);