Resolving warnings and treating warnings as errors in WinUI project. (#824)
This commit is contained in:
@@ -14,9 +14,9 @@ namespace Wino.Mail.WinUI.Controls;
|
||||
|
||||
public sealed partial class AccountCreationDialogControl : UserControl, IRecipient<CopyAuthURLRequested>
|
||||
{
|
||||
private string copyClipboardURL;
|
||||
private string copyClipboardURL = string.Empty;
|
||||
|
||||
public event EventHandler CancelClicked;
|
||||
public event EventHandler? CancelClicked;
|
||||
|
||||
public AccountCreationDialogState State
|
||||
{
|
||||
@@ -67,10 +67,10 @@ public sealed partial class AccountCreationDialogControl : UserControl, IRecipie
|
||||
{
|
||||
if (string.IsNullOrEmpty(copyClipboardURL)) return;
|
||||
|
||||
var clipboardService = WinoApplication.Current.Services.GetService<IClipboardService>();
|
||||
var clipboardService = WinoApplication.Current.Services.GetRequiredService<IClipboardService>();
|
||||
await clipboardService.CopyClipboardAsync(copyClipboardURL);
|
||||
}
|
||||
|
||||
|
||||
private void CancelButtonClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) => CancelClicked?.Invoke(this, null);
|
||||
private void CancelButtonClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) => CancelClicked?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public partial class CustomCalendarFlipView : FlipView
|
||||
private void FlipViewSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
=> OnSelectedItemChanged(e.RemovedItems.FirstOrDefault(), e.AddedItems.FirstOrDefault());
|
||||
|
||||
protected virtual void OnSelectedItemChanged(object oldValue, object newValue) { }
|
||||
protected virtual void OnSelectedItemChanged(object? oldValue, object? newValue) { }
|
||||
|
||||
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
|
||||
{
|
||||
|
||||
@@ -18,11 +18,11 @@ public partial class DayColumnControl : Control
|
||||
private const string TodayState = nameof(TodayState);
|
||||
private const string NotTodayState = nameof(NotTodayState);
|
||||
|
||||
private TextBlock HeaderDateDayText;
|
||||
private TextBlock ColumnHeaderText;
|
||||
private Border IsTodayBorder;
|
||||
private ItemsControl AllDayItemsControl;
|
||||
private CalendarEventCollection _boundEventsCollection;
|
||||
private TextBlock? HeaderDateDayText;
|
||||
private TextBlock? ColumnHeaderText;
|
||||
private Border? IsTodayBorder;
|
||||
private ItemsControl? AllDayItemsControl;
|
||||
private CalendarEventCollection? _boundEventsCollection;
|
||||
|
||||
public CalendarDayModel DayModel
|
||||
{
|
||||
@@ -97,7 +97,7 @@ public partial class DayColumnControl : Control
|
||||
_boundEventsCollection = null;
|
||||
}
|
||||
|
||||
private void EventsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
private void EventsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
UpdateEventItemsSource();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Wino.Calendar.Controls;
|
||||
public partial class DayHeaderControl : Control
|
||||
{
|
||||
private const string PART_DayHeaderTextBlock = nameof(PART_DayHeaderTextBlock);
|
||||
private TextBlock HeaderTextblock;
|
||||
private TextBlock? HeaderTextblock;
|
||||
|
||||
public DayHeaderDisplayType DisplayType
|
||||
{
|
||||
|
||||
@@ -18,10 +18,10 @@ public partial class WinoCalendarControl : Control
|
||||
private const string PART_WinoFlipView = nameof(PART_WinoFlipView);
|
||||
private const string PART_IdleGrid = nameof(PART_IdleGrid);
|
||||
|
||||
public event EventHandler<TimelineCellSelectedArgs> TimelineCellSelected;
|
||||
public event EventHandler<TimelineCellUnselectedArgs> TimelineCellUnselected;
|
||||
public event EventHandler<TimelineCellSelectedArgs>? TimelineCellSelected;
|
||||
public event EventHandler<TimelineCellUnselectedArgs>? TimelineCellUnselected;
|
||||
|
||||
public event EventHandler ScrollPositionChanging;
|
||||
public event EventHandler? ScrollPositionChanging;
|
||||
|
||||
#region Dependency Properties
|
||||
|
||||
@@ -66,8 +66,8 @@ public partial class WinoCalendarControl : Control
|
||||
|
||||
#endregion
|
||||
|
||||
private WinoCalendarFlipView InternalFlipView;
|
||||
private Grid IdleGrid;
|
||||
private WinoCalendarFlipView? InternalFlipView;
|
||||
private Grid? IdleGrid;
|
||||
|
||||
private ScrollViewer? _previousScrollViewer;
|
||||
private WinoDayTimelineCanvas? _previousCanvas;
|
||||
@@ -183,7 +183,7 @@ public partial class WinoCalendarControl : Control
|
||||
scrollViewer.ViewChanging -= ScrollViewChanging;
|
||||
}
|
||||
|
||||
private void ScrollViewChanging(object sender, ScrollViewerViewChangingEventArgs e)
|
||||
private void ScrollViewChanging(object? sender, ScrollViewerViewChangingEventArgs e)
|
||||
=> ScrollPositionChanging?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
private void CalendarSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
@@ -233,10 +233,10 @@ public partial class WinoCalendarControl : Control
|
||||
}
|
||||
}
|
||||
|
||||
private void ActiveTimelineCellUnselected(object sender, TimelineCellUnselectedArgs e)
|
||||
private void ActiveTimelineCellUnselected(object? sender, TimelineCellUnselectedArgs e)
|
||||
=> TimelineCellUnselected?.Invoke(this, e);
|
||||
|
||||
private void ActiveTimelineCellSelected(object sender, TimelineCellSelectedArgs e)
|
||||
private void ActiveTimelineCellSelected(object? sender, TimelineCellSelectedArgs e)
|
||||
=> TimelineCellSelected?.Invoke(this, e);
|
||||
|
||||
public void NavigateToDay(DateTime dateTime) => InternalFlipView?.NavigateToDay(dateTime);
|
||||
@@ -289,6 +289,6 @@ public partial class WinoCalendarControl : Control
|
||||
|
||||
public CalendarItemControl GetCalendarItemControl(CalendarItemViewModel calendarItemViewModel)
|
||||
{
|
||||
return this.FindDescendants<CalendarItemControl>().FirstOrDefault(a => a.CalendarItem == calendarItemViewModel);
|
||||
return this.FindDescendants<CalendarItemControl>().FirstOrDefault(a => a.CalendarItem == calendarItemViewModel)!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public partial class WinoCalendarFlipView : CustomCalendarFlipView
|
||||
UpdateIdleState();
|
||||
}
|
||||
|
||||
protected override void OnSelectedItemChanged(object oldValue, object newValue)
|
||||
protected override void OnSelectedItemChanged(object? oldValue, object? newValue)
|
||||
{
|
||||
base.OnSelectedItemChanged(oldValue, newValue);
|
||||
|
||||
@@ -101,7 +101,7 @@ public partial class WinoCalendarFlipView : CustomCalendarFlipView
|
||||
}
|
||||
}
|
||||
|
||||
private void ItemsSourceUpdated(object sender, NotifyCollectionChangedEventArgs e)
|
||||
private void ItemsSourceUpdated(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
UpdateIdleState();
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public partial class WinoCalendarFlipView : CustomCalendarFlipView
|
||||
});
|
||||
}
|
||||
|
||||
private ObservableRangeCollection<DayRangeRenderModel> GetItemsSource()
|
||||
private ObservableRangeCollection<DayRangeRenderModel>? GetItemsSource()
|
||||
=> ItemsSource as ObservableRangeCollection<DayRangeRenderModel>;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public partial class WinoCalendarPanel : Panel
|
||||
|
||||
if (!calendarControls.Any()) return base.ArrangeOverride(finalSize);
|
||||
|
||||
var events = calendarControls.Select(a => a.Content as CalendarItemViewModel);
|
||||
var events = calendarControls.Select(a => a.Content as CalendarItemViewModel).OfType<ICalendarItem>();
|
||||
|
||||
LayoutEvents(events);
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ public partial class WinoCalendarTypeSelectorControl : Control
|
||||
public static readonly DependencyProperty DisplayDayCountProperty = DependencyProperty.Register(nameof(DisplayDayCount), typeof(int), typeof(WinoCalendarTypeSelectorControl), new PropertyMetadata(0));
|
||||
public static readonly DependencyProperty TodayClickedCommandProperty = DependencyProperty.Register(nameof(TodayClickedCommand), typeof(ICommand), typeof(WinoCalendarTypeSelectorControl), new PropertyMetadata(null));
|
||||
|
||||
public ICommand TodayClickedCommand
|
||||
public ICommand? TodayClickedCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(TodayClickedCommandProperty); }
|
||||
get { return (ICommand?)GetValue(TodayClickedCommandProperty); }
|
||||
set { SetValue(TodayClickedCommandProperty, value); }
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ public partial class WinoCalendarTypeSelectorControl : Control
|
||||
set { SetValue(DisplayDayCountProperty, value); }
|
||||
}
|
||||
|
||||
private AppBarButton _todayButton;
|
||||
private AppBarToggleButton _dayToggle;
|
||||
private AppBarToggleButton _weekToggle;
|
||||
private AppBarToggleButton _monthToggle;
|
||||
private AppBarButton? _todayButton;
|
||||
private AppBarToggleButton? _dayToggle;
|
||||
private AppBarToggleButton? _weekToggle;
|
||||
private AppBarToggleButton? _monthToggle;
|
||||
|
||||
public WinoCalendarTypeSelectorControl()
|
||||
{
|
||||
@@ -65,16 +65,16 @@ public partial class WinoCalendarTypeSelectorControl : Control
|
||||
Guard.IsNotNull(_weekToggle, nameof(_weekToggle));
|
||||
Guard.IsNotNull(_monthToggle, nameof(_monthToggle));
|
||||
|
||||
_todayButton.Click += TodayClicked;
|
||||
_todayButton!.Click += TodayClicked;
|
||||
|
||||
_dayToggle.Click += (s, e) => { SetSelectedType(CalendarDisplayType.Day); };
|
||||
_weekToggle.Click += (s, e) => { SetSelectedType(CalendarDisplayType.Week); };
|
||||
_monthToggle.Click += (s, e) => { SetSelectedType(CalendarDisplayType.Month); };
|
||||
_dayToggle!.Click += (s, e) => { SetSelectedType(CalendarDisplayType.Day); };
|
||||
_weekToggle!.Click += (s, e) => { SetSelectedType(CalendarDisplayType.Week); };
|
||||
_monthToggle!.Click += (s, e) => { SetSelectedType(CalendarDisplayType.Month); };
|
||||
|
||||
UpdateToggleButtonStates();
|
||||
}
|
||||
|
||||
private void TodayClicked(object sender, RoutedEventArgs e) => TodayClickedCommand?.Execute(null);
|
||||
private void TodayClicked(object? sender, RoutedEventArgs e) => TodayClickedCommand?.Execute(null);
|
||||
|
||||
private void SetSelectedType(CalendarDisplayType type)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ public partial class WinoCalendarView : Control
|
||||
public static readonly DependencyProperty HighlightedDateRangeProperty = DependencyProperty.Register(nameof(HighlightedDateRange), typeof(DateRange), typeof(WinoCalendarView), new PropertyMetadata(null, new PropertyChangedCallback(OnHighlightedDateRangeChanged)));
|
||||
public static readonly DependencyProperty VisibleDateBackgroundProperty = DependencyProperty.Register(nameof(VisibleDateBackground), typeof(Brush), typeof(WinoCalendarView), new PropertyMetadata(null, new PropertyChangedCallback(OnPropertiesChanged)));
|
||||
public static readonly DependencyProperty DateClickedCommandProperty = DependencyProperty.Register(nameof(DateClickedCommand), typeof(ICommand), typeof(WinoCalendarView), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty TodayBackgroundColorProperty = DependencyProperty.Register(nameof(TodayBackgroundColor), typeof(Color), typeof(WinoCalendarView), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty TodayBackgroundColorProperty = DependencyProperty.Register(nameof(TodayBackgroundColor), typeof(Color), typeof(WinoCalendarView), new PropertyMetadata(new Color()));
|
||||
|
||||
public Color TodayBackgroundColor
|
||||
{
|
||||
@@ -30,30 +30,30 @@ public partial class WinoCalendarView : Control
|
||||
/// Gets or sets the command to execute when a date is picked.
|
||||
/// Unused.
|
||||
/// </summary>
|
||||
public ICommand DateClickedCommand
|
||||
public ICommand? DateClickedCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(DateClickedCommandProperty); }
|
||||
get { return (ICommand?)GetValue(DateClickedCommandProperty); }
|
||||
set { SetValue(DateClickedCommandProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the highlighted range of dates.
|
||||
/// </summary>
|
||||
public DateRange HighlightedDateRange
|
||||
public DateRange? HighlightedDateRange
|
||||
{
|
||||
get { return (DateRange)GetValue(HighlightedDateRangeProperty); }
|
||||
get { return (DateRange?)GetValue(HighlightedDateRangeProperty); }
|
||||
set { SetValue(HighlightedDateRangeProperty, value); }
|
||||
}
|
||||
|
||||
public Brush VisibleDateBackground
|
||||
public Brush? VisibleDateBackground
|
||||
{
|
||||
get { return (Brush)GetValue(VisibleDateBackgroundProperty); }
|
||||
get { return (Brush?)GetValue(VisibleDateBackgroundProperty); }
|
||||
set { SetValue(VisibleDateBackgroundProperty, value); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
private CalendarView CalendarView;
|
||||
private CalendarView? CalendarView;
|
||||
|
||||
public WinoCalendarView()
|
||||
{
|
||||
@@ -67,6 +67,7 @@ public partial class WinoCalendarView : Control
|
||||
CalendarView = GetTemplateChild(PART_CalendarView) as CalendarView;
|
||||
|
||||
Guard.IsNotNull(CalendarView, nameof(CalendarView));
|
||||
if (CalendarView == null) return;
|
||||
|
||||
CalendarView.SelectedDatesChanged -= InternalCalendarViewSelectionChanged;
|
||||
CalendarView.SelectedDatesChanged += InternalCalendarViewSelectionChanged;
|
||||
@@ -92,7 +93,7 @@ public partial class WinoCalendarView : Control
|
||||
}
|
||||
|
||||
// Reset selection, we don't show selected dates but react to them.
|
||||
CalendarView.SelectedDates.Clear();
|
||||
CalendarView?.SelectedDates.Clear();
|
||||
}
|
||||
|
||||
private static void OnPropertiesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
@@ -107,7 +108,7 @@ public partial class WinoCalendarView : Control
|
||||
|
||||
// Changing selected dates will trigger the selection changed event.
|
||||
// It will behave like user clicked the date.
|
||||
public void GoToDay(DateTime dateTime) => CalendarView.SelectedDates.Add(dateTime);
|
||||
public void GoToDay(DateTime dateTime) => CalendarView?.SelectedDates.Add(dateTime);
|
||||
|
||||
private static void OnHighlightedDateRangeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -17,11 +17,11 @@ namespace Wino.Calendar.Controls;
|
||||
|
||||
public partial class WinoDayTimelineCanvas : Control, IDisposable
|
||||
{
|
||||
public event EventHandler<TimelineCellSelectedArgs> TimelineCellSelected;
|
||||
public event EventHandler<TimelineCellUnselectedArgs> TimelineCellUnselected;
|
||||
public event EventHandler<TimelineCellSelectedArgs>? TimelineCellSelected;
|
||||
public event EventHandler<TimelineCellUnselectedArgs>? TimelineCellUnselected;
|
||||
|
||||
private const string PART_InternalCanvas = nameof(PART_InternalCanvas);
|
||||
private SKXamlCanvas Canvas;
|
||||
private SKXamlCanvas? Canvas;
|
||||
|
||||
public static readonly DependencyProperty RenderOptionsProperty = DependencyProperty.Register(nameof(RenderOptions), typeof(CalendarRenderOptions), typeof(WinoDayTimelineCanvas), new PropertyMetadata(null, new PropertyChangedCallback(OnRenderingPropertiesChanged)));
|
||||
public static readonly DependencyProperty SeperatorColorProperty = DependencyProperty.Register(nameof(SeperatorColor), typeof(SolidColorBrush), typeof(WinoDayTimelineCanvas), new PropertyMetadata(null, new PropertyChangedCallback(OnRenderingPropertiesChanged)));
|
||||
@@ -31,39 +31,39 @@ public partial class WinoDayTimelineCanvas : Control, IDisposable
|
||||
public static readonly DependencyProperty SelectedDateTimeProperty = DependencyProperty.Register(nameof(SelectedDateTime), typeof(DateTime?), typeof(WinoDayTimelineCanvas), new PropertyMetadata(null, new PropertyChangedCallback(OnSelectedDateTimeChanged)));
|
||||
public static readonly DependencyProperty PositionerUIElementProperty = DependencyProperty.Register(nameof(PositionerUIElement), typeof(UIElement), typeof(WinoDayTimelineCanvas), new PropertyMetadata(null));
|
||||
|
||||
public UIElement PositionerUIElement
|
||||
public UIElement? PositionerUIElement
|
||||
{
|
||||
get { return (UIElement)GetValue(PositionerUIElementProperty); }
|
||||
get { return (UIElement?)GetValue(PositionerUIElementProperty); }
|
||||
set { SetValue(PositionerUIElementProperty, value); }
|
||||
}
|
||||
|
||||
public CalendarRenderOptions RenderOptions
|
||||
public CalendarRenderOptions? RenderOptions
|
||||
{
|
||||
get { return (CalendarRenderOptions)GetValue(RenderOptionsProperty); }
|
||||
get { return (CalendarRenderOptions?)GetValue(RenderOptionsProperty); }
|
||||
set { SetValue(RenderOptionsProperty, value); }
|
||||
}
|
||||
|
||||
public SolidColorBrush HalfHourSeperatorColor
|
||||
public SolidColorBrush? HalfHourSeperatorColor
|
||||
{
|
||||
get { return (SolidColorBrush)GetValue(HalfHourSeperatorColorProperty); }
|
||||
get { return (SolidColorBrush?)GetValue(HalfHourSeperatorColorProperty); }
|
||||
set { SetValue(HalfHourSeperatorColorProperty, value); }
|
||||
}
|
||||
|
||||
public SolidColorBrush SeperatorColor
|
||||
public SolidColorBrush? SeperatorColor
|
||||
{
|
||||
get { return (SolidColorBrush)GetValue(SeperatorColorProperty); }
|
||||
get { return (SolidColorBrush?)GetValue(SeperatorColorProperty); }
|
||||
set { SetValue(SeperatorColorProperty, value); }
|
||||
}
|
||||
|
||||
public SolidColorBrush WorkingHourCellBackgroundColor
|
||||
public SolidColorBrush? WorkingHourCellBackgroundColor
|
||||
{
|
||||
get { return (SolidColorBrush)GetValue(WorkingHourCellBackgroundColorProperty); }
|
||||
get { return (SolidColorBrush?)GetValue(WorkingHourCellBackgroundColorProperty); }
|
||||
set { SetValue(WorkingHourCellBackgroundColorProperty, value); }
|
||||
}
|
||||
|
||||
public SolidColorBrush SelectedCellBackgroundBrush
|
||||
public SolidColorBrush? SelectedCellBackgroundBrush
|
||||
{
|
||||
get { return (SolidColorBrush)GetValue(SelectedCellBackgroundBrushProperty); }
|
||||
get { return (SolidColorBrush?)GetValue(SelectedCellBackgroundBrushProperty); }
|
||||
set { SetValue(SelectedCellBackgroundBrushProperty, value); }
|
||||
}
|
||||
|
||||
@@ -106,9 +106,11 @@ public partial class WinoDayTimelineCanvas : Control, IDisposable
|
||||
TimelineCellUnselected?.Invoke(this, new TimelineCellUnselectedArgs());
|
||||
}
|
||||
|
||||
private void OnCanvasPointerPressed(object sender, PointerRoutedEventArgs e)
|
||||
private void OnCanvasPointerPressed(object? sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
if (RenderOptions == null) return;
|
||||
var canvas = Canvas;
|
||||
if (canvas == null) return;
|
||||
|
||||
var hourHeight = RenderOptions.CalendarSettings.HourHeight;
|
||||
|
||||
@@ -119,12 +121,15 @@ public partial class WinoDayTimelineCanvas : Control, IDisposable
|
||||
PositionerUIElement = this.FindParents().LastOrDefault(a => a is Grid);
|
||||
}
|
||||
|
||||
if (PositionerUIElement == null)
|
||||
return;
|
||||
|
||||
PointerPoint positionerRootPoint = e.GetCurrentPoint(PositionerUIElement);
|
||||
PointerPoint canvasPointerPoint = e.GetCurrentPoint(Canvas);
|
||||
PointerPoint canvasPointerPoint = e.GetCurrentPoint(canvas);
|
||||
|
||||
Point touchPoint = canvasPointerPoint.Position;
|
||||
|
||||
var singleDayWidth = (Canvas.ActualWidth / RenderOptions.TotalDayCount);
|
||||
var singleDayWidth = (canvas.ActualWidth / RenderOptions.TotalDayCount);
|
||||
|
||||
int day = (int)(touchPoint.X / singleDayWidth);
|
||||
int hour = (int)(touchPoint.Y / hourHeight);
|
||||
@@ -187,9 +192,14 @@ public partial class WinoDayTimelineCanvas : Control, IDisposable
|
||||
&& SelectedCellBackgroundBrush != null;
|
||||
}
|
||||
|
||||
private void OnCanvasPaintSurface(object sender, SKPaintSurfaceEventArgs e)
|
||||
private void OnCanvasPaintSurface(object? sender, SKPaintSurfaceEventArgs e)
|
||||
{
|
||||
if (!CanDrawTimeline()) return;
|
||||
var renderOptions = RenderOptions!;
|
||||
var workingHourCellBackgroundColor = WorkingHourCellBackgroundColor!;
|
||||
var seperatorColor = SeperatorColor!;
|
||||
var halfHourSeperatorColor = HalfHourSeperatorColor!;
|
||||
var selectedCellBackgroundBrush = SelectedCellBackgroundBrush!;
|
||||
|
||||
var canvas = e.Surface.Canvas;
|
||||
canvas.Clear(SKColors.Transparent);
|
||||
@@ -203,13 +213,13 @@ public partial class WinoDayTimelineCanvas : Control, IDisposable
|
||||
|
||||
// Calculate the width of each rectangle (1 day column)
|
||||
// Equal distribution of the whole width.
|
||||
double rectWidth = canvasWidth / RenderOptions.TotalDayCount;
|
||||
double rectWidth = canvasWidth / renderOptions.TotalDayCount;
|
||||
|
||||
// Calculate the height of each rectangle (1 hour row)
|
||||
double rectHeight = RenderOptions.CalendarSettings.HourHeight;
|
||||
double rectHeight = renderOptions.CalendarSettings.HourHeight;
|
||||
|
||||
// Define stroke and fill colors
|
||||
var strokeColor = ToSKColor(SeperatorColor.Color);
|
||||
var strokeColor = ToSKColor(seperatorColor.Color);
|
||||
float strokeThickness = 0.5f;
|
||||
|
||||
// Create paints for drawing
|
||||
@@ -229,18 +239,18 @@ public partial class WinoDayTimelineCanvas : Control, IDisposable
|
||||
|
||||
using var dashedPaint = new SKPaint
|
||||
{
|
||||
Color = ToSKColor(HalfHourSeperatorColor.Color),
|
||||
Color = ToSKColor(halfHourSeperatorColor.Color),
|
||||
StrokeWidth = strokeThickness,
|
||||
Style = SKPaintStyle.Stroke,
|
||||
PathEffect = SKPathEffect.CreateDash([2f, 2f], 0),
|
||||
IsAntialias = true
|
||||
};
|
||||
|
||||
for (int day = 0; day < RenderOptions.TotalDayCount; day++)
|
||||
for (int day = 0; day < renderOptions.TotalDayCount; day++)
|
||||
{
|
||||
var currentDay = RenderOptions.DateRange.StartDate.AddDays(day);
|
||||
var currentDay = renderOptions.DateRange.StartDate.AddDays(day);
|
||||
|
||||
bool isWorkingDay = RenderOptions.CalendarSettings.WorkingDays.Contains(currentDay.DayOfWeek);
|
||||
bool isWorkingDay = renderOptions.CalendarSettings.WorkingDays.Contains(currentDay.DayOfWeek);
|
||||
|
||||
// Loop through each hour (rows)
|
||||
for (int hour = 0; hour < hours; hour++)
|
||||
@@ -263,12 +273,12 @@ public partial class WinoDayTimelineCanvas : Control, IDisposable
|
||||
|
||||
// Fill another rectangle with the working hour background color
|
||||
// This rectangle must be placed with -1 margin to prevent invisible borders of the main rectangle.
|
||||
if (isWorkingDay && renderTime >= RenderOptions.CalendarSettings.WorkingHourStart && renderTime <= RenderOptions.CalendarSettings.WorkingHourEnd)
|
||||
if (isWorkingDay && renderTime >= renderOptions.CalendarSettings.WorkingHourStart && renderTime <= renderOptions.CalendarSettings.WorkingHourEnd)
|
||||
{
|
||||
var backgroundRectangle = new SKRect(x + 1, y + 1, x + width - 1, y + height - 1);
|
||||
|
||||
canvas.DrawRect(backgroundRectangle, strokePaint);
|
||||
fillPaint.Color = ToSKColor(WorkingHourCellBackgroundColor.Color);
|
||||
fillPaint.Color = ToSKColor(workingHourCellBackgroundColor.Color);
|
||||
canvas.DrawRect(backgroundRectangle, fillPaint);
|
||||
}
|
||||
|
||||
@@ -298,7 +308,7 @@ public partial class WinoDayTimelineCanvas : Control, IDisposable
|
||||
(float)(day * rectWidth + rectWidth),
|
||||
(float)(selectedY + selectionRectHeight));
|
||||
|
||||
fillPaint.Color = ToSKColor(SelectedCellBackgroundBrush.Color);
|
||||
fillPaint.Color = ToSKColor(selectedCellBackgroundBrush.Color);
|
||||
canvas.DrawRect(selectedRectangle, fillPaint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public partial class WinoInfoBar : InfoBar
|
||||
}
|
||||
}
|
||||
|
||||
private async void TimerTick(object sender, object e)
|
||||
private async void TimerTick(object? sender, object e)
|
||||
{
|
||||
_dispatcherTimer.Stop();
|
||||
_dispatcherTimer.Tick -= TimerTick;
|
||||
|
||||
Reference in New Issue
Block a user