First version

This commit is contained in:
2026-03-19 23:11:13 +01:00
parent 7503d77c82
commit 8615d1de07
71 changed files with 3128 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Application
x:Class="cfs_tracker.App"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<Application.Resources>
<ResourceDictionary>
<Color x:Key="StateGreen">#4CAF50</Color>
<Color x:Key="StateYellow">#FBC02D</Color>
<Color x:Key="StateRed">#E53935</Color>
<Color x:Key="StateGray">#757575</Color>
<Color x:Key="CardBackground">#F2F2F2</Color>
<Color x:Key="CardBorder">#D0D0D0</Color>
<Style TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="White" />
</Style>
<Style TargetType="Label">
<Setter Property="TextColor" Value="Black" />
</Style>
<Style TargetType="Button">
<Setter Property="CornerRadius" Value="12" />
<Setter Property="Padding" Value="12,10" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
+17
View File
@@ -0,0 +1,17 @@
using Microsoft.Extensions.DependencyInjection;
namespace cfs_tracker
{
public partial class App : Application
{
public App()
{
InitializeComponent();
}
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new AppShell());
}
}
}
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="cfs_tracker.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:cfs_tracker.Views">
<TabBar>
<ShellContent
Title="Tag"
ContentTemplate="{DataTemplate views:DayPage}" />
<ShellContent
Title="Woche"
ContentTemplate="{DataTemplate views:WeekPage}" />
<ShellContent
Title="Monat"
ContentTemplate="{DataTemplate views:MonthPage}" />
<ShellContent
Title="Jahr"
ContentTemplate="{DataTemplate views:YearPage}" />
<ShellContent
Title="Optionen"
ContentTemplate="{DataTemplate views:OptionsPage}" />
</TabBar>
</Shell>
+12
View File
@@ -0,0 +1,12 @@
using cfs_tracker.Views;
namespace cfs_tracker;
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
Routing.RegisterRoute(nameof(QuickEntryPage), typeof(QuickEntryPage));
}
}
+26
View File
@@ -0,0 +1,26 @@
using SQLite;
using cfs_tracker.Models;
namespace cfs_tracker.Data;
public class AppDatabase
{
private SQLiteAsyncConnection? _database;
private bool _initialized;
public async Task InitAsync()
{
if (_initialized)
return;
var dbPath = Path.Combine(FileSystem.Current.AppDataDirectory, "mecfs_tracker.db3");
_database = new SQLiteAsyncConnection(dbPath);
await _database.CreateTableAsync<HealthEntry>();
_initialized = true;
}
public SQLiteAsyncConnection Connection =>
_database ?? throw new InvalidOperationException("Database not initialized.");
}
+181
View File
@@ -0,0 +1,181 @@
using cfs_tracker.Models;
namespace cfs_tracker.Data;
public class HealthEntryRepository
{
private readonly AppDatabase _database;
public HealthEntryRepository(AppDatabase database)
{
_database = database;
}
public async Task AddEntryAsync(
HealthState state,
EntrySource source,
DateTime? timestamp = null)
{
await _database.InitAsync();
var entry = new HealthEntry
{
Timestamp = timestamp ?? DateTime.Now,
State = state,
Source = source,
UpdatedAt = DateTime.Now
};
await _database.Connection.InsertAsync(entry);
}
public async Task UpsertBackfillAsync(
DateTime date,
DayPart part,
HealthState state,
EntrySource source)
{
await _database.InitAsync();
var slotTimestamp = BuildSlotTimestamp(date, part);
var existing = await _database.Connection.Table<HealthEntry>()
.FirstOrDefaultAsync(x => x.Timestamp == slotTimestamp);
if (existing is null)
{
var entry = new HealthEntry
{
Timestamp = slotTimestamp,
State = state,
Source = source,
UpdatedAt = DateTime.Now
};
await _database.Connection.InsertAsync(entry);
}
else
{
existing.State = state;
existing.Source = source;
existing.UpdatedAt = DateTime.Now;
await _database.Connection.UpdateAsync(existing);
}
}
public async Task<HealthEntry?> GetBackfillEntryAsync(DateTime date, DayPart part)
{
await _database.InitAsync();
var slotTimestamp = BuildSlotTimestamp(date, part);
return await _database.Connection.Table<HealthEntry>()
.FirstOrDefaultAsync(x => x.Timestamp == slotTimestamp);
}
public async Task<List<HealthEntry>> GetEntriesForDateAsync(DateTime date)
{
await _database.InitAsync();
var start = date.Date;
var end = start.AddDays(1);
var list = await _database.Connection.Table<HealthEntry>()
.Where(x => x.Timestamp >= start && x.Timestamp < end)
.ToListAsync();
return list
.OrderBy(x => x.Timestamp)
.ToList();
}
public async Task<List<HealthEntry>> GetEntriesBetweenAsync(DateTime startDate, DateTime endDate)
{
await _database.InitAsync();
var start = startDate.Date;
var end = endDate.Date;
var list = await _database.Connection.Table<HealthEntry>()
.Where(x => x.Timestamp >= start && x.Timestamp < end)
.ToListAsync();
return list
.OrderBy(x => x.Timestamp)
.ToList();
}
public async Task<List<HealthEntry>> GetMonthEntriesAsync(int year, int month)
{
var start = new DateTime(year, month, 1);
var end = start.AddMonths(1);
return await GetEntriesBetweenAsync(start, end);
}
public async Task<List<HealthEntry>> GetYearEntriesAsync(int year)
{
var start = new DateTime(year, 1, 1);
var end = start.AddYears(1);
return await GetEntriesBetweenAsync(start, end);
}
public async Task DeleteEntryAsync(int id)
{
await _database.InitAsync();
var item = await _database.Connection.Table<HealthEntry>()
.FirstOrDefaultAsync(x => x.Id == id);
if (item is not null)
await _database.Connection.DeleteAsync(item);
}
public async Task DeleteBackfillEntryAsync(DateTime date, DayPart part)
{
await _database.InitAsync();
var slotTimestamp = BuildSlotTimestamp(date, part);
var item = await _database.Connection.Table<HealthEntry>()
.FirstOrDefaultAsync(x => x.Timestamp == slotTimestamp);
if (item is not null)
await _database.Connection.DeleteAsync(item);
}
public async Task DeleteAllAsync()
{
await _database.InitAsync();
await _database.Connection.DeleteAllAsync<HealthEntry>();
}
public async Task<(HealthEntry? Morning, HealthEntry? Afternoon)> GetBackfillSlotsAsync(DateTime date)
{
await _database.InitAsync();
var morningTimestamp = BuildSlotTimestamp(date, DayPart.Morning);
var afternoonTimestamp = BuildSlotTimestamp(date, DayPart.Afternoon);
var items = await _database.Connection.Table<HealthEntry>()
.Where(x => x.Timestamp == morningTimestamp || x.Timestamp == afternoonTimestamp)
.ToListAsync();
var morning = items.FirstOrDefault(x => x.Timestamp == morningTimestamp);
var afternoon = items.FirstOrDefault(x => x.Timestamp == afternoonTimestamp);
return (morning, afternoon);
}
private static DateTime BuildSlotTimestamp(DateTime date, DayPart part)
{
return part switch
{
DayPart.Morning => date.Date.AddHours(9),
DayPart.Afternoon => date.Date.AddHours(15),
_ => date.Date.AddHours(9)
};
}
}
+36
View File
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="cfs_tracker.MainPage">
<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Image
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a submarine number ten" />
<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />
<Label
Text="Welcome to &#10;.NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Fill" />
</VerticalStackLayout>
</ScrollView>
</ContentPage>
+24
View File
@@ -0,0 +1,24 @@
namespace cfs_tracker
{
public partial class MainPage : ContentPage
{
int count = 0;
public MainPage()
{
InitializeComponent();
}
private void OnCounterClicked(object? sender, EventArgs e)
{
count++;
if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";
SemanticScreenReader.Announce(CounterBtn.Text);
}
}
}
+44
View File
@@ -0,0 +1,44 @@
using cfs_tracker.Data;
using cfs_tracker.Services;
using cfs_tracker.ViewModels;
using cfs_tracker.Views;
namespace cfs_tracker;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
builder.Services.AddSingleton<AppDatabase>();
builder.Services.AddSingleton<HealthEntryRepository>();
builder.Services.AddSingleton<AggregationService>();
builder.Services.AddSingleton<PdfExportService>();
builder.Services.AddTransient<DayViewModel>();
builder.Services.AddTransient<WeekViewModel>();
builder.Services.AddTransient<MonthViewModel>();
builder.Services.AddTransient<YearViewModel>();
builder.Services.AddTransient<QuickEntryViewModel>();
builder.Services.AddTransient<DayPage>();
builder.Services.AddTransient<WeekPage>();
builder.Services.AddTransient<MonthPage>();
builder.Services.AddTransient<YearPage>();
builder.Services.AddTransient<QuickEntryPage>();
builder.Services.AddTransient<OptionsViewModel>();
builder.Services.AddTransient<OptionsPage>();
return builder.Build();
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace cfs_tracker.Models
{
public class CalendarDaySummary
{
public DateTime Date { get; set; }
public double? Average { get; set; } // null = kein Eintrag
public int EntryCount { get; set; }
public HealthState? DisplayState { get; set; }
}
}
+14
View File
@@ -0,0 +1,14 @@
namespace cfs_tracker.Models
{
public class DayDetailSummary
{
public DateTime Date { get; set; }
public int GreenCount { get; set; }
public int YellowCount { get; set; }
public int RedCount { get; set; }
public int GrayCount { get; set; }
public List<HealthEntry> Entries { get; set; } = new();
}
}
+7
View File
@@ -0,0 +1,7 @@
namespace cfs_tracker.Models;
public enum DayPart
{
Morning = 0,
Afternoon = 1
}
+8
View File
@@ -0,0 +1,8 @@
namespace cfs_tracker.Models
{
public enum EntrySource
{
App = 0,
Notification = 1
}
}
+16
View File
@@ -0,0 +1,16 @@
using cfs_tracker.Models;
using SQLite;
public class HealthEntry
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public DateTime Timestamp { get; set; }
public HealthState State { get; set; }
public EntrySource Source { get; set; }
public DateTime UpdatedAt { get; set; }
}
+10
View File
@@ -0,0 +1,10 @@
namespace cfs_tracker.Models
{
public enum HealthState
{
Gray = 0, // Totalausfall
Red = 1, // schlecht
Yellow = 2, // so lala
Green = 3 // gut
}
}
+28
View File
@@ -0,0 +1,28 @@
namespace cfs_tracker.Models;
public static class HealthStateExtensions
{
public static Color ToColor(this HealthState state)
{
return state switch
{
HealthState.Green => Color.FromArgb("#4CAF50"),
HealthState.Yellow => Color.FromArgb("#FBC02D"),
HealthState.Red => Color.FromArgb("#E53935"),
HealthState.Gray => Color.FromArgb("#757575"),
_ => Colors.Transparent
};
}
public static string ToLabel(this HealthState state)
{
return state switch
{
HealthState.Green => "Gut",
HealthState.Yellow => "So lala",
HealthState.Red => "Schlecht",
HealthState.Gray => "Totalausfall",
_ => ""
};
}
}
+13
View File
@@ -0,0 +1,13 @@
namespace cfs_tracker.Models
{
public class WeekDaySummary
{
public DateTime Date { get; set; }
public double? MorningAverage { get; set; } // vor 12 Uhr
public double? AfternoonAverage { get; set; } // ab 12 Uhr
public int MorningCount { get; set; }
public int AfternoonCount { get; set; }
}
}
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
+22
View File
@@ -0,0 +1,22 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
namespace cfs_tracker;
[Activity(
Theme = "@style/Maui.SplashTheme",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize
| ConfigChanges.Orientation
| ConfigChanges.UiMode
| ConfigChanges.ScreenLayout
| ConfigChanges.SmallestScreenSize
| ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
}
}
+16
View File
@@ -0,0 +1,16 @@
using Android.App;
using Android.Runtime;
namespace cfs_tracker
{
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
+10
View File
@@ -0,0 +1,10 @@
using Foundation;
namespace cfs_tracker
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
<dict>
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. -->
<key>com.apple.security.app-sandbox</key>
<true/>
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. -->
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
+40
View File
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- The Mac App Store requires you specify if the app uses encryption. -->
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/itsappusesnonexemptencryption -->
<!-- <key>ITSAppUsesNonExemptEncryption</key> -->
<!-- Please indicate <true/> or <false/> here. -->
<!-- Specify the category for your app here. -->
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype -->
<!-- <key>LSApplicationCategoryType</key> -->
<!-- <string>public.app-category.YOUR-CATEGORY-HERE</string> -->
<key>UIDeviceFamily</key>
<array>
<integer>2</integer>
</array>
<key>LSApplicationCategoryType</key>
<string>public.app-category.lifestyle</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
</plist>
+16
View File
@@ -0,0 +1,16 @@
using ObjCRuntime;
using UIKit;
namespace cfs_tracker
{
public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
}
+8
View File
@@ -0,0 +1,8 @@
<maui:MauiWinUIApplication
x:Class="cfs_tracker.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maui="using:Microsoft.Maui"
xmlns:local="using:cfs_tracker.WinUI">
</maui:MauiWinUIApplication>
+25
View File
@@ -0,0 +1,25 @@
using Microsoft.UI.Xaml;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace cfs_tracker.WinUI
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : MauiWinUIApplication
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
+46
View File
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
<mp:PhoneIdentity PhoneProductId="E85B93D1-0EA1-4C7A-A9A0-D767C48E7F62" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>$placeholder$</DisplayName>
<PublisherDisplayName>User Name</PublisherDisplayName>
<Logo>$placeholder$.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="$placeholder$"
Description="$placeholder$"
Square150x150Logo="$placeholder$.png"
Square44x44Logo="$placeholder$.png"
BackgroundColor="transparent">
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
<uap:SplashScreen Image="$placeholder$.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="cfs-tracker.WinUI.app"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- The combination of below two tags have the following effect:
1) Per-Monitor for >= Windows 10 Anniversary Update
2) System < Windows 10 Anniversary Update
-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
</assembly>
+10
View File
@@ -0,0 +1,10 @@
using Foundation;
namespace cfs_tracker
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
</plist>
+16
View File
@@ -0,0 +1,16 @@
using ObjCRuntime;
using UIKit;
namespace cfs_tracker
{
public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
}
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the minimum required version of the Apple Privacy Manifest for .NET MAUI apps.
The contents below are needed because of APIs that are used in the .NET framework and .NET MAUI SDK.
You are responsible for adding extra entries as needed for your application.
More information: https://aka.ms/maui-privacy-manifest
-->
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
</array>
</dict>
<!--
The entry below is only needed when you're using the Preferences API in your app.
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict> -->
</array>
</dict>
</plist>
+8
View File
@@ -0,0 +1,8 @@
{
"profiles": {
"Windows Machine": {
"commandName": "Project",
"nativeDebugging": false
}
}
}
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="456" height="456" fill="#512BD4" />
</svg>

After

Width:  |  Height:  |  Size: 228 B

+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

+15
View File
@@ -0,0 +1,15 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories). Deployment of the asset to your application
is automatically handled by the following `MauiAsset` Build Action within your `.csproj`.
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
These files will be deployed with your package and will be accessible using Essentials:
async Task LoadMauiAsset()
{
using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
using var reader = new StreamReader(stream);
var contents = reader.ReadToEnd();
}
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

+44
View File
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<!-- Note: For Android please see also Platforms\Android\Resources\values\colors.xml -->
<Color x:Key="Primary">#512BD4</Color>
<Color x:Key="PrimaryDark">#ac99ea</Color>
<Color x:Key="PrimaryDarkText">#242424</Color>
<Color x:Key="Secondary">#DFD8F7</Color>
<Color x:Key="SecondaryDarkText">#9880e5</Color>
<Color x:Key="Tertiary">#2B0B98</Color>
<Color x:Key="White">White</Color>
<Color x:Key="Black">Black</Color>
<Color x:Key="Magenta">#D600AA</Color>
<Color x:Key="MidnightBlue">#190649</Color>
<Color x:Key="OffBlack">#1f1f1f</Color>
<Color x:Key="Gray100">#E1E1E1</Color>
<Color x:Key="Gray200">#C8C8C8</Color>
<Color x:Key="Gray300">#ACACAC</Color>
<Color x:Key="Gray400">#919191</Color>
<Color x:Key="Gray500">#6E6E6E</Color>
<Color x:Key="Gray600">#404040</Color>
<Color x:Key="Gray900">#212121</Color>
<Color x:Key="Gray950">#141414</Color>
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/>
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}"/>
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/>
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/>
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/>
<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/>
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/>
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}"/>
<SolidColorBrush x:Key="Gray400Brush" Color="{StaticResource Gray400}"/>
<SolidColorBrush x:Key="Gray500Brush" Color="{StaticResource Gray500}"/>
<SolidColorBrush x:Key="Gray600Brush" Color="{StaticResource Gray600}"/>
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}"/>
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}"/>
</ResourceDictionary>
+434
View File
@@ -0,0 +1,434 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<Style TargetType="ActivityIndicator">
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
</Style>
<Style TargetType="IndicatorView">
<Setter Property="IndicatorColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}"/>
<Setter Property="SelectedIndicatorColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray100}}"/>
</Style>
<Style TargetType="Border">
<Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
<Setter Property="StrokeShape" Value="Rectangle"/>
<Setter Property="StrokeThickness" Value="1"/>
</Style>
<Style TargetType="BoxView">
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
</Style>
<Style TargetType="Button">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource PrimaryDarkText}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="BorderWidth" Value="0"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="14,10"/>
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver" />
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="CheckBox">
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="DatePicker">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="Editor">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="Entry">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="ImageButton">
<Setter Property="Opacity" Value="1" />
<Setter Property="BorderColor" Value="Transparent"/>
<Setter Property="BorderWidth" Value="0"/>
<Setter Property="CornerRadius" Value="0"/>
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="Opacity" Value="0.5" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver" />
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="Label">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="FontSize" Value="14" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="Label" x:Key="Headline">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource MidnightBlue}, Dark={StaticResource White}}" />
<Setter Property="FontSize" Value="32" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="HorizontalTextAlignment" Value="Center" />
</Style>
<Style TargetType="Label" x:Key="SubHeadline">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource MidnightBlue}, Dark={StaticResource White}}" />
<Setter Property="FontSize" Value="24" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="HorizontalTextAlignment" Value="Center" />
</Style>
<Style TargetType="Picker">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14" />
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="ProgressBar">
<Setter Property="ProgressColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="ProgressColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="RadioButton">
<Setter Property="BackgroundColor" Value="Transparent"/>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="RefreshView">
<Setter Property="RefreshColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
</Style>
<Style TargetType="SearchBar">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="PlaceholderColor" Value="{StaticResource Gray500}" />
<Setter Property="CancelButtonColor" Value="{StaticResource Gray500}" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="FontSize" Value="14" />
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="SearchHandler">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="PlaceholderColor" Value="{StaticResource Gray500}" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="FontSize" Value="14" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="Shadow">
<Setter Property="Radius" Value="15" />
<Setter Property="Opacity" Value="0.5" />
<Setter Property="Brush" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource White}}" />
<Setter Property="Offset" Value="10,10" />
</Style>
<Style TargetType="Slider">
<Setter Property="MinimumTrackColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="MaximumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="MinimumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"/>
<Setter Property="MaximumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"/>
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="SwipeItem">
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
</Style>
<Style TargetType="Switch">
<Setter Property="OnColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="ThumbColor" Value="{StaticResource White}" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="OnColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="On">
<VisualState.Setters>
<Setter Property="OnColor" Value="{AppThemeBinding Light={StaticResource Secondary}, Dark={StaticResource Gray200}}" />
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Off">
<VisualState.Setters>
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Gray400}, Dark={StaticResource Gray500}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="TimePicker">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="Transparent"/>
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<!--
<Style TargetType="TitleBar">
<Setter Property="MinimumHeightRequest" Value="32"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="TitleActiveStates">
<VisualState x:Name="TitleBarTitleActive">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="ForegroundColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="TitleBarTitleInactive">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
<Setter Property="ForegroundColor" Value="{AppThemeBinding Light={StaticResource Gray400}, Dark={StaticResource Gray500}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
-->
<Style TargetType="Page" ApplyToDerivedTypes="True">
<Setter Property="Padding" Value="0"/>
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource OffBlack}}" />
</Style>
<Style TargetType="Shell" ApplyToDerivedTypes="True">
<Setter Property="Shell.BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource OffBlack}}" />
<Setter Property="Shell.ForegroundColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource SecondaryDarkText}}" />
<Setter Property="Shell.TitleColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource SecondaryDarkText}}" />
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
<Setter Property="Shell.UnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray200}}" />
<Setter Property="Shell.NavBarHasShadow" Value="False" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
<Setter Property="Shell.TabBarForegroundColor" Value="{AppThemeBinding Light={StaticResource Magenta}, Dark={StaticResource White}}" />
<Setter Property="Shell.TabBarTitleColor" Value="{AppThemeBinding Light={StaticResource Magenta}, Dark={StaticResource White}}" />
<Setter Property="Shell.TabBarUnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
</Style>
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource OffBlack}}" />
<Setter Property="BarTextColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource White}}" />
<Setter Property="IconColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource White}}" />
</Style>
<Style TargetType="TabbedPage">
<Setter Property="BarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray950}}" />
<Setter Property="BarTextColor" Value="{AppThemeBinding Light={StaticResource Magenta}, Dark={StaticResource White}}" />
<Setter Property="UnselectedTabColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
<Setter Property="SelectedTabColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
</Style>
</ResourceDictionary>
+123
View File
@@ -0,0 +1,123 @@
using cfs_tracker.Models;
namespace cfs_tracker.Services;
public class AggregationService
{
public DayDetailSummary BuildDaySummary(DateTime date, IEnumerable<HealthEntry> entries)
{
var list = entries
.Where(x => x.Timestamp.Date == date.Date)
.OrderBy(x => x.Timestamp)
.ToList();
return new DayDetailSummary
{
Date = date.Date,
GreenCount = list.Count(x => x.State == HealthState.Green),
YellowCount = list.Count(x => x.State == HealthState.Yellow),
RedCount = list.Count(x => x.State == HealthState.Red),
GrayCount = list.Count(x => x.State == HealthState.Gray),
Entries = list
};
}
public List<WeekDaySummary> BuildWeekSummary(DateTime weekStart, IEnumerable<HealthEntry> entries)
{
var result = new List<WeekDaySummary>();
for (int i = 0; i < 7; i++)
{
var date = weekStart.Date.AddDays(i);
var dayEntries = entries.Where(x => x.Timestamp.Date == date).ToList();
var morning = dayEntries.Where(x => x.Timestamp.Hour < 12).ToList();
var afternoon = dayEntries.Where(x => x.Timestamp.Hour >= 12).ToList();
result.Add(new WeekDaySummary
{
Date = date,
MorningAverage = AverageOrNull(morning),
AfternoonAverage = AverageOrNull(afternoon),
MorningCount = morning.Count,
AfternoonCount = afternoon.Count
});
}
return result;
}
public List<CalendarDaySummary> BuildMonthSummary(DateTime month, IEnumerable<HealthEntry> entries)
{
var first = new DateTime(month.Year, month.Month, 1);
var days = DateTime.DaysInMonth(month.Year, month.Month);
var result = new List<CalendarDaySummary>();
for (int i = 0; i < days; i++)
{
var date = first.AddDays(i);
var dayEntries = entries.Where(x => x.Timestamp.Date == date.Date).ToList();
var avg = AverageOrNull(dayEntries);
result.Add(new CalendarDaySummary
{
Date = date,
Average = avg,
EntryCount = dayEntries.Count,
DisplayState = ToDisplayState(avg)
});
}
return result;
}
public List<CalendarDaySummary> BuildYearSummary(int year, IEnumerable<HealthEntry> entries)
{
var result = new List<CalendarDaySummary>();
for (int month = 1; month <= 12; month++)
{
var days = DateTime.DaysInMonth(year, month);
for (int day = 1; day <= days; day++)
{
var date = new DateTime(year, month, day);
var dayEntries = entries.Where(x => x.Timestamp.Date == date.Date).ToList();
var avg = AverageOrNull(dayEntries);
result.Add(new CalendarDaySummary
{
Date = date,
Average = avg,
EntryCount = dayEntries.Count,
DisplayState = ToDisplayState(avg)
});
}
}
return result;
}
public HealthState? ToDisplayState(double? average)
{
if (average is null)
return null;
if (average >= 2.5) return HealthState.Green;
if (average >= 1.5) return HealthState.Yellow;
if (average >= 0.5) return HealthState.Red;
return HealthState.Gray;
}
private double? AverageOrNull(IEnumerable<HealthEntry> entries)
{
var list = entries.ToList();
if (list.Count == 0)
return null;
return list.Average(x => (int)x.State);
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace cfs_tracker.Services;
public interface INotificationService
{
Task RequestPermissionAsync();
Task ScheduleDailyAsync(TimeSpan time, string title, string message);
Task CancelAllAsync();
}
+24
View File
@@ -0,0 +1,24 @@
namespace cfs_tracker.Services;
public class PdfExportService
{
public Task<string> ExportMonthAsync(DateTime month)
{
throw new NotImplementedException();
}
public Task<string> ExportYearAsync(int year)
{
throw new NotImplementedException();
}
public Task<string> ExportWeekAsync(DateTime weekStart)
{
throw new NotImplementedException();
}
public Task<string> ExportDayAsync(DateTime day)
{
throw new NotImplementedException();
}
}
+36
View File
@@ -0,0 +1,36 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace cfs_tracker.ViewModels;
public enum CalendarMode
{
Day,
Week,
Month,
Year
}
public partial class CalendarViewModel : ObservableObject
{
[ObservableProperty]
private CalendarMode currentMode = CalendarMode.Month;
[ObservableProperty]
private DateTime selectedDate = DateTime.Today;
public IRelayCommand ShowDayCommand { get; }
public IRelayCommand ShowWeekCommand { get; }
public IRelayCommand ShowMonthCommand { get; }
public IRelayCommand ShowYearCommand { get; }
public IRelayCommand TodayCommand { get; }
public CalendarViewModel()
{
ShowDayCommand = new RelayCommand(() => CurrentMode = CalendarMode.Day);
ShowWeekCommand = new RelayCommand(() => CurrentMode = CalendarMode.Week);
ShowMonthCommand = new RelayCommand(() => CurrentMode = CalendarMode.Month);
ShowYearCommand = new RelayCommand(() => CurrentMode = CalendarMode.Year);
TodayCommand = new RelayCommand(() => SelectedDate = DateTime.Today);
}
}
+60
View File
@@ -0,0 +1,60 @@
using cfs_tracker.Models;
namespace cfs_tracker.ViewModels;
public class DayEntryItemViewModel
{
public int Id { get; init; }
public DateTime Timestamp { get; init; }
public string TimeText { get; init; } = "";
public string StateText { get; init; } = "";
public string SourceText { get; init; } = "";
public Color BackgroundColor { get; init; } = Colors.Transparent;
public Color TextColor { get; init; } = Colors.Black;
public static DayEntryItemViewModel FromEntry(HealthEntry entry)
{
var state = entry.State;
var background = state switch
{
HealthState.Green => Color.FromArgb("#4CAF50"),
HealthState.Yellow => Color.FromArgb("#FBC02D"),
HealthState.Red => Color.FromArgb("#E53935"),
HealthState.Gray => Color.FromArgb("#757575"),
_ => Colors.Transparent
};
var textColor = state switch
{
HealthState.Gray => Colors.White,
HealthState.Green => Colors.White,
_ => Colors.Black
};
return new DayEntryItemViewModel
{
Id = entry.Id,
Timestamp = entry.Timestamp,
TimeText = entry.Timestamp.ToString("HH:mm"),
StateText = state switch
{
HealthState.Green => "Gut",
HealthState.Yellow => "So lala",
HealthState.Red => "Schlecht",
HealthState.Gray => "Totalausfall",
_ => ""
},
SourceText = entry.Source switch
{
EntrySource.App => "App",
EntrySource.Notification => "Push",
_ => ""
},
BackgroundColor = background,
TextColor = textColor
};
}
}
+111
View File
@@ -0,0 +1,111 @@
using cfs_tracker.Data;
using cfs_tracker.Models;
using cfs_tracker.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System.Collections.ObjectModel;
using System.Globalization;
namespace cfs_tracker.ViewModels;
public partial class DayViewModel : ObservableObject
{
private readonly HealthEntryRepository _repository;
[ObservableProperty]
private DateTime selectedDate = DateTime.Today;
[ObservableProperty]
private string selectedDateText = "";
[ObservableProperty]
private int greenCount;
[ObservableProperty]
private int yellowCount;
[ObservableProperty]
private int redCount;
[ObservableProperty]
private int grayCount;
public ObservableCollection<DayEntryItemViewModel> Entries { get; } = new();
public IAsyncRelayCommand PreviousDayCommand { get; }
public IAsyncRelayCommand NextDayCommand { get; }
public IAsyncRelayCommand TodayCommand { get; }
public IAsyncRelayCommand AddEntryCommand { get; }
public IAsyncRelayCommand<DayEntryItemViewModel> DeleteEntryCommand { get; }
public DayViewModel(HealthEntryRepository repository)
{
_repository = repository;
PreviousDayCommand = new AsyncRelayCommand(PreviousDayAsync);
NextDayCommand = new AsyncRelayCommand(NextDayAsync);
TodayCommand = new AsyncRelayCommand(SetTodayAsync);
AddEntryCommand = new AsyncRelayCommand(OpenQuickEntryAsync);
DeleteEntryCommand = new AsyncRelayCommand<DayEntryItemViewModel>(DeleteEntryAsync);
UpdateDateText();
}
partial void OnSelectedDateChanged(DateTime value)
{
UpdateDateText();
}
public async Task RefreshAsync()
{
var entries = await _repository.GetEntriesForDateAsync(SelectedDate);
GreenCount = entries.Count(x => x.State == HealthState.Green);
YellowCount = entries.Count(x => x.State == HealthState.Yellow);
RedCount = entries.Count(x => x.State == HealthState.Red);
GrayCount = entries.Count(x => x.State == HealthState.Gray);
Entries.Clear();
foreach (var entry in entries.OrderBy(x => x.Timestamp))
Entries.Add(DayEntryItemViewModel.FromEntry(entry));
}
private async Task PreviousDayAsync()
{
SelectedDate = SelectedDate.AddDays(-1);
await RefreshAsync();
}
private async Task NextDayAsync()
{
SelectedDate = SelectedDate.AddDays(1);
await RefreshAsync();
}
private async Task SetTodayAsync()
{
SelectedDate = DateTime.Today;
await RefreshAsync();
}
private async Task OpenQuickEntryAsync()
{
string date = SelectedDate.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
await Shell.Current.GoToAsync($"{nameof(QuickEntryPage)}?date={date}");
}
private async Task DeleteEntryAsync(DayEntryItemViewModel? item)
{
if (item is null)
return;
await _repository.DeleteEntryAsync(item.Id);
await RefreshAsync();
}
private void UpdateDateText()
{
SelectedDateText = SelectedDate.ToString("dddd, dd. MMMM yyyy", new CultureInfo("de-DE"));
}
}
+26
View File
@@ -0,0 +1,26 @@
using Microsoft.Maui.Graphics;
namespace cfs_tracker.ViewModels;
public class MonthCellViewModel
{
public bool IsRealDay { get; init; }
public DateTime Date { get; init; }
public string DayNumberText { get; init; } = "";
public string CountText { get; init; } = "";
public Color BackgroundColor { get; init; } = Colors.Transparent;
public Color BorderColor { get; init; } = Colors.Transparent;
public Color TextColor { get; init; } = Colors.Black;
public static MonthCellViewModel Placeholder() => new()
{
IsRealDay = false,
BackgroundColor = Colors.Transparent,
BorderColor = Colors.Transparent,
TextColor = Colors.Transparent,
DayNumberText = "",
CountText = ""
};
}
+121
View File
@@ -0,0 +1,121 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using cfs_tracker.Data;
using cfs_tracker.Models;
using cfs_tracker.Services;
using cfs_tracker.ViewModels;
using cfs_tracker.Views;
using Microsoft.Maui.Graphics;
using System.Collections.ObjectModel;
using System.Globalization;
namespace cfs_tracker.ViewModels;
public partial class MonthViewModel : ObservableObject
{
private readonly HealthEntryRepository _repository;
private readonly AggregationService _aggregationService;
private readonly CultureInfo _culture = new("de-DE");
private DateTime _currentMonth = new(DateTime.Today.Year, DateTime.Today.Month, 1);
[ObservableProperty]
private string selectedMonthText = "";
public ObservableCollection<MonthCellViewModel> Days { get; } = new();
public IAsyncRelayCommand PreviousMonthCommand { get; }
public IAsyncRelayCommand NextMonthCommand { get; }
public IAsyncRelayCommand TodayCommand { get; }
public IAsyncRelayCommand<MonthCellViewModel> OpenDayCommand { get; }
public MonthViewModel(
HealthEntryRepository repository,
AggregationService aggregationService)
{
_repository = repository;
_aggregationService = aggregationService;
PreviousMonthCommand = new AsyncRelayCommand(PreviousMonthAsync);
NextMonthCommand = new AsyncRelayCommand(NextMonthAsync);
TodayCommand = new AsyncRelayCommand(SetTodayAsync);
OpenDayCommand = new AsyncRelayCommand<MonthCellViewModel>(OpenDayAsync);
}
public async Task RefreshAsync()
{
_currentMonth = new DateTime(_currentMonth.Year, _currentMonth.Month, 1);
SelectedMonthText = _currentMonth.ToString("MMMM yyyy", _culture);
var monthStart = _currentMonth;
var monthEnd = monthStart.AddMonths(1);
var entries = await _repository.GetEntriesBetweenAsync(monthStart, monthEnd);
var summaries = _aggregationService.BuildMonthSummary(monthStart, entries);
Days.Clear();
int leadingEmptyDays = ((int)monthStart.DayOfWeek + 6) % 7;
for (int i = 0; i < leadingEmptyDays; i++)
Days.Add(MonthCellViewModel.Placeholder());
foreach (var summary in summaries)
Days.Add(BuildCell(summary));
while (Days.Count % 7 != 0)
Days.Add(MonthCellViewModel.Placeholder());
}
private MonthCellViewModel BuildCell(CalendarDaySummary summary)
{
Color background = summary.DisplayState switch
{
HealthState.Green => Color.FromArgb("#4CAF50"),
HealthState.Yellow => Color.FromArgb("#FBC02D"),
HealthState.Red => Color.FromArgb("#E53935"),
HealthState.Gray => Color.FromArgb("#757575"),
_ => Color.FromArgb("#F2F2F2")
};
bool isToday = summary.Date.Date == DateTime.Today.Date;
return new MonthCellViewModel
{
IsRealDay = true,
Date = summary.Date,
DayNumberText = summary.Date.Day.ToString(),
CountText = summary.EntryCount > 0 ? $"{summary.EntryCount}x" : "",
BackgroundColor = background,
BorderColor = isToday ? Colors.Black : Color.FromArgb("#D0D0D0"),
TextColor = summary.DisplayState == HealthState.Gray ? Colors.White : Colors.Black
};
}
private async Task PreviousMonthAsync()
{
_currentMonth = _currentMonth.AddMonths(-1);
await RefreshAsync();
}
private async Task NextMonthAsync()
{
_currentMonth = _currentMonth.AddMonths(1);
await RefreshAsync();
}
private async Task SetTodayAsync()
{
_currentMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
await RefreshAsync();
}
private async Task OpenDayAsync(MonthCellViewModel? cell)
{
if (cell is null || !cell.IsRealDay)
return;
string date = cell.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
await Shell.Current.GoToAsync($"{nameof(QuickEntryPage)}?date={date}");
}
}
+45
View File
@@ -0,0 +1,45 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using cfs_tracker.Data;
namespace cfs_tracker.ViewModels;
public partial class OptionsViewModel : ObservableObject
{
private readonly HealthEntryRepository _repository;
[ObservableProperty]
private string deleteConfirmationText = string.Empty;
[ObservableProperty]
private string statusText = string.Empty;
public IAsyncRelayCommand DeleteAllDataCommand { get; }
public OptionsViewModel(HealthEntryRepository repository)
{
_repository = repository;
DeleteAllDataCommand = new AsyncRelayCommand(DeleteAllDataAsync, CanDeleteAllData);
}
partial void OnDeleteConfirmationTextChanged(string value)
{
DeleteAllDataCommand.NotifyCanExecuteChanged();
}
private bool CanDeleteAllData()
{
return string.Equals(
DeleteConfirmationText?.Trim(),
"löschen",
StringComparison.OrdinalIgnoreCase);
}
private async Task DeleteAllDataAsync()
{
await _repository.DeleteAllAsync();
DeleteConfirmationText = string.Empty;
StatusText = "Alle gespeicherten Einträge wurden gelöscht.";
}
}
+120
View File
@@ -0,0 +1,120 @@
using System.Collections.ObjectModel;
using System.Globalization;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using cfs_tracker.Data;
using cfs_tracker.Models;
namespace cfs_tracker.ViewModels;
public partial class QuickEntryViewModel : ObservableObject
{
private readonly HealthEntryRepository _repository;
[ObservableProperty]
private DateTime selectedDate = DateTime.Today;
[ObservableProperty]
private string selectedDateText = "";
[ObservableProperty]
private bool isPastDate;
[ObservableProperty]
private bool isFutureDate;
[ObservableProperty]
private string selectedPartText = "Vormittag";
public ObservableCollection<string> AvailableParts { get; } = new()
{
"Vormittag",
"Nachmittag"
};
public IAsyncRelayCommand SaveGreenCommand { get; }
public IAsyncRelayCommand SaveYellowCommand { get; }
public IAsyncRelayCommand SaveRedCommand { get; }
public IAsyncRelayCommand SaveGrayCommand { get; }
public QuickEntryViewModel(HealthEntryRepository repository)
{
_repository = repository;
SaveGreenCommand = new AsyncRelayCommand(() => SaveAsync(HealthState.Green));
SaveYellowCommand = new AsyncRelayCommand(() => SaveAsync(HealthState.Yellow));
SaveRedCommand = new AsyncRelayCommand(() => SaveAsync(HealthState.Red));
SaveGrayCommand = new AsyncRelayCommand(() => SaveAsync(HealthState.Gray));
UpdateState();
}
public void SetDateFromQuery(string? dateText)
{
if (!string.IsNullOrWhiteSpace(dateText) &&
DateTime.TryParseExact(
dateText,
"yyyy-MM-dd",
CultureInfo.InvariantCulture,
DateTimeStyles.None,
out var parsed))
{
SelectedDate = parsed.Date;
}
else
{
SelectedDate = DateTime.Today;
}
UpdateState();
}
partial void OnSelectedDateChanged(DateTime value)
{
UpdateState();
}
private async Task SaveAsync(HealthState state)
{
if (IsFutureDate)
return;
if (IsPastDate)
{
await _repository.UpsertBackfillAsync(
SelectedDate,
GetSelectedPart(),
state,
EntrySource.App);
}
else
{
await _repository.AddEntryAsync(
state,
EntrySource.App,
DateTime.Now);
}
await Shell.Current.GoToAsync("..");
}
private DayPart GetSelectedPart()
{
return SelectedPartText == "Nachmittag"
? DayPart.Afternoon
: DayPart.Morning;
}
private void UpdateState()
{
var today = DateTime.Today;
IsPastDate = SelectedDate.Date < today;
IsFutureDate = SelectedDate.Date > today;
SelectedDateText = SelectedDate.ToString("dddd, dd. MMMM yyyy", new CultureInfo("de-DE"));
if (!IsPastDate)
SelectedPartText = "Vormittag";
}
}
+25
View File
@@ -0,0 +1,25 @@
using Microsoft.Maui.Graphics;
namespace cfs_tracker.ViewModels;
public class WeekCellViewModel
{
public DateTime Date { get; init; }
public string DayText { get; init; } = "";
public string DateText { get; init; } = "";
public string MorningText { get; init; } = "";
public string AfternoonText { get; init; } = "";
public string MorningCountText { get; init; } = "";
public string AfternoonCountText { get; init; } = "";
public Color MorningBackgroundColor { get; init; } = Colors.Transparent;
public Color AfternoonBackgroundColor { get; init; } = Colors.Transparent;
public Color MorningTextColor { get; init; } = Colors.Black;
public Color AfternoonTextColor { get; init; } = Colors.Black;
public bool IsToday { get; init; }
}
+140
View File
@@ -0,0 +1,140 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using cfs_tracker.Data;
using cfs_tracker.Models;
using cfs_tracker.Services;
using cfs_tracker.ViewModels;
using cfs_tracker.Views;
using Microsoft.Maui.Graphics;
using System.Collections.ObjectModel;
using System.Globalization;
namespace cfs_tracker.ViewModels;
public partial class WeekViewModel : ObservableObject
{
private readonly HealthEntryRepository _repository;
private readonly AggregationService _aggregationService;
[ObservableProperty]
private DateTime anchorDate = DateTime.Today;
[ObservableProperty]
private string weekText = "";
public ObservableCollection<WeekCellViewModel> Days { get; } = new();
public IAsyncRelayCommand PreviousWeekCommand { get; }
public IAsyncRelayCommand NextWeekCommand { get; }
public IAsyncRelayCommand TodayCommand { get; }
public IAsyncRelayCommand<WeekCellViewModel> OpenDayCommand { get; }
public WeekViewModel(
HealthEntryRepository repository,
AggregationService aggregationService)
{
_repository = repository;
_aggregationService = aggregationService;
PreviousWeekCommand = new AsyncRelayCommand(PreviousWeekAsync);
NextWeekCommand = new AsyncRelayCommand(NextWeekAsync);
TodayCommand = new AsyncRelayCommand(SetTodayAsync);
OpenDayCommand = new AsyncRelayCommand<WeekCellViewModel>(OpenDayAsync);
}
public async Task RefreshAsync()
{
var weekStart = StartOfWeek(AnchorDate);
var weekEnd = weekStart.AddDays(7);
WeekText = $"{weekStart:dd.MM.yyyy} - {weekEnd.AddDays(-1):dd.MM.yyyy}";
var entries = await _repository.GetEntriesBetweenAsync(weekStart, weekEnd);
var summaries = _aggregationService.BuildWeekSummary(weekStart, entries);
Days.Clear();
foreach (var summary in summaries)
Days.Add(BuildCell(summary));
}
private WeekCellViewModel BuildCell(WeekDaySummary summary)
{
var morningState = _aggregationService.ToDisplayState(summary.MorningAverage);
var afternoonState = _aggregationService.ToDisplayState(summary.AfternoonAverage);
return new WeekCellViewModel
{
Date = summary.Date,
DayText = summary.Date.ToString("ddd", new CultureInfo("de-DE")),
DateText = summary.Date.ToString("dd.MM"),
MorningText = summary.MorningAverage.HasValue ? StateLabel(morningState) : "—",
AfternoonText = summary.AfternoonAverage.HasValue ? StateLabel(afternoonState) : "—",
MorningCountText = summary.MorningCount > 0 ? $"{summary.MorningCount}x" : "",
AfternoonCountText = summary.AfternoonCount > 0 ? $"{summary.AfternoonCount}x" : "",
MorningBackgroundColor = StateColor(morningState),
AfternoonBackgroundColor = StateColor(afternoonState),
MorningTextColor = StateTextColor(morningState),
AfternoonTextColor = StateTextColor(afternoonState),
IsToday = summary.Date.Date == DateTime.Today.Date
};
}
private async Task PreviousWeekAsync()
{
AnchorDate = AnchorDate.AddDays(-7);
await RefreshAsync();
}
private async Task NextWeekAsync()
{
AnchorDate = AnchorDate.AddDays(7);
await RefreshAsync();
}
private async Task SetTodayAsync()
{
AnchorDate = DateTime.Today;
await RefreshAsync();
}
private async Task OpenDayAsync(WeekCellViewModel? cell)
{
if (cell is null)
return;
string date = cell.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
await Shell.Current.GoToAsync($"{nameof(QuickEntryPage)}?date={date}");
}
private static DateTime StartOfWeek(DateTime date)
{
int diff = ((int)date.DayOfWeek + 6) % 7;
return date.Date.AddDays(-diff);
}
private static string StateLabel(HealthState? state) => state switch
{
HealthState.Green => "Gut",
HealthState.Yellow => "So lala",
HealthState.Red => "Schlecht",
HealthState.Gray => "Ausfall",
_ => "—"
};
private static Color StateColor(HealthState? state) => state switch
{
HealthState.Green => Color.FromArgb("#4CAF50"),
HealthState.Yellow => Color.FromArgb("#FBC02D"),
HealthState.Red => Color.FromArgb("#E53935"),
HealthState.Gray => Color.FromArgb("#757575"),
_ => Color.FromArgb("#F2F2F2")
};
private static Color StateTextColor(HealthState? state) => state switch
{
HealthState.Green => Colors.White,
HealthState.Gray => Colors.White,
_ => Colors.Black
};
}
+11
View File
@@ -0,0 +1,11 @@
using System.Collections.ObjectModel;
namespace cfs_tracker.ViewModels;
public class YearMonthViewModel
{
public int MonthNumber { get; init; }
public string MonthText { get; init; } = "";
public ObservableCollection<MonthCellViewModel> Days { get; } = new();
}
+130
View File
@@ -0,0 +1,130 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using cfs_tracker.Data;
using cfs_tracker.Models;
using cfs_tracker.Services;
using cfs_tracker.Views;
using System.Collections.ObjectModel;
using System.Globalization;
namespace cfs_tracker.ViewModels;
public partial class YearViewModel : ObservableObject
{
private readonly HealthEntryRepository _repository;
private readonly AggregationService _aggregationService;
private readonly CultureInfo _culture = new("de-DE");
private int _currentYear = DateTime.Today.Year;
[ObservableProperty]
private string selectedYearText = "";
public ObservableCollection<YearMonthViewModel> Months { get; } = new();
public IAsyncRelayCommand PreviousYearCommand { get; }
public IAsyncRelayCommand NextYearCommand { get; }
public IAsyncRelayCommand TodayCommand { get; }
public IAsyncRelayCommand<MonthCellViewModel> OpenDayCommand { get; }
public YearViewModel(
HealthEntryRepository repository,
AggregationService aggregationService)
{
_repository = repository;
_aggregationService = aggregationService;
PreviousYearCommand = new AsyncRelayCommand(PreviousYearAsync);
NextYearCommand = new AsyncRelayCommand(NextYearAsync);
TodayCommand = new AsyncRelayCommand(SetTodayAsync);
OpenDayCommand = new AsyncRelayCommand<MonthCellViewModel>(OpenDayAsync);
}
public async Task RefreshAsync()
{
SelectedYearText = _currentYear.ToString();
var start = new DateTime(_currentYear, 1, 1);
var end = start.AddYears(1);
var entries = await _repository.GetEntriesBetweenAsync(start, end);
var summaries = _aggregationService.BuildYearSummary(_currentYear, entries);
Months.Clear();
for (int month = 1; month <= 12; month++)
{
var monthVm = new YearMonthViewModel
{
MonthNumber = month,
MonthText = new DateTime(_currentYear, month, 1).ToString("MMMM", _culture)
};
var monthStart = new DateTime(_currentYear, month, 1);
int leadingEmptyDays = ((int)monthStart.DayOfWeek + 6) % 7;
for (int i = 0; i < leadingEmptyDays; i++)
monthVm.Days.Add(MonthCellViewModel.Placeholder());
foreach (var summary in summaries.Where(x => x.Date.Month == month))
monthVm.Days.Add(BuildCell(summary));
while (monthVm.Days.Count % 7 != 0)
monthVm.Days.Add(MonthCellViewModel.Placeholder());
Months.Add(monthVm);
}
}
private MonthCellViewModel BuildCell(CalendarDaySummary summary)
{
Color background = summary.DisplayState switch
{
HealthState.Green => Color.FromArgb("#4CAF50"),
HealthState.Yellow => Color.FromArgb("#FBC02D"),
HealthState.Red => Color.FromArgb("#E53935"),
HealthState.Gray => Color.FromArgb("#757575"),
_ => Color.FromArgb("#F2F2F2")
};
bool isToday = summary.Date.Date == DateTime.Today.Date;
return new MonthCellViewModel
{
IsRealDay = true,
Date = summary.Date,
DayNumberText = summary.Date.Day.ToString(),
CountText = summary.EntryCount > 0 ? $"{summary.EntryCount}x" : "",
BackgroundColor = background,
BorderColor = isToday ? Colors.Black : Color.FromArgb("#D0D0D0"),
TextColor = summary.DisplayState == HealthState.Gray ? Colors.White : Colors.Black
};
}
private async Task PreviousYearAsync()
{
_currentYear--;
await RefreshAsync();
}
private async Task NextYearAsync()
{
_currentYear++;
await RefreshAsync();
}
private async Task SetTodayAsync()
{
_currentYear = DateTime.Today.Year;
await RefreshAsync();
}
private async Task OpenDayAsync(MonthCellViewModel? cell)
{
if (cell is null || !cell.IsRealDay)
return;
string date = cell.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
await Shell.Current.GoToAsync($"{nameof(QuickEntryPage)}?date={date}");
}
}
+113
View File
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="cfs_tracker.Views.DayPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Name="ThisPage"
Title="Tag">
<ScrollView>
<VerticalStackLayout Padding="16" Spacing="14">
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
<Button
Grid.Column="0"
Text="◀"
WidthRequest="52"
HeightRequest="44"
Command="{Binding PreviousDayCommand}" />
<Label
Grid.Column="1"
Text="{Binding SelectedDateText}"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
FontSize="22"
FontAttributes="Bold" />
<Button
Grid.Column="2"
Text="Heute"
Margin="8,0,0,0"
Command="{Binding TodayCommand}" />
<Button
Grid.Column="3"
Text="+"
Margin="8,0,0,0"
WidthRequest="52"
HeightRequest="44"
Command="{Binding AddEntryCommand}" />
</Grid>
<Grid ColumnDefinitions="*,*" RowDefinitions="Auto,Auto" ColumnSpacing="10" RowSpacing="10">
<Border Grid.Row="0" Grid.Column="0" BackgroundColor="#4CAF50" StrokeThickness="0" StrokeShape="RoundRectangle 12" Padding="12">
<VerticalStackLayout>
<Label Text="Grün" TextColor="White" FontAttributes="Bold" />
<Label Text="{Binding GreenCount}" TextColor="White" FontSize="22" />
</VerticalStackLayout>
</Border>
<Border Grid.Row="0" Grid.Column="1" BackgroundColor="#FBC02D" StrokeThickness="0" StrokeShape="RoundRectangle 12" Padding="12">
<VerticalStackLayout>
<Label Text="Gelb" FontAttributes="Bold" />
<Label Text="{Binding YellowCount}" FontSize="22" />
</VerticalStackLayout>
</Border>
<Border Grid.Row="1" Grid.Column="0" BackgroundColor="#E53935" StrokeThickness="0" StrokeShape="RoundRectangle 12" Padding="12">
<VerticalStackLayout>
<Label Text="Rot" TextColor="White" FontAttributes="Bold" />
<Label Text="{Binding RedCount}" TextColor="White" FontSize="22" />
</VerticalStackLayout>
</Border>
<Border Grid.Row="1" Grid.Column="1" BackgroundColor="#757575" StrokeThickness="0" StrokeShape="RoundRectangle 12" Padding="12">
<VerticalStackLayout>
<Label Text="Grau" TextColor="White" FontAttributes="Bold" />
<Label Text="{Binding GrayCount}" TextColor="White" FontSize="22" />
</VerticalStackLayout>
</Border>
</Grid>
<CollectionView ItemsSource="{Binding Entries}" SelectionMode="None">
<CollectionView.ItemTemplate>
<DataTemplate>
<Border
Margin="0,0,0,8"
Padding="12"
BackgroundColor="{Binding BackgroundColor}"
StrokeThickness="0"
StrokeShape="RoundRectangle 12">
<Grid ColumnDefinitions="Auto,*,Auto" ColumnSpacing="12">
<Label
Grid.Column="0"
Text="{Binding TimeText}"
TextColor="{Binding TextColor}"
FontAttributes="Bold"
VerticalOptions="Center" />
<VerticalStackLayout Grid.Column="1" Spacing="2">
<Label Text="{Binding StateText}" TextColor="{Binding TextColor}" FontAttributes="Bold" />
<Label Text="{Binding SourceText}" TextColor="{Binding TextColor}" FontSize="12" />
</VerticalStackLayout>
<Button
Grid.Column="2"
Text="X"
WidthRequest="44"
HeightRequest="44"
Command="{Binding Source={x:Reference ThisPage}, Path=BindingContext.DeleteEntryCommand}"
CommandParameter="{Binding .}" />
</Grid>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
+20
View File
@@ -0,0 +1,20 @@
using cfs_tracker.ViewModels;
namespace cfs_tracker.Views;
public partial class DayPage : ContentPage
{
private readonly DayViewModel _viewModel;
public DayPage(DayViewModel viewModel)
{
InitializeComponent();
BindingContext = _viewModel = viewModel;
}
protected override async void OnAppearing()
{
base.OnAppearing();
await _viewModel.RefreshAsync();
}
}
+96
View File
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="cfs_tracker.Views.MonthPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Name="ThisPage"
Title="Monat">
<ScrollView>
<VerticalStackLayout Padding="16" Spacing="14">
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
<Button
Grid.Column="0"
Text="◀"
WidthRequest="52"
HeightRequest="44"
Command="{Binding PreviousMonthCommand}" />
<Label
Grid.Column="1"
Text="{Binding SelectedMonthText}"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
FontSize="24"
FontAttributes="Bold" />
<Button
Grid.Column="2"
Text="Heute"
Margin="8,0,0,0"
Command="{Binding TodayCommand}" />
<Button
Grid.Column="3"
Text="▶"
WidthRequest="52"
HeightRequest="44"
Margin="8,0,0,0"
Command="{Binding NextMonthCommand}" />
</Grid>
<Grid ColumnDefinitions="*,*,*,*,*,*,*">
<Label Grid.Column="0" Text="Mo" HorizontalTextAlignment="Center" FontAttributes="Bold" />
<Label Grid.Column="1" Text="Di" HorizontalTextAlignment="Center" FontAttributes="Bold" />
<Label Grid.Column="2" Text="Mi" HorizontalTextAlignment="Center" FontAttributes="Bold" />
<Label Grid.Column="3" Text="Do" HorizontalTextAlignment="Center" FontAttributes="Bold" />
<Label Grid.Column="4" Text="Fr" HorizontalTextAlignment="Center" FontAttributes="Bold" />
<Label Grid.Column="5" Text="Sa" HorizontalTextAlignment="Center" FontAttributes="Bold" />
<Label Grid.Column="6" Text="So" HorizontalTextAlignment="Center" FontAttributes="Bold" />
</Grid>
<CollectionView ItemsSource="{Binding Days}" SelectionMode="None">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="7" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="3">
<Border
HeightRequest="74"
BackgroundColor="{Binding BackgroundColor}"
Stroke="{Binding BorderColor}"
StrokeThickness="1"
StrokeShape="RoundRectangle 10">
<Grid Padding="6">
<Grid.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding Source={x:Reference ThisPage}, Path=BindingContext.OpenDayCommand}"
CommandParameter="{Binding .}" />
</Grid.GestureRecognizers>
<VerticalStackLayout IsVisible="{Binding IsRealDay}" Spacing="4">
<Label
Text="{Binding DayNumberText}"
TextColor="{Binding TextColor}"
FontAttributes="Bold"
FontSize="16" />
<Label
Text="{Binding CountText}"
TextColor="{Binding TextColor}"
FontSize="12" />
</VerticalStackLayout>
</Grid>
</Border>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
+20
View File
@@ -0,0 +1,20 @@
using cfs_tracker.ViewModels;
namespace cfs_tracker.Views;
public partial class MonthPage : ContentPage
{
private readonly MonthViewModel _viewModel;
public MonthPage(MonthViewModel viewModel)
{
InitializeComponent();
BindingContext = _viewModel = viewModel;
}
protected override async void OnAppearing()
{
base.OnAppearing();
await _viewModel.RefreshAsync();
}
}
+56
View File
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="cfs_tracker.Views.OptionsPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Title="Optionen">
<ScrollView>
<VerticalStackLayout Padding="16" Spacing="16">
<Label
Text="Optionen"
FontSize="26"
FontAttributes="Bold" />
<Border
Padding="14"
BackgroundColor="#FFF4F4"
Stroke="#D88"
StrokeThickness="1"
StrokeShape="RoundRectangle 12">
<VerticalStackLayout Spacing="12">
<Label
Text="Datenbank löschen"
FontSize="20"
FontAttributes="Bold" />
<Label
Text="Dadurch werden alle gespeicherten Einträge unwiderruflich entfernt."
FontSize="14" />
<Label
Text="Zur Bestätigung bitte das Wort 'löschen' eingeben."
FontSize="14"
FontAttributes="Bold" />
<Entry
Placeholder="löschen"
Text="{Binding DeleteConfirmationText}" />
<Button
Text="Alle Daten löschen"
BackgroundColor="#B00020"
TextColor="White"
Command="{Binding DeleteAllDataCommand}" />
<Label
Text="{Binding StatusText}"
FontSize="13" />
</VerticalStackLayout>
</Border>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
+12
View File
@@ -0,0 +1,12 @@
using cfs_tracker.ViewModels;
namespace cfs_tracker.Views;
public partial class OptionsPage : ContentPage
{
public OptionsPage(OptionsViewModel viewModel)
{
InitializeComponent();
BindingContext = viewModel;
}
}
+95
View File
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="cfs_tracker.Views.QuickEntryPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Title="Eintrag">
<ScrollView>
<VerticalStackLayout Padding="20" Spacing="18">
<Label
Text="Wie geht es dir?"
FontSize="28"
FontAttributes="Bold"
HorizontalTextAlignment="Center" />
<Label
Text="{Binding SelectedDateText}"
FontSize="16"
HorizontalTextAlignment="Center" />
<VerticalStackLayout
IsVisible="{Binding IsPastDate}"
Spacing="8">
<Label
Text="Tageszeit"
FontAttributes="Bold"
HorizontalTextAlignment="Center" />
<Picker
Title="Tageszeit"
ItemsSource="{Binding AvailableParts}"
SelectedItem="{Binding SelectedPartText}" />
</VerticalStackLayout>
<Label
IsVisible="{Binding IsFutureDate}"
Text="Für zukünftige Tage können keine Einträge gesetzt werden."
TextColor="Red"
HorizontalTextAlignment="Center" />
<Grid
ColumnDefinitions="*,*"
RowDefinitions="Auto,Auto"
ColumnSpacing="12"
RowSpacing="12">
<Button
Grid.Row="0"
Grid.Column="0"
Text="Grün&#10;Gut"
FontSize="22"
FontAttributes="Bold"
HeightRequest="120"
BackgroundColor="#4CAF50"
TextColor="White"
Command="{Binding SaveGreenCommand}" />
<Button
Grid.Row="0"
Grid.Column="1"
Text="Gelb&#10;So lala"
FontSize="22"
FontAttributes="Bold"
HeightRequest="120"
BackgroundColor="#FBC02D"
TextColor="Black"
Command="{Binding SaveYellowCommand}" />
<Button
Grid.Row="1"
Grid.Column="0"
Text="Rot&#10;Schlecht"
FontSize="22"
FontAttributes="Bold"
HeightRequest="120"
BackgroundColor="#E53935"
TextColor="White"
Command="{Binding SaveRedCommand}" />
<Button
Grid.Row="1"
Grid.Column="1"
Text="Grau&#10;Totalausfall"
FontSize="22"
FontAttributes="Bold"
HeightRequest="120"
BackgroundColor="#757575"
TextColor="White"
Command="{Binding SaveGrayCommand}" />
</Grid>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
+21
View File
@@ -0,0 +1,21 @@
using Microsoft.Maui.Controls;
using cfs_tracker.ViewModels;
namespace cfs_tracker.Views;
public partial class QuickEntryPage : ContentPage, IQueryAttributable
{
private readonly QuickEntryViewModel _viewModel;
public QuickEntryPage(QuickEntryViewModel viewModel)
{
InitializeComponent();
BindingContext = _viewModel = viewModel;
}
public void ApplyQueryAttributes(IDictionary<string, object> query)
{
query.TryGetValue("date", out var value);
_viewModel.SetDateFromQuery(value?.ToString());
}
}
+107
View File
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="cfs_tracker.Views.WeekPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Name="ThisPage"
Title="Woche">
<ScrollView>
<VerticalStackLayout Padding="16" Spacing="14">
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
<Button
Grid.Column="0"
Text="◀"
WidthRequest="52"
HeightRequest="44"
Command="{Binding PreviousWeekCommand}" />
<Label
Grid.Column="1"
Text="{Binding WeekText}"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
FontSize="22"
FontAttributes="Bold" />
<Button
Grid.Column="2"
Text="Heute"
Margin="8,0,0,0"
Command="{Binding TodayCommand}" />
<Button
Grid.Column="3"
Text="▶"
WidthRequest="52"
HeightRequest="44"
Margin="8,0,0,0"
Command="{Binding NextWeekCommand}" />
</Grid>
<CollectionView ItemsSource="{Binding Days}" SelectionMode="None">
<CollectionView.ItemTemplate>
<DataTemplate>
<Border
Margin="0,0,0,10"
Padding="12"
BackgroundColor="White"
Stroke="#D0D0D0"
StrokeThickness="1"
StrokeShape="RoundRectangle 12">
<Grid RowDefinitions="Auto,Auto" ColumnDefinitions="*" RowSpacing="10">
<VerticalStackLayout Grid.Row="0">
<Label Text="{Binding DayText}" FontAttributes="Bold" FontSize="18" />
<Label Text="{Binding DateText}" FontSize="13" Opacity="0.7" />
</VerticalStackLayout>
<Grid Grid.Row="1" ColumnDefinitions="*,*" ColumnSpacing="10">
<Border
Grid.Column="0"
BackgroundColor="{Binding MorningBackgroundColor}"
StrokeThickness="0"
StrokeShape="RoundRectangle 10"
Padding="10">
<Border.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding Source={x:Reference ThisPage}, Path=BindingContext.OpenDayCommand}"
CommandParameter="{Binding .}" />
</Border.GestureRecognizers>
<VerticalStackLayout>
<Label Text="Vormittag" FontAttributes="Bold" TextColor="{Binding MorningTextColor}" />
<Label Text="{Binding MorningText}" FontSize="18" TextColor="{Binding MorningTextColor}" />
<Label Text="{Binding MorningCountText}" FontSize="12" TextColor="{Binding MorningTextColor}" />
</VerticalStackLayout>
</Border>
<Border
Grid.Column="1"
BackgroundColor="{Binding AfternoonBackgroundColor}"
StrokeThickness="0"
StrokeShape="RoundRectangle 10"
Padding="10">
<Border.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding Source={x:Reference ThisPage}, Path=BindingContext.OpenDayCommand}"
CommandParameter="{Binding .}" />
</Border.GestureRecognizers>
<VerticalStackLayout>
<Label Text="Nachmittag" FontAttributes="Bold" TextColor="{Binding AfternoonTextColor}" />
<Label Text="{Binding AfternoonText}" FontSize="18" TextColor="{Binding AfternoonTextColor}" />
<Label Text="{Binding AfternoonCountText}" FontSize="12" TextColor="{Binding AfternoonTextColor}" />
</VerticalStackLayout>
</Border>
</Grid>
</Grid>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
+20
View File
@@ -0,0 +1,20 @@
using cfs_tracker.ViewModels;
namespace cfs_tracker.Views;
public partial class WeekPage : ContentPage
{
private readonly WeekViewModel _viewModel;
public WeekPage(WeekViewModel viewModel)
{
InitializeComponent();
BindingContext = _viewModel = viewModel;
}
protected override async void OnAppearing()
{
base.OnAppearing();
await _viewModel.RefreshAsync();
}
}
+127
View File
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="cfs_tracker.Views.YearPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Name="ThisPage"
Title="Jahr">
<Grid RowDefinitions="Auto,*" Padding="16">
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto" Margin="0,0,0,12">
<Button
Grid.Column="0"
Text="◀"
WidthRequest="52"
HeightRequest="44"
Command="{Binding PreviousYearCommand}" />
<Label
Grid.Column="1"
Text="{Binding SelectedYearText}"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
FontSize="24"
FontAttributes="Bold" />
<Button
Grid.Column="2"
Text="Heute"
Margin="8,0,0,0"
Command="{Binding TodayCommand}" />
<Button
Grid.Column="3"
Text="▶"
WidthRequest="52"
HeightRequest="44"
Margin="8,0,0,0"
Command="{Binding NextYearCommand}" />
</Grid>
<ScrollView Grid.Row="1">
<VerticalStackLayout
Spacing="12"
BindableLayout.ItemsSource="{Binding Months}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Border
Padding="12"
BackgroundColor="White"
Stroke="#D0D0D0"
StrokeThickness="1"
StrokeShape="RoundRectangle 12">
<VerticalStackLayout Spacing="10">
<Label
Text="{Binding MonthText}"
FontSize="20"
FontAttributes="Bold" />
<HorizontalStackLayout Spacing="4">
<Label Text="Mo" WidthRequest="44" HorizontalTextAlignment="Center" FontSize="12" />
<Label Text="Di" WidthRequest="44" HorizontalTextAlignment="Center" FontSize="12" />
<Label Text="Mi" WidthRequest="44" HorizontalTextAlignment="Center" FontSize="12" />
<Label Text="Do" WidthRequest="44" HorizontalTextAlignment="Center" FontSize="12" />
<Label Text="Fr" WidthRequest="44" HorizontalTextAlignment="Center" FontSize="12" />
<Label Text="Sa" WidthRequest="44" HorizontalTextAlignment="Center" FontSize="12" />
<Label Text="So" WidthRequest="44" HorizontalTextAlignment="Center" FontSize="12" />
</HorizontalStackLayout>
<FlexLayout
Direction="Row"
Wrap="Wrap"
JustifyContent="Start"
AlignItems="Start"
BindableLayout.ItemsSource="{Binding Days}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Border
WidthRequest="44"
HeightRequest="44"
Margin="2"
BackgroundColor="{Binding BackgroundColor}"
Stroke="{Binding BorderColor}"
StrokeThickness="1"
StrokeShape="RoundRectangle 8">
<Grid Padding="4">
<Grid.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding Source={x:Reference ThisPage}, Path=BindingContext.OpenDayCommand}"
CommandParameter="{Binding .}" />
</Grid.GestureRecognizers>
<VerticalStackLayout
IsVisible="{Binding IsRealDay}"
Spacing="1">
<Label
Text="{Binding DayNumberText}"
TextColor="{Binding TextColor}"
FontSize="11"
FontAttributes="Bold"
HorizontalTextAlignment="Center" />
<Label
Text="{Binding CountText}"
TextColor="{Binding TextColor}"
FontSize="9"
HorizontalTextAlignment="Center" />
</VerticalStackLayout>
</Grid>
</Border>
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>
</VerticalStackLayout>
</Border>
</DataTemplate>
</BindableLayout.ItemTemplate>
</VerticalStackLayout>
</ScrollView>
</Grid>
</ContentPage>
+20
View File
@@ -0,0 +1,20 @@
using cfs_tracker.ViewModels;
namespace cfs_tracker.Views;
public partial class YearPage : ContentPage
{
private readonly YearViewModel _viewModel;
public YearPage(YearViewModel viewModel)
{
InitializeComponent();
BindingContext = _viewModel = viewModel;
}
protected override async void OnAppearing()
{
base.OnAppearing();
await _viewModel.RefreshAsync();
}
}
+73
View File
@@ -0,0 +1,73 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net10.0-android;net10.0-windows10.0.19041.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>cfs_tracker</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<MauiXamlInflator>SourceGen</MauiXamlInflator>
<ApplicationTitle>cfs-tracker</ApplicationTitle>
<ApplicationId>com.companyname.cfstracker</ApplicationId>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<WindowsPackageType>None</WindowsPackageType>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>
<ItemGroup>
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
<MauiFont Include="Resources\Fonts\*" />
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.1" />
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.50" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.5" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
</ItemGroup>
<ItemGroup>
<MauiXaml Update="Views\DayPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\MonthPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\Options.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\QuickEntryPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\WeekPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\YearPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
</Project>
+3
View File
@@ -0,0 +1,3 @@
<Solution>
<Project Path="cfs-tracker.csproj" />
</Solution>