Export Option

Added export function
This commit is contained in:
2026-04-01 10:34:06 +02:00
parent cf3d7557aa
commit 142c318d33
14 changed files with 628 additions and 87 deletions
+7
View File
@@ -21,3 +21,10 @@ public enum EntrySource : byte
Notification = 2, Notification = 2,
Import = 3 Import = 3
} }
public enum ExportLayout : byte
{
DayView = 0,
WeekBlock = 1,
DaySummary = 2
}
@@ -158,10 +158,12 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
requestCode, requestCode,
intent, intent,
BuildPendingIntentFlags()); BuildPendingIntentFlags());
if (pendingIntent is null)
return;
var when = triggerAt.ToUnixTimeMilliseconds(); var when = triggerAt.ToUnixTimeMilliseconds();
if (CanUseExactAlarms(context, alarmManager)) if (OperatingSystem.IsAndroidVersionAtLeast(23) && CanUseExactAlarms(alarmManager))
{ {
alarmManager.SetExactAndAllowWhileIdle(AlarmType.RtcWakeup, when, pendingIntent); alarmManager.SetExactAndAllowWhileIdle(AlarmType.RtcWakeup, when, pendingIntent);
return; return;
@@ -203,28 +205,50 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
var smallIcon = context.ApplicationInfo?.Icon ?? global::Android.Resource.Drawable.IcDialogInfo; var smallIcon = context.ApplicationInfo?.Icon ?? global::Android.Resource.Drawable.IcDialogInfo;
var builder = new NotificationCompat.Builder(context, channelId) var builder = new NotificationCompat.Builder(context, channelId);
.SetSmallIcon(smallIcon) builder.SetSmallIcon(smallIcon);
.SetContentTitle(title) builder.SetContentTitle(title);
.SetContentText(message) builder.SetContentText(message);
.SetPriority((int)NotificationPriority.High) builder.SetPriority((int)NotificationPriority.High);
.SetAutoCancel(true) builder.SetAutoCancel(true);
.SetContentIntent(openPendingIntent) builder.SetOnlyAlertOnce(true);
.SetOnlyAlertOnce(true)
.AddAction(0, yellowLabel, yellowPendingIntent) if (openPendingIntent is not null)
.AddAction(0, redLabel, redPendingIntent) builder.SetContentIntent(openPendingIntent);
.AddAction(0, grayLabel, grayPendingIntent);
if (yellowPendingIntent is not null)
builder.AddAction(0, yellowLabel, yellowPendingIntent);
if (redPendingIntent is not null)
builder.AddAction(0, redLabel, redPendingIntent);
if (grayPendingIntent is not null)
builder.AddAction(0, grayLabel, grayPendingIntent);
if (vibrationEnabled && !OperatingSystem.IsAndroidVersionAtLeast(26)) if (vibrationEnabled && !OperatingSystem.IsAndroidVersionAtLeast(26))
builder.SetVibrate(NotificationVibrationPattern); builder.SetVibrate(NotificationVibrationPattern);
NotificationManagerCompat.From(context).Notify(notificationId, builder.Build()); var notification = builder.Build();
if (notification is null)
return;
var notificationManager = NotificationManagerCompat.From(context);
notificationManager?.Notify(notificationId, notification);
} }
private static PendingIntent CreateOpenQuickEntryPendingIntent(Context context, int notificationId, string date) private static PendingIntent? CreateOpenQuickEntryPendingIntent(Context context, int notificationId, string date)
{ {
var launchIntent = context.PackageManager?.GetLaunchIntentForPackage(context.PackageName) Intent launchIntent;
var packageName = context.PackageName;
if (!string.IsNullOrWhiteSpace(packageName))
{
launchIntent = context.PackageManager?.GetLaunchIntentForPackage(packageName)
?? new Intent(context, typeof(MainActivity)); ?? new Intent(context, typeof(MainActivity));
}
else
{
launchIntent = new Intent(context, typeof(MainActivity));
}
launchIntent.SetAction(ActionOpenQuickEntry); launchIntent.SetAction(ActionOpenQuickEntry);
launchIntent.AddFlags(ActivityFlags.SingleTop | ActivityFlags.ClearTop | ActivityFlags.NewTask); launchIntent.AddFlags(ActivityFlags.SingleTop | ActivityFlags.ClearTop | ActivityFlags.NewTask);
@@ -239,7 +263,7 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
BuildPendingIntentFlags()); BuildPendingIntentFlags());
} }
private static PendingIntent CreateSaveStatusPendingIntent(Context context, int notificationId, string status, string date) private static PendingIntent? CreateSaveStatusPendingIntent(Context context, int notificationId, string status, string date)
{ {
var intent = new Intent(context, typeof(CfsNotificationReceiver)); var intent = new Intent(context, typeof(CfsNotificationReceiver));
intent.SetAction(ActionSaveStatus); intent.SetAction(ActionSaveStatus);
@@ -313,14 +337,17 @@ public sealed class AndroidNotificationScheduler : INotificationScheduler
intent, intent,
BuildPendingIntentFlags()); BuildPendingIntentFlags());
if (pendingIntent is not null)
alarmManager.Cancel(pendingIntent); alarmManager.Cancel(pendingIntent);
NotificationManagerCompat.From(context).Cancel(BuildNotificationId(scheduleId, day));
var notificationManager = NotificationManagerCompat.From(context);
notificationManager?.Cancel(BuildNotificationId(scheduleId, day));
} }
Preferences.Default.Remove(PrefScheduledIds); Preferences.Default.Remove(PrefScheduledIds);
} }
private static bool CanUseExactAlarms(Context context, AlarmManager alarmManager) private static bool CanUseExactAlarms(AlarmManager alarmManager)
{ {
if (!OperatingSystem.IsAndroidVersionAtLeast(31)) if (!OperatingSystem.IsAndroidVersionAtLeast(31))
return true; return true;
+4 -1
View File
@@ -51,6 +51,8 @@ public sealed class CfsNotificationReceiver : BroadcastReceiver
private void HandleSaveStatus(Context context, Intent intent) private void HandleSaveStatus(Context context, Intent intent)
{ {
var pendingResult = GoAsync(); var pendingResult = GoAsync();
if (pendingResult is null)
return;
_ = Task.Run(async () => _ = Task.Run(async () =>
{ {
@@ -76,7 +78,8 @@ public sealed class CfsNotificationReceiver : BroadcastReceiver
timestamp: DateTime.Now, timestamp: DateTime.Now,
source: EntrySource.App); source: EntrySource.App);
NotificationManagerCompat.From(context).Cancel(notificationId); var notificationManager = NotificationManagerCompat.From(context);
notificationManager?.Cancel(notificationId);
} }
finally finally
{ {
+3
View File
@@ -1,3 +1,5 @@
using cfs_tracker.Models;
namespace cfs_tracker.Services; namespace cfs_tracker.Services;
public interface IPdfExportService public interface IPdfExportService
@@ -8,6 +10,7 @@ public interface IPdfExportService
Task<ExportResult> ExportMonthAsync(int year, int month); Task<ExportResult> ExportMonthAsync(int year, int month);
Task<ExportResult> ExportYearAsync(DateTime date); Task<ExportResult> ExportYearAsync(DateTime date);
Task<ExportResult> ExportYearAsync(int year); Task<ExportResult> ExportYearAsync(int year);
Task<ExportResult> ExportRangeAsync(DateTime startDate, DateTime endDate, ExportLayout layout);
Task<int> ClearExportsAsync(); Task<int> ClearExportsAsync();
} }
+325
View File
@@ -40,6 +40,209 @@ public sealed class PdfExportService : IPdfExportService
public Task<ExportResult> ExportYearAsync(int year) public Task<ExportResult> ExportYearAsync(int year)
=> ExportYearHtmlAsync(year); => ExportYearHtmlAsync(year);
public Task<ExportResult> ExportRangeAsync(DateTime startDate, DateTime endDate, ExportLayout layout)
{
var (rangeStart, rangeEnd) = NormalizeDateRange(startDate, endDate);
return layout switch
{
ExportLayout.DayView => ExportDayRangeHtmlAsync(rangeStart, rangeEnd),
ExportLayout.WeekBlock => ExportWeekBlockRangeHtmlAsync(rangeStart, rangeEnd),
_ => ExportDaySummaryRangeHtmlAsync(rangeStart, rangeEnd)
};
}
private async Task<ExportResult> ExportDayRangeHtmlAsync(DateTime startDate, DateTime endDate)
{
var entries = await _healthEntryRepository.GetEntriesBetweenAsync(startDate, endDate.AddDays(1));
var activityNames = await GetActivityNamesAsync();
var symptomNamesByEntry = await GetSymptomNamesByEntryAsync(entries.Select(x => x.Id));
var sb = new StringBuilder();
sb.AppendLine("<h1>Export - Tagesansicht</h1>");
sb.AppendLine($"<p class=\"summary-note\">Zeitraum: {Encode(FormatDateRange(startDate, endDate))}</p>");
var currentDay = startDate.Date;
var isFirstSection = true;
while (currentDay <= endDate.Date)
{
var dayEntries = entries
.Where(x => x.EntryDate.Date == currentDay)
.OrderBy(x => x.Timestamp)
.ThenBy(x => x.Id)
.ToList();
if (dayEntries.Count == 0)
{
currentDay = currentDay.AddDays(1);
continue;
}
if (!isFirstSection)
sb.AppendLine("<div class=\"page-break\"></div>");
sb.AppendLine("<section class=\"export-section\">");
sb.AppendLine($"<h2>{Encode(currentDay.ToString("dddd, dd.MM.yyyy", DateHelper.GermanCulture))}</h2>");
AppendDayDetailTable(sb, dayEntries, activityNames, symptomNamesByEntry);
sb.AppendLine("</section>");
currentDay = currentDay.AddDays(1);
isFirstSection = false;
}
if (isFirstSection)
sb.AppendLine("<p>Keine Einträge im gewählten Zeitraum vorhanden.</p>");
return await SaveHtmlAsync(
fileName: $"export-tagesansicht-{startDate:yyyy-MM-dd}-bis-{endDate:yyyy-MM-dd}.html",
title: $"Export Tagesansicht {FormatDateRange(startDate, endDate)}",
bodyHtml: sb.ToString());
}
private async Task<ExportResult> ExportWeekBlockRangeHtmlAsync(DateTime startDate, DateTime endDate)
{
var entries = await _healthEntryRepository.GetEntriesBetweenAsync(startDate, endDate.AddDays(1));
var activityNames = await GetActivityNamesAsync();
var symptomNamesByEntry = await GetSymptomNamesByEntryAsync(entries.Select(x => x.Id));
var sb = new StringBuilder();
sb.AppendLine("<h1>Export - Wochenblock</h1>");
sb.AppendLine($"<p class=\"summary-note\">Zeitraum: {Encode(FormatDateRange(startDate, endDate))}</p>");
var weekStart = StartOfWeekMonday(startDate);
var isFirstSection = true;
while (weekStart <= endDate.Date)
{
var daysInBlock = Enumerable.Range(0, 7)
.Select(offset => weekStart.AddDays(offset))
.Where(day => day.Date >= startDate.Date && day.Date <= endDate.Date)
.ToList();
if (daysInBlock.Count == 0)
{
weekStart = weekStart.AddDays(7);
continue;
}
var weekEntries = entries
.Where(x => x.EntryDate.Date >= daysInBlock[0].Date && x.EntryDate.Date <= daysInBlock[^1].Date)
.ToList();
if (weekEntries.Count == 0)
{
weekStart = weekStart.AddDays(7);
continue;
}
if (!isFirstSection)
sb.AppendLine("<div class=\"page-break\"></div>");
sb.AppendLine("<section class=\"export-section\">");
sb.AppendLine($"<h2>Woche {Encode(weekStart.ToString("dd.MM.yyyy"))} bis {Encode(weekStart.AddDays(6).ToString("dd.MM.yyyy"))}</h2>");
sb.AppendLine("<table>");
sb.AppendLine("<thead><tr><th>Tag</th><th>Vormittag</th><th>Nachmittag</th><th>Anzahl</th><th>Tätigkeiten</th><th>Symptome</th></tr></thead>");
sb.AppendLine("<tbody>");
foreach (var currentDay in daysInBlock)
{
var dayEntries = entries
.Where(x => x.EntryDate.Date == currentDay.Date)
.OrderBy(x => x.Timestamp)
.ThenBy(x => x.Id)
.ToList();
var morningState = CalculateWorstState(FilterEntriesForDayPart(dayEntries, DayPart.Morning).ToList());
var afternoonState = CalculateWorstState(FilterEntriesForDayPart(dayEntries, DayPart.Afternoon).ToList());
sb.AppendLine("<tr>");
sb.AppendLine($"<td>{Encode(currentDay.ToString("ddd, dd.MM.yyyy", DateHelper.GermanCulture))}</td>");
sb.AppendLine(morningState.HasValue
? StateCell(morningState.Value, GetStateText(morningState.Value))
: "<td>—</td>");
sb.AppendLine(afternoonState.HasValue
? StateCell(afternoonState.Value, GetStateText(afternoonState.Value))
: "<td>—</td>");
sb.AppendLine($"<td>{dayEntries.Count}</td>");
sb.AppendLine($"<td>{Encode(BuildDistinctActivityList(dayEntries, activityNames))}</td>");
sb.AppendLine($"<td>{Encode(BuildDistinctSymptomList(dayEntries, symptomNamesByEntry))}</td>");
sb.AppendLine("</tr>");
}
sb.AppendLine("</tbody></table>");
sb.AppendLine("</section>");
weekStart = weekStart.AddDays(7);
isFirstSection = false;
}
if (isFirstSection)
sb.AppendLine("<p>Keine Einträge im gewählten Zeitraum vorhanden.</p>");
return await SaveHtmlAsync(
fileName: $"export-wochenblock-{startDate:yyyy-MM-dd}-bis-{endDate:yyyy-MM-dd}.html",
title: $"Export Wochenblock {FormatDateRange(startDate, endDate)}",
bodyHtml: sb.ToString(),
compactA4: true);
}
private async Task<ExportResult> ExportDaySummaryRangeHtmlAsync(DateTime startDate, DateTime endDate)
{
var entries = await _healthEntryRepository.GetEntriesBetweenAsync(startDate, endDate.AddDays(1));
var activityNames = await GetActivityNamesAsync();
var symptomNamesByEntry = await GetSymptomNamesByEntryAsync(entries.Select(x => x.Id));
var sb = new StringBuilder();
sb.AppendLine("<h1>Export - Tageszusammenfassung</h1>");
sb.AppendLine($"<p class=\"summary-note\">Zeitraum: {Encode(FormatDateRange(startDate, endDate))}</p>");
sb.AppendLine("<table>");
sb.AppendLine("""
<thead>
<tr>
<th class="summary-day">Tag</th>
<th class="compact-count">Anzahl</th>
<th>Status</th>
<th class="compact-activity">Tätigkeiten</th>
<th class="compact-symptoms">Symptome</th>
</tr>
</thead>
<tbody>
""");
var currentDay = startDate.Date;
while (currentDay <= endDate.Date)
{
var dayEntries = entries
.Where(x => x.EntryDate.Date == currentDay.Date)
.OrderBy(x => x.Timestamp)
.ThenBy(x => x.Id)
.ToList();
var worstState = CalculateWorstState(dayEntries);
sb.AppendLine("<tr>");
sb.AppendLine($"<td class=\"summary-day\">{Encode(currentDay.ToString("ddd, dd.MM.yyyy", DateHelper.GermanCulture))}</td>");
sb.AppendLine($"<td class=\"compact-count\">{dayEntries.Count}</td>");
sb.AppendLine(worstState.HasValue
? StateCellCompact(worstState.Value, GetStateText(worstState.Value))
: "<td>—</td>");
sb.AppendLine($"<td class=\"compact-activity\">{Encode(BuildDistinctActivityList(dayEntries, activityNames))}</td>");
sb.AppendLine($"<td class=\"compact-symptoms\">{Encode(BuildDistinctSymptomList(dayEntries, symptomNamesByEntry))}</td>");
sb.AppendLine("</tr>");
currentDay = currentDay.AddDays(1);
}
sb.AppendLine("</tbody></table>");
return await SaveHtmlAsync(
fileName: $"export-tageszusammenfassung-{startDate:yyyy-MM-dd}-bis-{endDate:yyyy-MM-dd}.html",
title: $"Export Tageszusammenfassung {FormatDateRange(startDate, endDate)}",
bodyHtml: sb.ToString(),
compactA4: true);
}
private async Task<ExportResult> ExportDayHtmlAsync(DateTime date) private async Task<ExportResult> ExportDayHtmlAsync(DateTime date)
{ {
var entries = await _healthEntryRepository.GetEntriesForDateAsync(date); var entries = await _healthEntryRepository.GetEntriesForDateAsync(date);
@@ -315,6 +518,88 @@ public sealed class PdfExportService : IPdfExportService
.ToList()); .ToList());
} }
private void AppendDayDetailTable(
StringBuilder sb,
IReadOnlyList<HealthEntry> entries,
IReadOnlyDictionary<int, string> activityNames,
IReadOnlyDictionary<int, List<string>> symptomNamesByEntry)
{
var conflicts = DetectDayExportConflicts(entries);
if (conflicts.Count > 0)
sb.AppendLine(BuildConflictHtml(conflicts));
sb.AppendLine("<table>");
sb.AppendLine("<thead><tr><th>Zeit</th><th>Status</th><th>Tätigkeit</th><th>Dauer</th><th>Symptome</th></tr></thead>");
sb.AppendLine("<tbody>");
foreach (var entry in entries)
{
var symptoms = symptomNamesByEntry.TryGetValue(entry.Id, out var symptomList) && symptomList.Count > 0
? string.Join(", ", symptomList)
: "—";
var activity = entry.ActivityId.HasValue && activityNames.TryGetValue(entry.ActivityId.Value, out var activityName)
? activityName
: "—";
sb.AppendLine("<tr>");
sb.AppendLine($"<td>{Encode(GetDayTimeLabel(entry))}</td>");
sb.AppendLine(StateCell(entry.State, GetStateText(entry.State)));
sb.AppendLine($"<td>{Encode(activity)}</td>");
sb.AppendLine($"<td>{Encode(FormatDuration(entry.ActivityDurationMinutes))}</td>");
sb.AppendLine($"<td>{Encode(symptoms)}</td>");
sb.AppendLine("</tr>");
}
if (entries.Count == 0)
sb.AppendLine("<tr><td colspan=\"5\">Keine Einträge vorhanden.</td></tr>");
sb.AppendLine("</tbody></table>");
}
private string BuildDistinctActivityList(IEnumerable<HealthEntry> entries, IReadOnlyDictionary<int, string> activityNames)
{
var activities = entries
.Where(x => x.ActivityId.HasValue && activityNames.ContainsKey(x.ActivityId.Value))
.Select(x => activityNames[x.ActivityId!.Value])
.Where(x => !string.IsNullOrWhiteSpace(x))
.Where(x => !string.Equals(x, "Keine Tätigkeit", StringComparison.OrdinalIgnoreCase))
.Distinct()
.OrderBy(x => x)
.ToList();
return activities.Count > 0
? string.Join(", ", activities)
: "—";
}
private static string BuildDistinctSymptomList(IEnumerable<HealthEntry> entries, IReadOnlyDictionary<int, List<string>> symptomNamesByEntry)
{
var symptoms = entries
.Where(x => symptomNamesByEntry.ContainsKey(x.Id))
.SelectMany(x => symptomNamesByEntry[x.Id])
.Distinct()
.OrderBy(x => x)
.ToList();
return symptoms.Count > 0
? string.Join(", ", symptoms)
: "—";
}
private static IEnumerable<HealthEntry> FilterEntriesForDayPart(IEnumerable<HealthEntry> entries, DayPart part)
{
return entries.Where(x =>
{
if (x.DayPart.HasValue)
return x.DayPart == part;
return part == DayPart.Morning
? x.Timestamp.Hour < 12
: x.Timestamp.Hour >= 12;
});
}
private async Task<ExportResult> SaveHtmlAsync( private async Task<ExportResult> SaveHtmlAsync(
string fileName, string fileName,
string title, string title,
@@ -378,6 +663,23 @@ public sealed class PdfExportService : IPdfExportService
_ => string.Empty _ => string.Empty
}; };
private static (DateTime StartDate, DateTime EndDate) NormalizeDateRange(DateTime startDate, DateTime endDate)
{
var rangeStart = startDate.Date;
var rangeEnd = endDate.Date;
return rangeEnd < rangeStart
? (rangeEnd, rangeStart)
: (rangeStart, rangeEnd);
}
private static string FormatDateRange(DateTime startDate, DateTime endDate)
{
return startDate.Date == endDate.Date
? startDate.ToString("dd.MM.yyyy", DateHelper.GermanCulture)
: $"{startDate:dd.MM.yyyy} bis {endDate:dd.MM.yyyy}";
}
private static DateTime StartOfWeekMonday(DateTime date) private static DateTime StartOfWeekMonday(DateTime date)
{ {
var diff = ((int)date.DayOfWeek + 6) % 7; var diff = ((int)date.DayOfWeek + 6) % 7;
@@ -467,6 +769,24 @@ public sealed class PdfExportService : IPdfExportService
font-size: {{(compactA4 ? "18px" : "28px")}}; font-size: {{(compactA4 ? "18px" : "28px")}};
} }
h2 {
margin: {{(compactA4 ? "8px" : "16px")}} 0 {{(compactA4 ? "6px" : "10px")}} 0;
font-size: {{(compactA4 ? "15px" : "22px")}};
}
.summary-note {
margin: 0 0 {{(compactA4 ? "8px" : "14px")}} 0;
}
.export-section + .export-section {
margin-top: {{(compactA4 ? "8px" : "14px")}};
}
.page-break {
break-before: page;
page-break-before: always;
}
table { table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
@@ -512,6 +832,11 @@ public sealed class PdfExportService : IPdfExportService
width: 32%; width: 32%;
} }
.summary-day {
width: 18%;
white-space: nowrap;
}
.conflict-box { .conflict-box {
border: 1px solid #000000; border: 1px solid #000000;
background: #fff8e1; background: #fff8e1;
+90 -1
View File
@@ -48,6 +48,15 @@ public partial class OptionsViewModel : ObservableObject
[ObservableProperty] [ObservableProperty]
private OptionsTab selectedTab = OptionsTab.Notifications; private OptionsTab selectedTab = OptionsTab.Notifications;
[ObservableProperty]
private DateTime exportStartDate = DateTime.Today;
[ObservableProperty]
private DateTime exportEndDate = DateTime.Today;
[ObservableProperty]
private ExportLayout selectedExportLayout = ExportLayout.DaySummary;
public ObservableCollection<AppearanceColorItemViewModel> AppearanceColors { get; } = new(); public ObservableCollection<AppearanceColorItemViewModel> AppearanceColors { get; } = new();
public ObservableCollection<AppearanceTextItemViewModel> StatusTexts { get; } = new(); public ObservableCollection<AppearanceTextItemViewModel> StatusTexts { get; } = new();
public ObservableCollection<ActivityManageItemViewModel> Activities { get; } = new(); public ObservableCollection<ActivityManageItemViewModel> Activities { get; } = new();
@@ -57,8 +66,33 @@ public partial class OptionsViewModel : ObservableObject
public bool IsAppearanceTabSelected => SelectedTab == OptionsTab.Appearance; public bool IsAppearanceTabSelected => SelectedTab == OptionsTab.Appearance;
public bool IsNotificationsTabSelected => SelectedTab == OptionsTab.Notifications; public bool IsNotificationsTabSelected => SelectedTab == OptionsTab.Notifications;
public bool IsDataManagementTabSelected => SelectedTab == OptionsTab.DataManagement; public bool IsDataManagementTabSelected => SelectedTab == OptionsTab.DataManagement;
public bool IsExportTabSelected => SelectedTab == OptionsTab.Export;
public string NotificationVibrationButtonText => NotificationVibrationEnabled ? "Aktiv" : "Inaktiv"; public string NotificationVibrationButtonText => NotificationVibrationEnabled ? "Aktiv" : "Inaktiv";
public bool IsDayViewExportLayoutSelected => SelectedExportLayout == ExportLayout.DayView;
public bool IsWeekBlockExportLayoutSelected => SelectedExportLayout == ExportLayout.WeekBlock;
public bool IsDaySummaryExportLayoutSelected => SelectedExportLayout == ExportLayout.DaySummary;
public string ExportRangeSummary
{
get
{
var start = ExportStartDate.Date;
var end = ExportEndDate.Date;
var totalDays = (end - start).Days + 1;
return totalDays == 1
? $"1 Tag ausgewählt: {start:dd.MM.yyyy}"
: $"{totalDays} Tage ausgewählt: {start:dd.MM.yyyy} bis {end:dd.MM.yyyy}";
}
}
public string SelectedExportLayoutDescription => SelectedExportLayout switch
{
ExportLayout.DayView => "Tagesansicht: Jeder Tag wird mit allen einzelnen Einträgen, Tätigkeiten, Dauer und Symptomen exportiert.",
ExportLayout.WeekBlock => "Wochenblock: Der Zeitraum wird in Wochen gruppiert. Pro Tag siehst du Vormittag, Nachmittag und die wichtigsten Details.",
_ => "Tageszusammenfassung: Jeder Tag erscheint kompakt in einer Zeile, ähnlich wie bei Monats- und Jahresexporten."
};
public IAsyncRelayCommand DeleteAllDataCommand { get; } public IAsyncRelayCommand DeleteAllDataCommand { get; }
public IAsyncRelayCommand SaveAppearanceCommand { get; } public IAsyncRelayCommand SaveAppearanceCommand { get; }
@@ -76,10 +110,15 @@ public partial class OptionsViewModel : ObservableObject
public IAsyncRelayCommand<NotificationScheduleItemViewModel> DeleteScheduleCommand { get; } public IAsyncRelayCommand<NotificationScheduleItemViewModel> DeleteScheduleCommand { get; }
public IAsyncRelayCommand SaveDatabaseLocationCommand { get; } public IAsyncRelayCommand SaveDatabaseLocationCommand { get; }
public IAsyncRelayCommand ClearExportsCommand { get; } public IAsyncRelayCommand ClearExportsCommand { get; }
public IAsyncRelayCommand ExportSelectedRangeCommand { get; }
public IRelayCommand ToggleNotificationVibrationCommand { get; } public IRelayCommand ToggleNotificationVibrationCommand { get; }
public IRelayCommand ShowAppearanceTabCommand { get; } public IRelayCommand ShowAppearanceTabCommand { get; }
public IRelayCommand ShowNotificationsTabCommand { get; } public IRelayCommand ShowNotificationsTabCommand { get; }
public IRelayCommand ShowDataManagementTabCommand { get; } public IRelayCommand ShowDataManagementTabCommand { get; }
public IRelayCommand ShowExportTabCommand { get; }
public IRelayCommand SelectDayViewExportLayoutCommand { get; }
public IRelayCommand SelectWeekBlockExportLayoutCommand { get; }
public IRelayCommand SelectDaySummaryExportLayoutCommand { get; }
public OptionsViewModel( public OptionsViewModel(
HealthEntryRepository healthEntryRepository, HealthEntryRepository healthEntryRepository,
@@ -120,6 +159,7 @@ public partial class OptionsViewModel : ObservableObject
DeleteScheduleCommand = new AsyncRelayCommand<NotificationScheduleItemViewModel>(DeleteScheduleAsync); DeleteScheduleCommand = new AsyncRelayCommand<NotificationScheduleItemViewModel>(DeleteScheduleAsync);
SaveDatabaseLocationCommand = new AsyncRelayCommand(SaveDatabaseLocationAsync); SaveDatabaseLocationCommand = new AsyncRelayCommand(SaveDatabaseLocationAsync);
ClearExportsCommand = new AsyncRelayCommand(ClearExportsAsync); ClearExportsCommand = new AsyncRelayCommand(ClearExportsAsync);
ExportSelectedRangeCommand = new AsyncRelayCommand(ExportSelectedRangeAsync);
ToggleNotificationVibrationCommand = new RelayCommand(() => ToggleNotificationVibrationCommand = new RelayCommand(() =>
{ {
@@ -129,6 +169,11 @@ public partial class OptionsViewModel : ObservableObject
ShowAppearanceTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.Appearance); ShowAppearanceTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.Appearance);
ShowNotificationsTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.Notifications); ShowNotificationsTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.Notifications);
ShowDataManagementTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.DataManagement); ShowDataManagementTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.DataManagement);
ShowExportTabCommand = new RelayCommand(() => SelectedTab = OptionsTab.Export);
SelectDayViewExportLayoutCommand = new RelayCommand(() => SelectedExportLayout = ExportLayout.DayView);
SelectWeekBlockExportLayoutCommand = new RelayCommand(() => SelectedExportLayout = ExportLayout.WeekBlock);
SelectDaySummaryExportLayoutCommand = new RelayCommand(() => SelectedExportLayout = ExportLayout.DaySummary);
} }
partial void OnDeleteConfirmationTextChanged(string value) partial void OnDeleteConfirmationTextChanged(string value)
@@ -141,6 +186,7 @@ public partial class OptionsViewModel : ObservableObject
OnPropertyChanged(nameof(IsAppearanceTabSelected)); OnPropertyChanged(nameof(IsAppearanceTabSelected));
OnPropertyChanged(nameof(IsNotificationsTabSelected)); OnPropertyChanged(nameof(IsNotificationsTabSelected));
OnPropertyChanged(nameof(IsDataManagementTabSelected)); OnPropertyChanged(nameof(IsDataManagementTabSelected));
OnPropertyChanged(nameof(IsExportTabSelected));
} }
partial void OnNotificationVibrationEnabledChanged(bool value) partial void OnNotificationVibrationEnabledChanged(bool value)
@@ -148,6 +194,30 @@ public partial class OptionsViewModel : ObservableObject
OnPropertyChanged(nameof(NotificationVibrationButtonText)); OnPropertyChanged(nameof(NotificationVibrationButtonText));
} }
partial void OnExportStartDateChanged(DateTime value)
{
if (ExportEndDate.Date < value.Date)
ExportEndDate = value.Date;
OnPropertyChanged(nameof(ExportRangeSummary));
}
partial void OnExportEndDateChanged(DateTime value)
{
if (ExportStartDate.Date > value.Date)
ExportStartDate = value.Date;
OnPropertyChanged(nameof(ExportRangeSummary));
}
partial void OnSelectedExportLayoutChanged(ExportLayout value)
{
OnPropertyChanged(nameof(IsDayViewExportLayoutSelected));
OnPropertyChanged(nameof(IsWeekBlockExportLayoutSelected));
OnPropertyChanged(nameof(IsDaySummaryExportLayoutSelected));
OnPropertyChanged(nameof(SelectedExportLayoutDescription));
}
public async Task LoadAsync() public async Task LoadAsync()
{ {
await LoadAppearanceAsync(); await LoadAppearanceAsync();
@@ -509,6 +579,24 @@ public partial class OptionsViewModel : ObservableObject
return Task.CompletedTask; return Task.CompletedTask;
} }
private async Task ExportSelectedRangeAsync()
{
try
{
var result = await _pdfExportService.ExportRangeAsync(
ExportStartDate.Date,
ExportEndDate.Date,
SelectedExportLayout);
StatusText = $"Export erstellt: {result.FileName}";
await ExportUiHelper.ShowExportSavedActionsAsync(result);
}
catch (Exception ex)
{
StatusText = ex.Message;
}
}
private async Task ClearExportsAsync() private async Task ClearExportsAsync()
{ {
var confirm = await Shell.Current.DisplayAlertAsync( var confirm = await Shell.Current.DisplayAlertAsync(
@@ -544,6 +632,7 @@ public partial class OptionsViewModel : ObservableObject
{ {
Appearance, Appearance,
Notifications, Notifications,
DataManagement DataManagement,
Export
} }
} }
+2 -1
View File
@@ -3,6 +3,7 @@
x:Name="RootPage" x:Name="RootPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:cfs_tracker.Views"
xmlns:viewModels="clr-namespace:cfs_tracker.ViewModels" xmlns:viewModels="clr-namespace:cfs_tracker.ViewModels"
x:DataType="viewModels:MonthViewModel" x:DataType="viewModels:MonthViewModel"
Title="Monat" Title="Monat"
@@ -76,7 +77,7 @@
Padding="6" Padding="6"
MinimumHeightRequest="58"> MinimumHeightRequest="58">
<Border.GestureRecognizers> <Border.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.OpenDayCommand}" <TapGestureRecognizer Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.OpenDayCommand, x:DataType=views:MonthPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</Border.GestureRecognizers> </Border.GestureRecognizers>
+1
View File
@@ -5,6 +5,7 @@ namespace cfs_tracker.Views;
public partial class MonthPage : ContentPage public partial class MonthPage : ContentPage
{ {
private readonly MonthViewModel _viewModel; private readonly MonthViewModel _viewModel;
public MonthViewModel ViewModel => _viewModel;
public MonthPage(MonthViewModel viewModel) public MonthPage(MonthViewModel viewModel)
{ {
+129 -20
View File
@@ -3,6 +3,7 @@
x:Name="RootPage" x:Name="RootPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:cfs_tracker.Views"
xmlns:viewModels="clr-namespace:cfs_tracker.ViewModels" xmlns:viewModels="clr-namespace:cfs_tracker.ViewModels"
x:DataType="viewModels:OptionsViewModel" x:DataType="viewModels:OptionsViewModel"
Title="Optionen" Title="Optionen"
@@ -91,6 +92,21 @@
</DataTrigger> </DataTrigger>
</Button.Triggers> </Button.Triggers>
</Button> </Button>
<Button Text="Export"
Style="{StaticResource OptionsTabButtonStyle}"
Command="{Binding ShowExportTabCommand}">
<Button.Triggers>
<DataTrigger TargetType="Button"
Binding="{Binding IsExportTabSelected}"
Value="True">
<Setter Property="BackgroundColor"
Value="{DynamicResource ButtonSecondaryBackground}" />
<Setter Property="TextColor"
Value="{DynamicResource ButtonSecondaryText}" />
</DataTrigger>
</Button.Triggers>
</Button>
</FlexLayout> </FlexLayout>
</Border> </Border>
@@ -332,7 +348,7 @@
<Button Text="Entfernen" <Button Text="Entfernen"
Style="{StaticResource SecondaryButtonStyle}" Style="{StaticResource SecondaryButtonStyle}"
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.DeleteScheduleCommand}" Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.DeleteScheduleCommand, x:DataType=views:OptionsPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</VerticalStackLayout> </VerticalStackLayout>
</Border> </Border>
@@ -347,6 +363,112 @@
</Border> </Border>
</VerticalStackLayout> </VerticalStackLayout>
<VerticalStackLayout IsVisible="{Binding IsExportTabSelected}"
Spacing="16">
<Border Padding="12"
Stroke="{DynamicResource Border}"
BackgroundColor="{DynamicResource SurfaceBackground}">
<VerticalStackLayout Spacing="12">
<Label Text="Export"
FontSize="20"
FontAttributes="Bold"
TextColor="{DynamicResource TextPrimary}" />
<Label Text="Lege Zeitraum und Darstellung fest. Nach dem Erstellen kannst du den Export direkt öffnen oder teilen."
TextColor="{DynamicResource TextMuted}" />
<Grid ColumnDefinitions="*,*"
ColumnSpacing="12">
<VerticalStackLayout Spacing="4">
<Label Text="Von"
TextColor="{DynamicResource TextPrimary}" />
<DatePicker Date="{Binding ExportStartDate}"
MaximumDate="{Binding ExportEndDate}" />
</VerticalStackLayout>
<VerticalStackLayout Grid.Column="1"
Spacing="4">
<Label Text="Bis"
TextColor="{DynamicResource TextPrimary}" />
<DatePicker Date="{Binding ExportEndDate}"
MinimumDate="{Binding ExportStartDate}" />
</VerticalStackLayout>
</Grid>
<Label Text="{Binding ExportRangeSummary}"
TextColor="{DynamicResource TextMuted}" />
<Label Text="Exportmodus"
FontAttributes="Bold"
TextColor="{DynamicResource TextPrimary}" />
<FlexLayout Direction="Row"
Wrap="Wrap"
AlignItems="Start"
JustifyContent="Start">
<Button Text="Tagesansicht"
Style="{StaticResource DayToggleButtonStyle}"
Margin="0,0,10,10"
Command="{Binding SelectDayViewExportLayoutCommand}">
<Button.Triggers>
<DataTrigger TargetType="Button"
Binding="{Binding IsDayViewExportLayoutSelected}"
Value="True">
<Setter Property="BackgroundColor"
Value="{DynamicResource ButtonSecondaryBackground}" />
<Setter Property="TextColor"
Value="{DynamicResource ButtonSecondaryText}" />
</DataTrigger>
</Button.Triggers>
</Button>
<Button Text="Wochenblock"
Style="{StaticResource DayToggleButtonStyle}"
Margin="0,0,10,10"
Command="{Binding SelectWeekBlockExportLayoutCommand}">
<Button.Triggers>
<DataTrigger TargetType="Button"
Binding="{Binding IsWeekBlockExportLayoutSelected}"
Value="True">
<Setter Property="BackgroundColor"
Value="{DynamicResource ButtonSecondaryBackground}" />
<Setter Property="TextColor"
Value="{DynamicResource ButtonSecondaryText}" />
</DataTrigger>
</Button.Triggers>
</Button>
<Button Text="Tageszusammenfassung"
Style="{StaticResource DayToggleButtonStyle}"
Margin="0,0,10,10"
Command="{Binding SelectDaySummaryExportLayoutCommand}">
<Button.Triggers>
<DataTrigger TargetType="Button"
Binding="{Binding IsDaySummaryExportLayoutSelected}"
Value="True">
<Setter Property="BackgroundColor"
Value="{DynamicResource ButtonSecondaryBackground}" />
<Setter Property="TextColor"
Value="{DynamicResource ButtonSecondaryText}" />
</DataTrigger>
</Button.Triggers>
</Button>
</FlexLayout>
<Label Text="{Binding SelectedExportLayoutDescription}"
TextColor="{DynamicResource TextMuted}" />
<Button Text="Export erstellen"
Style="{StaticResource PrimaryButtonStyle}"
Command="{Binding ExportSelectedRangeCommand}" />
<Button Text="Export entleeren"
Style="{StaticResource SecondaryButtonStyle}"
Command="{Binding ClearExportsCommand}" />
</VerticalStackLayout>
</Border>
</VerticalStackLayout>
<VerticalStackLayout IsVisible="{Binding IsDataManagementTabSelected}" <VerticalStackLayout IsVisible="{Binding IsDataManagementTabSelected}"
Spacing="16"> Spacing="16">
<Border Padding="12" <Border Padding="12"
@@ -384,17 +506,17 @@
ColumnSpacing="8"> ColumnSpacing="8">
<Button Text="Speichern" <Button Text="Speichern"
Style="{StaticResource PrimaryButtonStyle}" Style="{StaticResource PrimaryButtonStyle}"
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.SaveActivityCommand}" Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.SaveActivityCommand, x:DataType=views:OptionsPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
<Button Grid.Column="1" <Button Grid.Column="1"
Text="Aktiv/Inaktiv" Text="Aktiv/Inaktiv"
Style="{StaticResource SecondaryButtonStyle}" Style="{StaticResource SecondaryButtonStyle}"
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.ToggleActivityActiveCommand}" Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.ToggleActivityActiveCommand, x:DataType=views:OptionsPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
<Button Grid.Column="2" <Button Grid.Column="2"
Text="Entfernen" Text="Entfernen"
Style="{StaticResource SecondaryButtonStyle}" Style="{StaticResource SecondaryButtonStyle}"
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.DeleteActivityCommand}" Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.DeleteActivityCommand, x:DataType=views:OptionsPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</Grid> </Grid>
</VerticalStackLayout> </VerticalStackLayout>
@@ -440,17 +562,17 @@
ColumnSpacing="8"> ColumnSpacing="8">
<Button Text="Speichern" <Button Text="Speichern"
Style="{StaticResource PrimaryButtonStyle}" Style="{StaticResource PrimaryButtonStyle}"
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.SaveSymptomCommand}" Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.SaveSymptomCommand, x:DataType=views:OptionsPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
<Button Grid.Column="1" <Button Grid.Column="1"
Text="Aktiv/Inaktiv" Text="Aktiv/Inaktiv"
Style="{StaticResource SecondaryButtonStyle}" Style="{StaticResource SecondaryButtonStyle}"
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.ToggleSymptomActiveCommand}" Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.ToggleSymptomActiveCommand, x:DataType=views:OptionsPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
<Button Grid.Column="2" <Button Grid.Column="2"
Text="Entfernen" Text="Entfernen"
Style="{StaticResource SecondaryButtonStyle}" Style="{StaticResource SecondaryButtonStyle}"
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.DeleteSymptomCommand}" Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.DeleteSymptomCommand, x:DataType=views:OptionsPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</Grid> </Grid>
</VerticalStackLayout> </VerticalStackLayout>
@@ -512,19 +634,6 @@
</VerticalStackLayout> </VerticalStackLayout>
</Border> </Border>
<Border Padding="12"
Stroke="{DynamicResource Border}"
BackgroundColor="{DynamicResource SurfaceBackground}">
<VerticalStackLayout Spacing="10">
<Label Text="Export"
FontAttributes="Bold"
TextColor="{DynamicResource TextPrimary}" />
<Button Text="Export entleeren"
Style="{StaticResource SecondaryButtonStyle}"
Command="{Binding ClearExportsCommand}" />
</VerticalStackLayout>
</Border>
</VerticalStackLayout> </VerticalStackLayout>
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView> </ScrollView>
+1
View File
@@ -12,6 +12,7 @@ public partial class OptionsPage : ContentPage
private static readonly Regex HexColorRegex = new("^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$", RegexOptions.Compiled); private static readonly Regex HexColorRegex = new("^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$", RegexOptions.Compiled);
private readonly OptionsViewModel _viewModel; private readonly OptionsViewModel _viewModel;
public OptionsViewModel ViewModel => _viewModel;
private bool _isLoading; private bool _isLoading;
private bool _appearanceEditorsBuilt; private bool _appearanceEditorsBuilt;
private bool _appearanceEditorsDirty = true; private bool _appearanceEditorsDirty = true;
+4 -32
View File
@@ -4,40 +4,12 @@
x:Name="RootPage" x:Name="RootPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:cfs_tracker.Views"
xmlns:viewModels="clr-namespace:cfs_tracker.ViewModels" xmlns:viewModels="clr-namespace:cfs_tracker.ViewModels"
x:DataType="viewModels:QuickEntryViewModel" x:DataType="viewModels:QuickEntryViewModel"
Title="Eintrag" Title="Eintrag"
BackgroundColor="{DynamicResource AppBackground}"> BackgroundColor="{DynamicResource AppBackground}">
<ContentPage.Resources>
<Style x:Key="SymptomToggleBorderStyle" TargetType="Border">
<Setter Property="Padding" Value="12,10" />
<Setter Property="StrokeThickness" Value="1" />
<Setter Property="Stroke" Value="{DynamicResource Border}" />
<Setter Property="StrokeShape" Value="RoundRectangle 12" />
<Setter Property="BackgroundColor" Value="{DynamicResource ButtonPrimaryBackground}" />
<Style.Triggers>
<DataTrigger TargetType="Border"
Binding="{Binding IsSelected}"
Value="True">
<Setter Property="BackgroundColor" Value="{DynamicResource ButtonSecondaryBackground}" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="SymptomToggleLabelStyle" TargetType="Label">
<Setter Property="VerticalOptions" Value="Center" />
<Setter Property="TextColor" Value="{DynamicResource ButtonPrimaryText}" />
<Style.Triggers>
<DataTrigger TargetType="Label"
Binding="{Binding IsSelected}"
Value="True">
<Setter Property="TextColor" Value="{DynamicResource ButtonSecondaryText}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentPage.Resources>
<ScrollView> <ScrollView>
<VerticalStackLayout Padding="16" Spacing="16"> <VerticalStackLayout Padding="16" Spacing="16">
@@ -63,7 +35,7 @@
TextColor="{DynamicResource TextPrimary}" /> TextColor="{DynamicResource TextPrimary}" />
<Picker Title="Tageszeit" <Picker Title="Tageszeit"
ItemsSource="{Binding Parts}" ItemsSource="{Binding Parts}"
ItemDisplayBinding="{Binding Name, x:DataType={x:Null}}" ItemDisplayBinding="{Binding Name, x:DataType=viewModels:DayPartOptionItemViewModel}"
SelectedItem="{Binding SelectedPart}" /> SelectedItem="{Binding SelectedPart}" />
</VerticalStackLayout> </VerticalStackLayout>
</Border> </Border>
@@ -78,7 +50,7 @@
TextColor="{DynamicResource TextPrimary}" /> TextColor="{DynamicResource TextPrimary}" />
<Picker Title="Tätigkeit" <Picker Title="Tätigkeit"
ItemsSource="{Binding Activities}" ItemsSource="{Binding Activities}"
ItemDisplayBinding="{Binding Name, x:DataType={x:Null}}" ItemDisplayBinding="{Binding Name, x:DataType=viewModels:ActivityPickerItemViewModel}"
SelectedItem="{Binding SelectedActivity}" /> SelectedItem="{Binding SelectedActivity}" />
<Label Text="Dauer (HH:mm)" <Label Text="Dauer (HH:mm)"
@@ -109,7 +81,7 @@
BackgroundColor="{DynamicResource ButtonPrimaryBackground}"> BackgroundColor="{DynamicResource ButtonPrimaryBackground}">
<Border.GestureRecognizers> <Border.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer
Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.ToggleSymptomCommand}" Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.ToggleSymptomCommand, x:DataType=views:QuickEntryPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</Border.GestureRecognizers> </Border.GestureRecognizers>
+1
View File
@@ -5,6 +5,7 @@ namespace cfs_tracker.Views;
public partial class QuickEntryPage : ContentPage, IQueryAttributable public partial class QuickEntryPage : ContentPage, IQueryAttributable
{ {
private readonly QuickEntryViewModel _vm; private readonly QuickEntryViewModel _vm;
public QuickEntryViewModel ViewModel => _vm;
public QuickEntryPage(QuickEntryViewModel vm) public QuickEntryPage(QuickEntryViewModel vm)
{ {
+2 -1
View File
@@ -3,6 +3,7 @@
x:Name="RootPage" x:Name="RootPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:cfs_tracker.Views"
xmlns:viewModels="clr-namespace:cfs_tracker.ViewModels" xmlns:viewModels="clr-namespace:cfs_tracker.ViewModels"
x:DataType="viewModels:YearViewModel" x:DataType="viewModels:YearViewModel"
Title="Jahr" Title="Jahr"
@@ -88,7 +89,7 @@
Padding="3" Padding="3"
MinimumHeightRequest="30"> MinimumHeightRequest="30">
<Border.GestureRecognizers> <Border.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source={x:Reference RootPage}, Path=BindingContext.OpenDayCommand}" <TapGestureRecognizer Command="{Binding Source={x:Reference RootPage}, Path=ViewModel.OpenDayCommand, x:DataType=views:YearPage}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</Border.GestureRecognizers> </Border.GestureRecognizers>
+1
View File
@@ -6,6 +6,7 @@ namespace cfs_tracker.Views;
public partial class YearPage : ContentPage public partial class YearPage : ContentPage
{ {
private readonly YearViewModel _viewModel; private readonly YearViewModel _viewModel;
public YearViewModel ViewModel => _viewModel;
public YearPage(YearViewModel viewModel) public YearPage(YearViewModel viewModel)
{ {