Monthly calendar basics.
This commit is contained in:
@@ -40,6 +40,13 @@ namespace Wino.Core.Domain.Entities.Shared
|
||||
/// </summary>
|
||||
public string SynchronizationDeltaIdentifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For tracking calendar change delta.
|
||||
/// Gmail: It's per-calendar, so unused.
|
||||
/// Outlook: deltaLink
|
||||
/// </summary>
|
||||
public string CalendarSynchronizationDeltaIdentifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Gets or sets the custom account identifier color in hex.
|
||||
/// </summary>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
WelcomePage,
|
||||
AccountDetailsPage,
|
||||
MergedAccountDetailsPage,
|
||||
ManageAccountsPage,
|
||||
AccountManagementPage,
|
||||
SignatureManagementPage,
|
||||
AboutPage,
|
||||
|
||||
33
Wino.Core.Domain/Extensions/DateTimeExtensions.cs
Normal file
33
Wino.Core.Domain/Extensions/DateTimeExtensions.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Wino.Core.Domain.Models.Calendar;
|
||||
|
||||
namespace Wino.Core.Domain.Extensions
|
||||
{
|
||||
public static class DateTimeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a date range for the month of the given date.
|
||||
/// </summary>
|
||||
/// <param name="date">Date to get range for.</param>
|
||||
public static DateRange GetMonthDateRangeStartingWeekday(this DateTime date, DayOfWeek WeekStartDay)
|
||||
{
|
||||
DateTime firstDayOfMonth = new DateTime(date.Year, date.Month, 1);
|
||||
|
||||
int daysToSubtract = (7 + (firstDayOfMonth.DayOfWeek - WeekStartDay)) % 7;
|
||||
DateTime rangeStart = firstDayOfMonth.AddDays(-daysToSubtract);
|
||||
|
||||
DateTime rangeEnd = rangeStart.AddDays(34);
|
||||
|
||||
return new DateRange(rangeStart, rangeEnd);
|
||||
}
|
||||
|
||||
public static DateTime GetWeekStartDateForDate(this DateTime date, DayOfWeek firstDayOfWeek)
|
||||
{
|
||||
// Detect the first day of the week that contains the selected date.
|
||||
int diff = (7 + (date.DayOfWeek - firstDayOfWeek)) % 7;
|
||||
|
||||
// Start loading from this date instead of visible date.
|
||||
return date.AddDays(-diff).Date;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Entities.Shared;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Models.Accounts;
|
||||
using Wino.Core.Domain.Models.Common;
|
||||
@@ -16,6 +17,7 @@ namespace Wino.Core.Domain.Interfaces
|
||||
void InfoBarMessage(string title, string message, InfoBarMessageType messageType);
|
||||
void InfoBarMessage(string title, string message, InfoBarMessageType messageType, string actionButtonText, Action action);
|
||||
void ShowNotSupportedMessage();
|
||||
Task<MailAccount> ShowEditAccountDialogAsync(MailAccount account);
|
||||
Task<string> ShowTextInputDialogAsync(string currentInput, string dialogTitle, string dialogDescription, string primaryButtonText);
|
||||
Task<bool> ShowWinoCustomMessageDialogAsync(string title,
|
||||
string description,
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace Wino.Core.Domain.Interfaces
|
||||
|
||||
// Custom dialogs
|
||||
Task<IMailItemFolder> ShowMoveMailFolderDialogAsync(List<IMailItemFolder> availableFolders);
|
||||
Task<MailAccount> ShowEditAccountDialogAsync(MailAccount account);
|
||||
Task<MailAccount> ShowAccountPickerDialogAsync(List<MailAccount> availableAccounts);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Extensions;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Calendar.CalendarTypeStrategies
|
||||
{
|
||||
public class MonthCalendarDrawingStrategy : BaseCalendarTypeDrawingStrategy
|
||||
{
|
||||
public MonthCalendarDrawingStrategy(CalendarSettings settings)
|
||||
: base(settings, CalendarDisplayType.Month)
|
||||
{
|
||||
}
|
||||
|
||||
public override DateRange GetNextDateRange(DateRange CurrentDateRange, int DayDisplayCount)
|
||||
{
|
||||
return DateTimeExtensions.GetMonthDateRangeStartingWeekday(CurrentDateRange.EndDate, Settings.FirstDayOfWeek);
|
||||
}
|
||||
|
||||
public override DateRange GetPreviousDateRange(DateRange CurrentDateRange, int DayDisplayCount)
|
||||
{
|
||||
return DateTimeExtensions.GetMonthDateRangeStartingWeekday(CurrentDateRange.StartDate, Settings.FirstDayOfWeek);
|
||||
}
|
||||
|
||||
public override DateRange GetRenderDateRange(DateTime DisplayDate, int DayDisplayCount)
|
||||
{
|
||||
// Load 2 months at first.
|
||||
var initialRange = DateTimeExtensions.GetMonthDateRangeStartingWeekday(DisplayDate.Date, Settings.FirstDayOfWeek);
|
||||
|
||||
var nextRange = GetNextDateRange(initialRange, DayDisplayCount);
|
||||
|
||||
return new DateRange(initialRange.StartDate, nextRange.EndDate);
|
||||
}
|
||||
|
||||
public override int GetRenderDayCount(DateTime DisplayDate, int DayDisplayCount) => 35;
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,8 @@
|
||||
"CalendarItem_DetailsPopup_JoinOnline": "Join online",
|
||||
"CalendarItem_DetailsPopup_ViewEventButton": "View event",
|
||||
"CalendarItem_DetailsPopup_ViewSeriesButton": "View series",
|
||||
"CalendarDisplayOptions_Expand": "Expand",
|
||||
"CalendarDisplayOptions_Color": "Color",
|
||||
"CreateAccountAliasDialog_Title": "Create Account Alias",
|
||||
"CreateAccountAliasDialog_Description": "Make sure your outgoing server allows sending mails from this alias.",
|
||||
"CreateAccountAliasDialog_AliasAddress": "Address",
|
||||
|
||||
Reference in New Issue
Block a user