Encapsulation of grouped account selection events and collective events.

This commit is contained in:
Burak Kaan Köse
2024-12-29 19:37:36 +01:00
parent eef2ee1baa
commit f7bfbd5080
16 changed files with 242 additions and 49 deletions

View File

@@ -1,13 +1,18 @@
using System.Collections.ObjectModel;
using System;
using System.Collections.ObjectModel;
using Wino.Core.Domain.Interfaces;
namespace Wino.Core.Domain.Collections
{
// TODO: Could be read-only collection in the MVVM package.
public class CalendarEventCollection : ObservableRangeCollection<ICalendarItem>
{
public ObservableCollection<ICalendarItem> AllDayEvents { get; } = new ObservableCollection<ICalendarItem>();
public new void Add(ICalendarItem calendarItem)
{
if (calendarItem is not ICalendarItemViewModel)
throw new ArgumentException("CalendarItem must be of type ICalendarItemViewModel", nameof(calendarItem));
base.Add(calendarItem);
if (calendarItem.Period.Duration.TotalMinutes == 1440)
@@ -18,6 +23,9 @@ namespace Wino.Core.Domain.Collections
public new void Remove(ICalendarItem calendarItem)
{
if (calendarItem is not ICalendarItemViewModel)
throw new ArgumentException("CalendarItem must be of type ICalendarItemViewModel", nameof(calendarItem));
base.Remove(calendarItem);
if (calendarItem.Period.Duration.TotalMinutes == 1440)