feat: clean up warnings.

This commit is contained in:
rabbitism
2024-07-30 18:33:30 +08:00
parent e1f91f612b
commit 15fb5a2d1b
167 changed files with 473 additions and 825 deletions

View File

@@ -23,7 +23,6 @@ public class DatePicker: DatePickerBase, IClearControl
public const string PART_TextBox = "PART_TextBox";
public const string PART_Calendar = "PART_Calendar";
private Button? _button;
private Popup? _popup;
private TextBox? _textBox;
private CalendarView? _calendar;
@@ -79,7 +78,7 @@ public class DatePicker: DatePickerBase, IClearControl
}
_button = e.NameScope.Find<Button>(PART_Button);
_popup = e.NameScope.Find<Popup>(PART_Popup);
e.NameScope.Find<Popup>(PART_Popup);
_textBox = e.NameScope.Find<TextBox>(PART_TextBox);
_calendar = e.NameScope.Find<CalendarView>(PART_Calendar);
@@ -94,19 +93,19 @@ public class DatePicker: DatePickerBase, IClearControl
}
}
private void OnDateSelected(object sender, CalendarDayButtonEventArgs e)
private void OnDateSelected(object? sender, CalendarDayButtonEventArgs e)
{
SetCurrentValue(SelectedDateProperty, e.Date);
SetCurrentValue(IsDropdownOpenProperty, false);
}
private void OnButtonClick(object sender, RoutedEventArgs e)
private void OnButtonClick(object? sender, RoutedEventArgs e)
{
Focus(NavigationMethod.Pointer);
SetCurrentValue(IsDropdownOpenProperty, !IsDropdownOpen);
}
private void OnTextBoxPointerPressed(object sender, PointerPressedEventArgs e)
private void OnTextBoxPointerPressed(object? sender, PointerPressedEventArgs e)
{
if (_calendar is not null)
{
@@ -118,7 +117,7 @@ public class DatePicker: DatePickerBase, IClearControl
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void OnTextChanged(object sender, TextChangedEventArgs e)
private void OnTextChanged(object? sender, TextChangedEventArgs e)
{
SetSelectedDate(true);
}
@@ -146,7 +145,6 @@ public class DatePicker: DatePickerBase, IClearControl
SetCurrentValue(SelectedDateProperty, date);
if (_calendar is not null)
{
var d = SelectedDate ?? DateTime.Today;
_calendar.ContextDate = _calendar.ContextDate.With(year: date.Year, month: date.Month);
_calendar.UpdateDayButtons();
}
@@ -164,7 +162,7 @@ public class DatePicker: DatePickerBase, IClearControl
}
}
private void OnTextBoxGetFocus(object sender, GotFocusEventArgs e)
private void OnTextBoxGetFocus(object? sender, GotFocusEventArgs e)
{
if (_calendar is not null)
{