Import functionality for wino accounts, calendar sync UI, bunch of shell improvements

This commit is contained in:
Burak Kaan Köse
2026-04-04 20:23:20 +02:00
parent 1667aa34db
commit 1d0fcfb5b0
68 changed files with 2792 additions and 519 deletions
+14 -2
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Diagnostics;
@@ -642,10 +643,11 @@ public class AccountService : BaseDatabaseService, IAccountService
IsExtended = true,
RemoteCalendarId = string.Empty,
TimeZone = string.Empty,
BackgroundColorHex = await GetNextDistinctCalendarColorAsync().ConfigureAwait(false),
TextColorHex = "#FFFFFF"
BackgroundColorHex = await GetNextDistinctCalendarColorAsync().ConfigureAwait(false)
};
localCalendar.TextColorHex = GetReadableTextColorHex(localCalendar.BackgroundColorHex);
await Connection.InsertAsync(localCalendar, typeof(AccountCalendar)).ConfigureAwait(false);
}
@@ -658,6 +660,16 @@ public class AccountService : BaseDatabaseService, IAccountService
return CalendarColorPalette.GetDistinctColor(usedColors.Select(a => a.BackgroundColorHex));
}
private static string GetReadableTextColorHex(string backgroundColorHex)
{
if (string.IsNullOrWhiteSpace(backgroundColorHex))
return "#FFFFFF";
var color = ColorTranslator.FromHtml(backgroundColorHex);
var luminance = ((0.299 * color.R) + (0.587 * color.G) + (0.114 * color.B)) / 255d;
return luminance > 0.6 ? "#111111" : "#FFFFFF";
}
public async Task UpdateAccountOrdersAsync(Dictionary<Guid, int> accountIdOrderPair)
{
foreach (var pair in accountIdOrderPair)