Finalizing quick event dialog.

This commit is contained in:
Burak Kaan Köse
2025-01-01 17:28:29 +01:00
parent a82b487b92
commit 1c79d14260
17 changed files with 424 additions and 93 deletions

View File

@@ -11,5 +11,39 @@ namespace Wino.Core.Domain.Models.Calendar
TimeSpan WorkingHourEnd,
double HourHeight,
DayHeaderDisplayType DayHeaderDisplayType,
CultureInfo CultureInfo);
CultureInfo CultureInfo)
{
public TimeSpan? GetTimeSpan(string selectedTime)
{
var format = DayHeaderDisplayType switch
{
DayHeaderDisplayType.TwelveHour => "h:mm tt",
DayHeaderDisplayType.TwentyFourHour => "HH:mm",
_ => throw new ArgumentOutOfRangeException(nameof(DayHeaderDisplayType))
};
if (DateTime.TryParseExact(selectedTime, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime parsedTime))
{
return parsedTime.TimeOfDay;
}
else
{
return null;
}
}
public string GetTimeString(TimeSpan timeSpan)
{
var format = DayHeaderDisplayType switch
{
DayHeaderDisplayType.TwelveHour => "h:mm tt",
DayHeaderDisplayType.TwentyFourHour => "HH:mm",
_ => throw new ArgumentOutOfRangeException(nameof(DayHeaderDisplayType))
};
var dateTime = DateTime.Today.Add(timeSpan);
return dateTime.ToString(format, CultureInfo.InvariantCulture);
}
}
}

View File

@@ -627,5 +627,10 @@
"TitleBarServerDisconnectedButton_Description": "Wino is disconnected from the network. Click reconnect to restore connection.",
"TitleBarServerReconnectButton_Title": "reconnect",
"TitleBarServerReconnectingButton_Title": "connecting",
"MailItemNoSubject": "No subject"
"MailItemNoSubject": "No subject",
"QuickEventDialogMoreDetailsButtonText": "More details",
"QuickEventDialog_RemindMe": "Remind me",
"QuickEventDialog_Location": "Location",
"QuickEventDialog_EventName": "Event name",
"QuickEventDialog_IsAllDay": "All day"
}