commit 5ca2770829daa1d5e5a96c0531cd507be920d0ab Author: Michi Date: Wed Nov 25 13:44:02 2026 +0100 Initial commit: ReminderOrganizer WPF app Co-Authored-By: Claude Opus 5.5 diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..311eb5d --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,7 @@ +{ + "permissions": { + "allow": [ + "PowerShell(node D:\\\\Oculusquest\\\\Projekt\\\\_Tools\\\\Library\\\\tools\\\\project-check.mjs \"d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer\")" + ] + } +} diff --git a/.dashboard.json b/.dashboard.json new file mode 100644 index 0000000..d937de7 --- /dev/null +++ b/.dashboard.json @@ -0,0 +1,12 @@ +{ + "status": "done", + "priority": "medium", + "notes": "", + "tags": [], + "tasks": [], + "thumbnail": "", + "start": "", + "program": "", + "itch": "", + "updatedAt": "2026-11-11T09:23:52.594Z" +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e4f0d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +bin/ +obj/ +publish/ +*.zip +*.user +.vs/ +error.log +nul +Tests/TestResults/ diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..5eb0a96 --- /dev/null +++ b/App.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..1c0cc4f --- /dev/null +++ b/App.xaml.cs @@ -0,0 +1,58 @@ +#nullable enable +using System; +using System.IO; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Threading; +using Microsoft.Extensions.DependencyInjection; +using ReminderOrganizer.Services; +using ReminderOrganizer.ViewModels; + +namespace ReminderOrganizer +{ + public partial class App : Application + { + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + + SetupExceptionHandling(); + ServiceLocator.Initialize(); + } + + private void SetupExceptionHandling() + { + AppDomain.CurrentDomain.UnhandledException += (s, e) => + { + LogException((Exception)e.ExceptionObject, "AppDomain.UnhandledException"); + if (e.IsTerminating) + Environment.Exit(1); + }; + + DispatcherUnhandledException += (s, e) => + { + LogException(e.Exception, "DispatcherUnhandledException"); + e.Handled = true; + MessageBox.Show($"An unexpected error occurred:\n{e.Exception.Message}", + "Error", MessageBoxButton.OK, MessageBoxImage.Error); + }; + + TaskScheduler.UnobservedTaskException += (s, e) => + { + LogException(e.Exception, "UnobservedTaskException"); + e.SetObserved(); + }; + } + + private static void LogException(Exception ex, string source) + { + try + { + var logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "error.log"); + var logEntry = $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] [{source}]\n{ex}\n\n"; + File.AppendAllText(logPath, logEntry); + } + catch { } + } + } +} diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs new file mode 100644 index 0000000..cc29e7f --- /dev/null +++ b/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Converters/Converters.cs b/Converters/Converters.cs new file mode 100644 index 0000000..8abaa5b --- /dev/null +++ b/Converters/Converters.cs @@ -0,0 +1,128 @@ +#nullable enable +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace ReminderOrganizer.Converters +{ + public class BoolToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool b) + return b ? Visibility.Visible : Visibility.Collapsed; + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return value is Visibility v && v == Visibility.Visible; + } + } + + public class NullToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value != null ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + public class ZeroToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is int count) + return count == 0 ? Visibility.Visible : Visibility.Collapsed; + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + public class CountToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is int count) + return count > 0 ? Visibility.Visible : Visibility.Collapsed; + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + public class StringToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is string str) + return !string.IsNullOrWhiteSpace(str) ? Visibility.Visible : Visibility.Collapsed; + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + public class DatePassedConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is DateTime date) + return date < DateTime.Now; + return false; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + public class InverseBoolConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool b) + return !b; + return true; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool b) + return !b; + return false; + } + } + + public class InverseBoolToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool b) + return b ? Visibility.Collapsed : Visibility.Visible; + return Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return value is Visibility v && v == Visibility.Collapsed; + } + } +} diff --git a/Core/RelayCommand.cs b/Core/RelayCommand.cs new file mode 100644 index 0000000..5f82cb3 --- /dev/null +++ b/Core/RelayCommand.cs @@ -0,0 +1,57 @@ +#nullable enable +using System; +using System.Windows.Input; + +namespace ReminderOrganizer.Core +{ + public class RelayCommand : ICommand + { + private readonly Action _execute; + private readonly Predicate? _canExecute; + + public RelayCommand(Action execute, Predicate? canExecute = null) + { + _execute = execute ?? throw new ArgumentNullException(nameof(execute)); + _canExecute = canExecute; + } + + public RelayCommand(Action execute, Func? canExecute = null) + : this(_ => execute(), canExecute is null ? null : _ => canExecute()) + { + } + + public event EventHandler? CanExecuteChanged + { + add => CommandManager.RequerySuggested += value; + remove => CommandManager.RequerySuggested -= value; + } + + public bool CanExecute(object? parameter) => _canExecute?.Invoke(parameter) ?? true; + + public void Execute(object? parameter) => _execute(parameter); + + public void RaiseCanExecuteChanged() => CommandManager.InvalidateRequerySuggested(); + } + + public class RelayCommand : ICommand + { + private readonly Action _execute; + private readonly Predicate? _canExecute; + + public RelayCommand(Action execute, Predicate? canExecute = null) + { + _execute = execute ?? throw new ArgumentNullException(nameof(execute)); + _canExecute = canExecute; + } + + public event EventHandler? CanExecuteChanged + { + add => CommandManager.RequerySuggested += value; + remove => CommandManager.RequerySuggested -= value; + } + + public bool CanExecute(object? parameter) => _canExecute?.Invoke((T?)parameter) ?? true; + + public void Execute(object? parameter) => _execute((T?)parameter); + } +} diff --git a/Core/ViewModelBase.cs b/Core/ViewModelBase.cs new file mode 100644 index 0000000..714a454 --- /dev/null +++ b/Core/ViewModelBase.cs @@ -0,0 +1,24 @@ +#nullable enable +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace ReminderOrganizer.Core +{ + public abstract class ViewModelBase : INotifyPropertyChanged + { + public event PropertyChangedEventHandler? PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + protected bool SetProperty(ref T field, T value, [CallerMemberName] string? propertyName = null) + { + if (Equals(field, value)) return false; + field = value; + OnPropertyChanged(propertyName); + return true; + } + } +} diff --git a/InputDialog.xaml b/InputDialog.xaml new file mode 100644 index 0000000..d48e055 --- /dev/null +++ b/InputDialog.xaml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +