Initial commit: ReminderOrganizer WPF app
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
7
.claude/settings.json
Normal file
7
.claude/settings.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"PowerShell(node D:\\\\Oculusquest\\\\Projekt\\\\_Tools\\\\Library\\\\tools\\\\project-check.mjs \"d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer\")"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
12
.dashboard.json
Normal file
12
.dashboard.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"status": "done",
|
||||||
|
"priority": "medium",
|
||||||
|
"notes": "",
|
||||||
|
"tags": [],
|
||||||
|
"tasks": [],
|
||||||
|
"thumbnail": "",
|
||||||
|
"start": "",
|
||||||
|
"program": "",
|
||||||
|
"itch": "",
|
||||||
|
"updatedAt": "2026-11-11T09:23:52.594Z"
|
||||||
|
}
|
||||||
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
publish/
|
||||||
|
*.zip
|
||||||
|
*.user
|
||||||
|
.vs/
|
||||||
|
error.log
|
||||||
|
nul
|
||||||
|
Tests/TestResults/
|
||||||
16
App.xaml
Normal file
16
App.xaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<Application x:Class="ReminderOrganizer.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:converters="clr-namespace:ReminderOrganizer.Converters"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
<converters:BoolToVisibilityConverter x:Key="BoolToVisibility"/>
|
||||||
|
<converters:NullToVisibilityConverter x:Key="NullToVisibility"/>
|
||||||
|
<converters:ZeroToVisibilityConverter x:Key="ZeroToVisibility"/>
|
||||||
|
<converters:CountToVisibilityConverter x:Key="CountToVisibility"/>
|
||||||
|
<converters:StringToVisibilityConverter x:Key="StringToVisibility"/>
|
||||||
|
<converters:DatePassedConverter x:Key="DatePassed"/>
|
||||||
|
<converters:InverseBoolConverter x:Key="InverseBool"/>
|
||||||
|
<converters:InverseBoolToVisibilityConverter x:Key="InverseBoolToVisibility"/>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
58
App.xaml.cs
Normal file
58
App.xaml.cs
Normal file
@@ -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 { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
AssemblyInfo.cs
Normal file
10
AssemblyInfo.cs
Normal file
@@ -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)
|
||||||
|
)]
|
||||||
128
Converters/Converters.cs
Normal file
128
Converters/Converters.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
57
Core/RelayCommand.cs
Normal file
57
Core/RelayCommand.cs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Core
|
||||||
|
{
|
||||||
|
public class RelayCommand : ICommand
|
||||||
|
{
|
||||||
|
private readonly Action<object?> _execute;
|
||||||
|
private readonly Predicate<object?>? _canExecute;
|
||||||
|
|
||||||
|
public RelayCommand(Action<object?> execute, Predicate<object?>? canExecute = null)
|
||||||
|
{
|
||||||
|
_execute = execute ?? throw new ArgumentNullException(nameof(execute));
|
||||||
|
_canExecute = canExecute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelayCommand(Action execute, Func<bool>? 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<T> : ICommand
|
||||||
|
{
|
||||||
|
private readonly Action<T?> _execute;
|
||||||
|
private readonly Predicate<T?>? _canExecute;
|
||||||
|
|
||||||
|
public RelayCommand(Action<T?> execute, Predicate<T?>? 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Core/ViewModelBase.cs
Normal file
24
Core/ViewModelBase.cs
Normal file
@@ -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<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
||||||
|
{
|
||||||
|
if (Equals(field, value)) return false;
|
||||||
|
field = value;
|
||||||
|
OnPropertyChanged(propertyName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
61
InputDialog.xaml
Normal file
61
InputDialog.xaml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<Window x:Class="ReminderOrganizer.InputDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="Input"
|
||||||
|
Height="200" Width="400"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
ShowInTaskbar="False"
|
||||||
|
WindowStyle="None"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Transparent"
|
||||||
|
MouseLeftButtonDown="Window_MouseLeftButtonDown">
|
||||||
|
<Window.Resources>
|
||||||
|
<SolidColorBrush x:Key="PrimaryBrush" Color="#6366F1"/>
|
||||||
|
<SolidColorBrush x:Key="PrimaryHoverBrush" Color="#4F46E5"/>
|
||||||
|
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#1E293B"/>
|
||||||
|
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#64748B"/>
|
||||||
|
<SolidColorBrush x:Key="BorderBrush" Color="#CBD5E1"/>
|
||||||
|
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
|
||||||
|
<SolidColorBrush x:Key="InputBackgroundBrush" Color="#F1F5F9"/>
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Border CornerRadius="12" Background="{DynamicResource CardBrush}" Margin="8">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect BlurRadius="20" ShadowDepth="5" Opacity="0.2" Direction="270" Color="Black"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<Border Grid.Row="0" Background="{DynamicResource PrimaryBrush}" CornerRadius="12,12,0,0" Padding="16,12">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="📁" FontSize="16" Foreground="White" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock x:Name="TxtPrompt" FontSize="14" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="28,0,0,0"/>
|
||||||
|
<Button Content="✕" HorizontalAlignment="Right" Foreground="White" Background="Transparent" BorderThickness="0"
|
||||||
|
Width="28" Height="28" Cursor="Hand" Click="BtnCancel_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<StackPanel Grid.Row="1" Margin="16">
|
||||||
|
<TextBox x:Name="TxtInput" Background="{DynamicResource InputBackgroundBrush}"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||||
|
Padding="12,10" FontSize="14"/>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
|
||||||
|
<Button x:Name="BtnCancel" Click="BtnCancel_Click" Background="Transparent"
|
||||||
|
Foreground="{DynamicResource TextPrimaryBrush}"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||||
|
Padding="16,8" Cursor="Hand"/>
|
||||||
|
<Button x:Name="BtnOk" Click="BtnOk_Click" Background="#6366F1"
|
||||||
|
Foreground="White" BorderThickness="0"
|
||||||
|
Padding="16,8" Margin="8,0,0,0" Cursor="Hand" IsDefault="True"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Window>
|
||||||
51
InputDialog.xaml.cs
Normal file
51
InputDialog.xaml.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using ReminderOrganizer.Core;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer
|
||||||
|
{
|
||||||
|
public partial class InputDialog : Window
|
||||||
|
{
|
||||||
|
public string ResponseText { get; private set; } = "";
|
||||||
|
|
||||||
|
public InputDialog(string title, string prompt, string defaultValue = "", ILocalizationService? localizationService = null)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Title = title;
|
||||||
|
TxtPrompt.Text = prompt;
|
||||||
|
TxtInput.Text = defaultValue;
|
||||||
|
|
||||||
|
// Localize buttons if localization service is provided
|
||||||
|
if (localizationService != null)
|
||||||
|
{
|
||||||
|
BtnCancel.Content = localizationService.GetString("Cancel");
|
||||||
|
BtnOk.Content = localizationService.GetString("OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
TxtInput.SelectAll();
|
||||||
|
TxtInput.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnOk_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ResponseText = TxtInput.Text;
|
||||||
|
DialogResult = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnCancel_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
87
Locales/de.json
Normal file
87
Locales/de.json
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"AppTitle": "Reminder Organizer",
|
||||||
|
"File": "Datei",
|
||||||
|
"Exit": "Beenden",
|
||||||
|
"Extras": "Extras",
|
||||||
|
"Autostart": "Autostart",
|
||||||
|
"Settings": "Einstellungen",
|
||||||
|
"Language": "Sprache",
|
||||||
|
"German": "Deutsch",
|
||||||
|
"English": "Englisch",
|
||||||
|
"AddFolder": "+ Ordner",
|
||||||
|
"AddTask": "+ Task",
|
||||||
|
"Welcome": "Willkommen",
|
||||||
|
"NoFolderSelected": "Kein Ordner ausgewählt",
|
||||||
|
"Name": "Name",
|
||||||
|
"Description": "Beschreibung",
|
||||||
|
"Date": "Datum",
|
||||||
|
"Save": "Speichern",
|
||||||
|
"Cancel": "Abbrechen",
|
||||||
|
"OK": "OK",
|
||||||
|
"SelectFolder": "Bitte erst einen Ordner auswählen",
|
||||||
|
"InvalidDate": "Ungültiges Datumsformat",
|
||||||
|
"AutostartEnabled": "Autostart aktiviert",
|
||||||
|
"AutostartDisabled": "Autostart deaktiviert",
|
||||||
|
"SaveError": "Fehler beim Speichern",
|
||||||
|
"Open": "Öffnen",
|
||||||
|
"Delete": "Löschen",
|
||||||
|
"Rename": "Umbenennen",
|
||||||
|
"DeleteFolder": "Ordner löschen",
|
||||||
|
"DeleteTask": "Task löschen",
|
||||||
|
"RenameFolder": "Ordner umbenennen",
|
||||||
|
"NewName": "Neuer Name:",
|
||||||
|
"FolderDeleted": "Ordner gelöscht",
|
||||||
|
"TaskDeleted": "Task gelöscht",
|
||||||
|
"Folders": "Ordner",
|
||||||
|
"Tasks": "Tasks",
|
||||||
|
"TaskDetails": "Task-Details",
|
||||||
|
"Reminder": "Erinnerung",
|
||||||
|
"Completed": "Erledigt",
|
||||||
|
"Pending": "Ausstehend",
|
||||||
|
"Overdue": "Überfällig",
|
||||||
|
"View": "Ansicht",
|
||||||
|
"DarkMode": "Dunkel",
|
||||||
|
"LightMode": "Hell",
|
||||||
|
"AddTaskToFolder": "Task hinzufügen",
|
||||||
|
"EditTask": "Task bearbeiten",
|
||||||
|
"NameRequired": "Bitte geben Sie einen Namen ein.",
|
||||||
|
"Minimize": "Minimieren",
|
||||||
|
"Maximize": "Maximieren",
|
||||||
|
"Close": "Schließen",
|
||||||
|
"CreateTaskHint": "Erstelle einen neuen Task, um loszulegen!",
|
||||||
|
"NoTasks": "Keine Tasks vorhanden",
|
||||||
|
"MyTasks": "Meine Tasks",
|
||||||
|
"NewFolder": "Neuer Ordner",
|
||||||
|
"NewTask": "Neuer Task",
|
||||||
|
"Recurring": "Wiederholend",
|
||||||
|
"Daily": "Täglich",
|
||||||
|
"Weekly": "Wöchentlich",
|
||||||
|
"Monthly": "Monatlich",
|
||||||
|
"Yearly": "Jährlich",
|
||||||
|
"NextOccurrence": "Nächste:",
|
||||||
|
"Quick": "Schnell:",
|
||||||
|
"Tomorrow": "Morgen",
|
||||||
|
"NextWeek": "Nächste Woche",
|
||||||
|
"NextMonth": "Nächster Monat",
|
||||||
|
"EditTaskTooltip": "Task bearbeiten",
|
||||||
|
"DeleteTaskTooltip": "Task löschen",
|
||||||
|
"Info": "Info",
|
||||||
|
"Discord": "Discord Einladung",
|
||||||
|
"Import": "Import",
|
||||||
|
"Export": "Export",
|
||||||
|
"ImportCsv": "CSV Importieren",
|
||||||
|
"ExportCsv": "CSV Exportieren",
|
||||||
|
"ImportSuccess": "{0} Tasks erfolgreich importiert!",
|
||||||
|
"ImportError": "Fehler beim Importieren: {0}",
|
||||||
|
"ExportSuccess": "Tasks erfolgreich exportiert!",
|
||||||
|
"ExportError": "Fehler beim Exportieren: {0}",
|
||||||
|
"TestNotification": "Test Benachrichtigung",
|
||||||
|
"TestNotificationTitle": "Test Benachrichtigung",
|
||||||
|
"TestNotificationMessage": "Dies ist eine Test-Benachrichtigung!",
|
||||||
|
"UnexpectedError": "Ein unerwarteter Fehler ist aufgetreten: {0}",
|
||||||
|
"NoFolderSelectFirst": "Bitte zuerst einen Ordner auswählen oder erstellen.",
|
||||||
|
"ImportInvalidDate": "Ungültiges Datum in Zeile {0}",
|
||||||
|
"ImportSkippedRow": "Zeile {0} übersprungen: nicht genug Spalten",
|
||||||
|
"AppTitle": "Reminder Organizer",
|
||||||
|
"RecurringTaskTooltip": "Wiederkehrende Aufgabe"
|
||||||
|
}
|
||||||
87
Locales/en.json
Normal file
87
Locales/en.json
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"AppTitle": "Reminder Organizer",
|
||||||
|
"File": "File",
|
||||||
|
"Exit": "Exit",
|
||||||
|
"Extras": "Extras",
|
||||||
|
"Autostart": "Autostart",
|
||||||
|
"Settings": "Settings",
|
||||||
|
"Language": "Language",
|
||||||
|
"German": "German",
|
||||||
|
"English": "English",
|
||||||
|
"AddFolder": "+ Folder",
|
||||||
|
"AddTask": "+ Task",
|
||||||
|
"Welcome": "Welcome",
|
||||||
|
"NoFolderSelected": "No folder selected",
|
||||||
|
"Name": "Name",
|
||||||
|
"Description": "Description",
|
||||||
|
"Date": "Date",
|
||||||
|
"Save": "Save",
|
||||||
|
"Cancel": "Cancel",
|
||||||
|
"OK": "OK",
|
||||||
|
"SelectFolder": "Please select a folder first",
|
||||||
|
"InvalidDate": "Invalid date format",
|
||||||
|
"AutostartEnabled": "Autostart enabled",
|
||||||
|
"AutostartDisabled": "Autostart disabled",
|
||||||
|
"SaveError": "Error saving data",
|
||||||
|
"Open": "Open",
|
||||||
|
"Delete": "Delete",
|
||||||
|
"Rename": "Rename",
|
||||||
|
"DeleteFolder": "Delete Folder",
|
||||||
|
"DeleteTask": "Delete Task",
|
||||||
|
"RenameFolder": "Rename Folder",
|
||||||
|
"NewName": "New name:",
|
||||||
|
"FolderDeleted": "Folder deleted",
|
||||||
|
"TaskDeleted": "Task deleted",
|
||||||
|
"Folders": "Folders",
|
||||||
|
"Tasks": "Tasks",
|
||||||
|
"TaskDetails": "Task Details",
|
||||||
|
"Reminder": "Reminder",
|
||||||
|
"Completed": "Completed",
|
||||||
|
"Pending": "Pending",
|
||||||
|
"Overdue": "Overdue",
|
||||||
|
"View": "View",
|
||||||
|
"DarkMode": "Dark",
|
||||||
|
"LightMode": "Light",
|
||||||
|
"AddTaskToFolder": "Add Task",
|
||||||
|
"EditTask": "Edit Task",
|
||||||
|
"NameRequired": "Please enter a name.",
|
||||||
|
"Minimize": "Minimize",
|
||||||
|
"Maximize": "Maximize",
|
||||||
|
"Close": "Close",
|
||||||
|
"CreateTaskHint": "Create a new task to get started!",
|
||||||
|
"NoTasks": "No tasks available",
|
||||||
|
"MyTasks": "My Tasks",
|
||||||
|
"NewFolder": "New Folder",
|
||||||
|
"NewTask": "New Task",
|
||||||
|
"Recurring": "Recurring",
|
||||||
|
"Daily": "Daily",
|
||||||
|
"Weekly": "Weekly",
|
||||||
|
"Monthly": "Monthly",
|
||||||
|
"Yearly": "Yearly",
|
||||||
|
"NextOccurrence": "Next:",
|
||||||
|
"Quick": "Quick:",
|
||||||
|
"Tomorrow": "Tomorrow",
|
||||||
|
"NextWeek": "Next Week",
|
||||||
|
"NextMonth": "Next Month",
|
||||||
|
"EditTaskTooltip": "Edit task",
|
||||||
|
"DeleteTaskTooltip": "Delete task",
|
||||||
|
"Info": "Info",
|
||||||
|
"Discord": "Discord Invite",
|
||||||
|
"Import": "Import",
|
||||||
|
"Export": "Export",
|
||||||
|
"ImportCsv": "Import CSV",
|
||||||
|
"ExportCsv": "Export CSV",
|
||||||
|
"ImportSuccess": "Imported {0} tasks successfully!",
|
||||||
|
"ImportError": "Error importing CSV: {0}",
|
||||||
|
"ExportSuccess": "Tasks exported successfully!",
|
||||||
|
"ExportError": "Error exporting CSV: {0}",
|
||||||
|
"TestNotification": "Test Notification",
|
||||||
|
"TestNotificationTitle": "Test Notification",
|
||||||
|
"TestNotificationMessage": "This is a test notification!",
|
||||||
|
"UnexpectedError": "An unexpected error occurred: {0}",
|
||||||
|
"NoFolderSelectFirst": "Please select or create a folder first.",
|
||||||
|
"ImportInvalidDate": "Invalid date in row {0}",
|
||||||
|
"ImportSkippedRow": "Row {0} skipped: not enough columns",
|
||||||
|
"AppTitle": "Reminder Organizer",
|
||||||
|
"RecurringTaskTooltip": "Recurring task"
|
||||||
|
}
|
||||||
730
MainWindow.xaml
Normal file
730
MainWindow.xaml
Normal file
@@ -0,0 +1,730 @@
|
|||||||
|
<Window x:Class="ReminderOrganizer.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:models="clr-namespace:ReminderOrganizer.Models"
|
||||||
|
Title="Reminder Organizer"
|
||||||
|
Height="700" Width="1100"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
MinHeight="550" MinWidth="900"
|
||||||
|
WindowStyle="None"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Transparent">
|
||||||
|
<Window.Resources>
|
||||||
|
<!-- Animation Durations -->
|
||||||
|
<Duration x:Key="QuickAnimation">0:0:0.15</Duration>
|
||||||
|
<Duration x:Key="NormalAnimation">0:0:0.3</Duration>
|
||||||
|
<Duration x:Key="SlowAnimation">0:0:0.5</Duration>
|
||||||
|
|
||||||
|
<!-- Modern Color Palette -->
|
||||||
|
<SolidColorBrush x:Key="PrimaryBrush" Color="#6366F1"/>
|
||||||
|
<SolidColorBrush x:Key="PrimaryHoverBrush" Color="#4F46E5"/>
|
||||||
|
<SolidColorBrush x:Key="PrimaryLightBrush" Color="#EEF2FF"/>
|
||||||
|
<SolidColorBrush x:Key="SecondaryBrush" Color="#10B981"/>
|
||||||
|
<SolidColorBrush x:Key="DangerBrush" Color="#EF4444"/>
|
||||||
|
<SolidColorBrush x:Key="WarningBrush" Color="#F59E0B"/>
|
||||||
|
<SolidColorBrush x:Key="GlowBrush" Color="#6366F1"/>
|
||||||
|
|
||||||
|
<!-- Dynamic Theme Resources (will be set in code) -->
|
||||||
|
<SolidColorBrush x:Key="SidebarBrush" Color="#1E1E2E"/>
|
||||||
|
<SolidColorBrush x:Key="CardBrush" Color="#252535"/>
|
||||||
|
<SolidColorBrush x:Key="HeaderBrush" Color="#252535"/>
|
||||||
|
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#FFFFFF"/>
|
||||||
|
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#B0B0C0"/>
|
||||||
|
<SolidColorBrush x:Key="BorderBrush" Color="#3A3A4A"/>
|
||||||
|
<SolidColorBrush x:Key="BackgroundBrush" Color="#18181F"/>
|
||||||
|
<SolidColorBrush x:Key="HoverBrush" Color="#2A2A3A"/>
|
||||||
|
<SolidColorBrush x:Key="SidebarTextBrush" Color="#FFFFFF"/>
|
||||||
|
<SolidColorBrush x:Key="SidebarSecondaryBrush" Color="#808090"/>
|
||||||
|
<SolidColorBrush x:Key="MenuBackgroundBrush" Color="#252535"/>
|
||||||
|
|
||||||
|
<!-- Glow Effect -->
|
||||||
|
<DropShadowEffect x:Key="GlowEffect" BlurRadius="15" ShadowDepth="0" Opacity="0.5" Color="#6366F1"/>
|
||||||
|
|
||||||
|
<!-- Additional Brushes -->
|
||||||
|
<SolidColorBrush x:Key="SuccessBrush" Color="#10B981"/>
|
||||||
|
<SolidColorBrush x:Key="CompletedBrush" Color="#94A3B8"/>
|
||||||
|
|
||||||
|
<!-- Modern Button Style with Hover Animation and Gradient -->
|
||||||
|
<Style x:Key="ModernButton" TargetType="Button">
|
||||||
|
<Setter Property="Foreground" Value="White"/>
|
||||||
|
<Setter Property="Padding" Value="16,10"/>
|
||||||
|
<Setter Property="Margin" Value="4"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="FontWeight" Value="Medium"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
|
||||||
|
<Setter Property="RenderTransform">
|
||||||
|
<Setter.Value>
|
||||||
|
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border x:Name="border" CornerRadius="10" Padding="{TemplateBinding Padding}"
|
||||||
|
RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Border.Background>
|
||||||
|
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||||
|
<GradientStop Color="#7C7CF1" Offset="0"/>
|
||||||
|
<GradientStop Color="#6366F1" Offset="0.5"/>
|
||||||
|
<GradientStop Color="#5555E5" Offset="1"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
|
<Border.RenderTransform>
|
||||||
|
<ScaleTransform x:Name="scaleTransform" ScaleX="1" ScaleY="1"/>
|
||||||
|
</Border.RenderTransform>
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect x:Name="glowEffect" BlurRadius="0" ShadowDepth="2" Opacity="0" Color="#6366F1"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleX" To="1.05" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleY" To="1.05" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="glowEffect" Storyboard.TargetProperty="BlurRadius" To="25" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="glowEffect" Storyboard.TargetProperty="Opacity" To="0.6" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleX" To="1" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleY" To="1" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="glowEffect" Storyboard.TargetProperty="BlurRadius" To="0" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="glowEffect" Storyboard.TargetProperty="Opacity" To="0" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Opacity" Value="0.5"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="SecondaryButton" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="Padding" Value="16,10"/>
|
||||||
|
<Setter Property="Margin" Value="4"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border x:Name="border" Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="10" Padding="{TemplateBinding Padding}"
|
||||||
|
RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Border.RenderTransform>
|
||||||
|
<ScaleTransform x:Name="scaleTransform" ScaleX="1" ScaleY="1"/>
|
||||||
|
</Border.RenderTransform>
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="DangerButton" TargetType="Button" BasedOn="{StaticResource ModernButton}">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DangerBrush}"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="IconButton" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
<Setter Property="Width" Value="36"/>
|
||||||
|
<Setter Property="Height" Value="36"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border x:Name="border" Background="{TemplateBinding Background}"
|
||||||
|
CornerRadius="8">
|
||||||
|
<Border.RenderTransform>
|
||||||
|
<ScaleTransform x:Name="scaleTransform" ScaleX="1" ScaleY="1"/>
|
||||||
|
</Border.RenderTransform>
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleX" To="1.15" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleY" To="1.15" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
<ColorAnimation Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#E2E8F0" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleX" To="1" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="scaleTransform" Storyboard.TargetProperty="ScaleY" To="1" Duration="{StaticResource QuickAnimation}"/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Card Style with Better Shadow -->
|
||||||
|
<Style x:Key="ModernCard" TargetType="Border">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource CardBrush}"/>
|
||||||
|
<Setter Property="CornerRadius" Value="16"/>
|
||||||
|
<Setter Property="Padding" Value="24"/>
|
||||||
|
<Setter Property="Effect">
|
||||||
|
<Setter.Value>
|
||||||
|
<DropShadowEffect BlurRadius="30" ShadowDepth="8" Opacity="0.25" Direction="270" Color="Black"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Task Item Style with Hover Glow -->
|
||||||
|
<Style x:Key="TaskItemBorder" TargetType="Border">
|
||||||
|
<Setter Property="CornerRadius" Value="12"/>
|
||||||
|
<Setter Property="Margin" Value="0,4"/>
|
||||||
|
<Setter Property="Padding" Value="16"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
|
||||||
|
<Setter Property="Effect">
|
||||||
|
<Setter.Value>
|
||||||
|
<DropShadowEffect x:Name="taskGlow" BlurRadius="0" ShadowDepth="0" Opacity="0" Color="#6366F1"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Scrollbar Style -->
|
||||||
|
<Style TargetType="ScrollBar">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Width" Value="6"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ScrollBar">
|
||||||
|
<Grid>
|
||||||
|
<Border Background="{DynamicResource BackgroundBrush}" CornerRadius="3"/>
|
||||||
|
<Track x:Name="PART_Track" IsDirectionReversed="True">
|
||||||
|
<Track.Thumb>
|
||||||
|
<Thumb>
|
||||||
|
<Thumb.Template>
|
||||||
|
<ControlTemplate TargetType="Thumb">
|
||||||
|
<Border x:Name="thumbBorder" Background="{DynamicResource BorderBrush}" CornerRadius="3" Margin="1"/>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="thumbBorder" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Thumb.Template>
|
||||||
|
</Thumb>
|
||||||
|
</Track.Thumb>
|
||||||
|
</Track>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="Orientation" Value="Horizontal">
|
||||||
|
<Setter Property="Height" Value="6"/>
|
||||||
|
<Setter Property="Width" Value="Auto"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- ScrollViewer Style -->
|
||||||
|
<Style TargetType="ScrollViewer">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Modern Menu Style -->
|
||||||
|
<Style TargetType="Menu">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="MenuItem">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||||
|
<Setter Property="Padding" Value="10,6"/>
|
||||||
|
<Setter Property="FontSize" Value="13"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Context Menu Style for Dark Mode -->
|
||||||
|
<Style TargetType="ContextMenu">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource CardBrush}"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- MenuItem Style with Dark Mode Support -->
|
||||||
|
<Style x:Key="DarkMenuItemStyle" TargetType="MenuItem">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Padding" Value="10,6"/>
|
||||||
|
<Setter Property="FontSize" Value="13"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="MenuItem">
|
||||||
|
<Border x:Name="Border" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="Icon"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ContentPresenter x:Name="Icon" Grid.Column="0" ContentSource="Icon" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||||
|
<ContentPresenter Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock x:Name="InputGestureText" Grid.Column="2" Text="{TemplateBinding InputGestureText}"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}" Margin="20,0,0,0" VerticalAlignment="Center"/>
|
||||||
|
<Path x:Name="SubMenuArrow" Grid.Column="3" Data="M0,0 L4,4 L0,8"
|
||||||
|
Fill="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center" Margin="8,0,0,0"
|
||||||
|
Visibility="Collapsed"/>
|
||||||
|
<Popup x:Name="SubMenuPopup" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
Placement="Right" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade">
|
||||||
|
<Border Background="{DynamicResource CardBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="2">
|
||||||
|
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
|
||||||
|
</Border>
|
||||||
|
</Popup>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="Role" Value="TopLevelHeader">
|
||||||
|
<Setter TargetName="SubMenuArrow" Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Setter TargetName="SubMenuPopup" Property="Placement" Value="Bottom"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="Role" Value="TopLevelItem">
|
||||||
|
<Setter TargetName="SubMenuArrow" Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Setter TargetName="SubMenuPopup" Property="Placement" Value="Bottom"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="Role" Value="SubmenuHeader">
|
||||||
|
<Setter TargetName="SubMenuArrow" Property="Visibility" Value="Visible"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsHighlighted" Value="True">
|
||||||
|
<Setter TargetName="Border" Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<!-- Main Content -->
|
||||||
|
<Border CornerRadius="12" Background="{DynamicResource BackgroundBrush}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- Top Bar with Menu and Window Controls -->
|
||||||
|
<Border Grid.Row="0" CornerRadius="12,12,0,0" MouseLeftButtonDown="TitleBar_MouseLeftButtonDown" Background="{DynamicResource HeaderBrush}">
|
||||||
|
<DockPanel Margin="8,4">
|
||||||
|
<!-- Window Controls on Right -->
|
||||||
|
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<Button Content="─" Style="{StaticResource IconButton}" Click="MinimizeButton_Click" FontSize="16" FontWeight="Bold" ToolTip="{Binding MinimizeTooltip}"/>
|
||||||
|
<Button x:Name="MaximizeButton" Content="□" Style="{StaticResource IconButton}" Click="MaximizeButton_Click" FontSize="12" ToolTip="{Binding MaximizeTooltip}"/>
|
||||||
|
<Button Content="✕" Style="{StaticResource IconButton}" Click="CloseButton_Click" FontSize="14" Foreground="{DynamicResource DangerBrush}" ToolTip="{Binding CloseTooltip}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Menu Bar on Left -->
|
||||||
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<!-- App Icon and Title -->
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="8,0,20,0" VerticalAlignment="Center">
|
||||||
|
<Border Width="28" Height="28" CornerRadius="6" Background="{DynamicResource PrimaryBrush}" Margin="0,0,10,0">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect BlurRadius="10" ShadowDepth="0" Opacity="0.5" Color="#6366F1"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<TextBlock Text="📋" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<TextBlock Text="{Binding AppTitleText}" FontSize="14" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Menus -->
|
||||||
|
<Menu Background="Transparent" Foreground="{DynamicResource TextPrimaryBrush}">
|
||||||
|
<MenuItem Header="{Binding FileText}" Foreground="{DynamicResource TextPrimaryBrush}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem Header="{Binding SettingsText}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem Header="{Binding LanguageText}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem Header="{Binding GermanText}" Command="{Binding SetLanguageDeCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
||||||
|
Visibility="{Binding IsGerman, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="{Binding EnglishText}" Command="{Binding SetLanguageEnCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
||||||
|
Visibility="{Binding IsEnglish, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
<Separator/>
|
||||||
|
<MenuItem Header="{Binding AutostartText}" Command="{Binding ToggleAutostartCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="{Binding ImportText}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<TextBlock Text="📥" FontSize="12"/>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
<MenuItem Header="{Binding ImportCsvText}" Command="{Binding ImportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="{Binding ExportText}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<TextBlock Text="📤" FontSize="12"/>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
<MenuItem Header="{Binding ExportCsvText}" Command="{Binding ExportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="{Binding InfoText}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<TextBlock Text="💬" FontSize="12"/>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
<MenuItem Header="{Binding DiscordText}" Click="Info_Click" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||||
|
</MenuItem>
|
||||||
|
<Separator/>
|
||||||
|
<MenuItem Header="{Binding ExitText}" Command="{Binding ExitCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="{Binding ViewText}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem Header="{Binding DarkModeText}" Command="{Binding ToggleDarkModeCommand}" Style="{StaticResource DarkMenuItemStyle}"
|
||||||
|
Visibility="{Binding IsDarkMode, Converter={StaticResource InverseBoolToVisibility}}"/>
|
||||||
|
<MenuItem Header="{Binding LightModeText}" Command="{Binding ToggleDarkModeCommand}" Style="{StaticResource DarkMenuItemStyle}"
|
||||||
|
Visibility="{Binding IsDarkMode, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="280"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- Left Sidebar -->
|
||||||
|
<Border Grid.Column="0" Background="{DynamicResource SidebarBrush}" CornerRadius="0,0,0,12">
|
||||||
|
<DockPanel>
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<StackPanel DockPanel.Dock="Bottom" Margin="16,12">
|
||||||
|
<Button Content="{Binding AddFolderText}" Command="{Binding AddFolderCommand}"
|
||||||
|
Style="{StaticResource ModernButton}" Height="44" Margin="0,0,0,8"/>
|
||||||
|
<Button Content="{Binding AddTaskText}" Command="{Binding AddTaskCommand}"
|
||||||
|
Style="{StaticResource SecondaryButton}" Height="44" Margin="0,0,0,8"
|
||||||
|
MouseEnter="SecondaryButton_MouseEnter" MouseLeave="SecondaryButton_MouseLeave"/>
|
||||||
|
<Button Content="{Binding TestNotificationText}" Command="{Binding TestNotificationCommand}"
|
||||||
|
Style="{StaticResource SecondaryButton}" Height="44"
|
||||||
|
MouseEnter="SecondaryButton_MouseEnter" MouseLeave="SecondaryButton_MouseLeave"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Folders Section -->
|
||||||
|
<StackPanel Margin="16,20,16,10">
|
||||||
|
<TextBlock Text="{Binding FoldersText}"
|
||||||
|
Foreground="{DynamicResource SidebarSecondaryBrush}"
|
||||||
|
FontSize="11" FontWeight="SemiBold"
|
||||||
|
Margin="12,0,0,12"/>
|
||||||
|
|
||||||
|
<ScrollViewer VerticalScrollBarVisibility="Auto" MaxHeight="400">
|
||||||
|
<TreeView x:Name="FolderTree"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0"
|
||||||
|
Foreground="{DynamicResource SidebarTextBrush}"
|
||||||
|
ItemsSource="{Binding Folders}"
|
||||||
|
SelectedItemChanged="FolderTree_SelectedItemChanged"
|
||||||
|
AllowDrop="True"
|
||||||
|
Drop="TreeView_Drop"
|
||||||
|
DragOver="TreeView_DragOver"
|
||||||
|
Padding="10,0">
|
||||||
|
<TreeView.ItemContainerStyle>
|
||||||
|
<Style TargetType="TreeViewItem">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource SidebarTextBrush}"/>
|
||||||
|
<Setter Property="Padding" Value="4"/>
|
||||||
|
<Setter Property="Margin" Value="0,2"/>
|
||||||
|
<Setter Property="IsExpanded" Value="True"/>
|
||||||
|
<Setter Property="AllowDrop" Value="True"/>
|
||||||
|
<EventSetter Event="Drop" Handler="TreeViewItem_Drop"/>
|
||||||
|
<EventSetter Event="DragOver" Handler="TreeViewItem_DragOver"/>
|
||||||
|
<EventSetter Event="PreviewMouseRightButtonDown" Handler="TreeViewItem_RightClick"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="TreeViewItem">
|
||||||
|
<Border x:Name="Bd" Background="Transparent" CornerRadius="10" Padding="12,10" Margin="0,2,0,2">
|
||||||
|
<Border x:Name="SelectionBorder" CornerRadius="10" Background="Transparent" Padding="0">
|
||||||
|
<Grid>
|
||||||
|
<Border x:Name="LeftIndicator" Width="0" CornerRadius="2" Background="{DynamicResource PrimaryBrush}"
|
||||||
|
HorizontalAlignment="Left" Margin="0,4,8,4"/>
|
||||||
|
<ContentPresenter x:Name="PART_Header" ContentSource="Header"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter TargetName="SelectionBorder" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
<Setter TargetName="LeftIndicator" Property="Width" Value="0"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="SelectionBorder" Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</TreeView.ItemContainerStyle>
|
||||||
|
<TreeView.ItemTemplate>
|
||||||
|
<HierarchicalDataTemplate DataType="{x:Type models:Folder}" ItemsSource="{Binding Tasks}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="📁" FontSize="14" Margin="0,0,10,0" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="{Binding Name}" FontSize="13" FontWeight="Medium" VerticalAlignment="Center"/>
|
||||||
|
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="10"
|
||||||
|
Padding="6,2" Margin="8,0,0,0" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="{Binding Tasks.Count}" FontSize="11"
|
||||||
|
Foreground="White" FontWeight="SemiBold"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
</HierarchicalDataTemplate>
|
||||||
|
</TreeView.ItemTemplate>
|
||||||
|
<TreeView.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="{Binding AddTaskToFolderText}" Click="AddTaskToFolder_Click"/>
|
||||||
|
<MenuItem Header="{Binding RenameText}" Click="RenameFolder_Click"/>
|
||||||
|
<Separator/>
|
||||||
|
<MenuItem Header="{Binding DeleteText}" Click="DeleteFolder_Click" Foreground="{DynamicResource DangerBrush}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</TreeView.ContextMenu>
|
||||||
|
</TreeView>
|
||||||
|
</ScrollViewer>
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Main Content Area -->
|
||||||
|
<Grid Grid.Column="1" Margin="24">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- Header Section -->
|
||||||
|
<DockPanel Grid.Row="0" Margin="0,8,0,20">
|
||||||
|
<StackPanel DockPanel.Dock="Left" Orientation="Horizontal">
|
||||||
|
<Border Width="44" Height="44" CornerRadius="12" Background="{DynamicResource PrimaryBrush}"
|
||||||
|
VerticalAlignment="Center" Margin="0,0,16,0">
|
||||||
|
<TextBlock Text="📋" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<StackPanel VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="{Binding SelectedFolderName}" FontSize="22" FontWeight="Bold"
|
||||||
|
Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||||
|
<TextBlock FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,2,0,0">
|
||||||
|
<TextBlock.Text>
|
||||||
|
<MultiBinding StringFormat="{}{0} Tasks">
|
||||||
|
<Binding Path="SelectedFolderTasks.Count" FallbackValue="0"/>
|
||||||
|
</MultiBinding>
|
||||||
|
</TextBlock.Text>
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
|
||||||
|
<!-- Tasks List -->
|
||||||
|
<Border Grid.Row="1" Style="{StaticResource ModernCard}">
|
||||||
|
<Grid>
|
||||||
|
<!-- task list view -->
|
||||||
|
<Grid Visibility="{Binding SelectedFolderTasks.Count, Converter={StaticResource CountToVisibility}}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<Border Grid.Row="0" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1" Margin="8,8,8,0" Padding="26,8">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="160"/>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="" Grid.Column="0" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
||||||
|
<TextBlock Text="{Binding NameColumnText}" Grid.Column="1" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
||||||
|
<TextBlock Text="{Binding DateColumnText}" Grid.Column="2" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
||||||
|
<TextBlock Text="" Grid.Column="3" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Tasks -->
|
||||||
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||||
|
<ItemsControl ItemsSource="{Binding SelectedFolderTasks}" Margin="8,0,8,8">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border x:Name="taskBorder" CornerRadius="12" Margin="0,4" Padding="16"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||||
|
MouseLeftButtonDown="TaskItem_Click"
|
||||||
|
MouseMove="TaskItem_MouseMove"
|
||||||
|
MouseEnter="TaskItem_MouseEnter"
|
||||||
|
MouseLeave="TaskItem_MouseLeave"
|
||||||
|
Cursor="Hand"
|
||||||
|
RenderTransformOrigin="0.5,0.5"
|
||||||
|
Background="Transparent">
|
||||||
|
<Border.RenderTransform>
|
||||||
|
<ScaleTransform x:Name="taskScale" ScaleX="1" ScaleY="1"/>
|
||||||
|
</Border.RenderTransform>
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect x:Name="taskGlow" BlurRadius="0" ShadowDepth="0" Opacity="0" Color="#6366F1"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="160"/>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- Status Indicator -->
|
||||||
|
<Ellipse Grid.Column="0" Width="10" Height="10" Margin="0,0,16,0" VerticalAlignment="Center">
|
||||||
|
<Ellipse.Style>
|
||||||
|
<Style TargetType="Ellipse">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource SecondaryBrush}"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsNotified}" Value="True">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding ReminderDate, Converter={StaticResource DatePassed}}" Value="True">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource DangerBrush}"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Ellipse.Style>
|
||||||
|
</Ellipse>
|
||||||
|
|
||||||
|
<!-- Task Info -->
|
||||||
|
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding Name}" FontSize="14" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||||
|
<TextBlock Text="🔄" FontSize="12" Margin="6,0,0,0" VerticalAlignment="Center"
|
||||||
|
Visibility="{Binding IsRecurring, Converter={StaticResource BoolToVisibility}}"
|
||||||
|
ToolTip="{Binding RecurringTaskTooltipText, RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Text="{Binding Description}" FontSize="12"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
|
TextTrimming="CharacterEllipsis" MaxWidth="400" Margin="0,4,0,0"
|
||||||
|
Visibility="{Binding Description, Converter={StaticResource StringToVisibility}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Date -->
|
||||||
|
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="🕐" FontSize="12" Margin="0,0,6,0" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="{Binding ReminderDate, StringFormat='dd.MM.yyyy HH:mm'}"
|
||||||
|
FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Checkbox, Edit & Delete -->
|
||||||
|
<StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
|
||||||
|
<CheckBox IsChecked="{Binding IsNotified, Mode=TwoWay}" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||||
|
<Button Content="✏"
|
||||||
|
Command="{Binding DataContext.EditTaskCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||||
|
CommandParameter="{Binding}"
|
||||||
|
Background="Transparent" BorderThickness="0"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
|
Cursor="Hand" FontSize="12" Padding="4,0"
|
||||||
|
ToolTip="{Binding EditTaskTooltip}">
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="Opacity" Value="0.5"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Opacity" Value="1"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
<Button Content="🗑"
|
||||||
|
Command="{Binding DataContext.DeleteTaskCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||||
|
CommandParameter="{Binding}"
|
||||||
|
Background="Transparent" BorderThickness="0"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
|
Cursor="Hand" FontSize="14" Padding="4,0,0,0"
|
||||||
|
ToolTip="{Binding DeleteTaskTooltip}">
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="Opacity" Value="0.5"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Opacity" Value="1"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource DangerBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- Empty State -->
|
||||||
|
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||||
|
Visibility="{Binding SelectedFolderTasks.Count, Converter={StaticResource ZeroToVisibility}}">
|
||||||
|
<Border Width="100" Height="100" CornerRadius="50" Margin="0,0,0,24">
|
||||||
|
<Border.Background>
|
||||||
|
<RadialGradientBrush>
|
||||||
|
<GradientStop Color="#6366F1" Offset="0"/>
|
||||||
|
<GradientStop Color="#4F46E5" Offset="1"/>
|
||||||
|
</RadialGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect BlurRadius="25" ShadowDepth="0" Opacity="0.3" Color="#6366F1"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<TextBlock Text="✨" FontSize="42" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<TextBlock Text="{Binding NoTasks}"
|
||||||
|
FontSize="18" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource TextPrimaryBrush}" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Text="{Binding CreateTaskHint}"
|
||||||
|
FontSize="14" Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
|
HorizontalAlignment="Center" Margin="0,10,0,0"/>
|
||||||
|
<Button Content="{Binding AddTaskText}" Command="{Binding AddTaskCommand}"
|
||||||
|
Style="{StaticResource ModernButton}" Margin="0,20,0,0" Padding="24,12"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Theme Transition Overlay (on top) -->
|
||||||
|
<Border x:Name="ThemeTransitionOverlay" CornerRadius="12" Background="Transparent" Opacity="0" IsHitTestVisible="False"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
407
MainWindow.xaml.cs
Normal file
407
MainWindow.xaml.cs
Normal file
@@ -0,0 +1,407 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
using ReminderOrganizer.ViewModels;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer
|
||||||
|
{
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
private readonly MainViewModel _viewModel;
|
||||||
|
private System.Windows.Forms.NotifyIcon? _notifyIcon;
|
||||||
|
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
_viewModel = ServiceLocator.Services.GetService(typeof(MainViewModel)) as MainViewModel
|
||||||
|
?? throw new System.InvalidOperationException("MainViewModel not found");
|
||||||
|
DataContext = _viewModel;
|
||||||
|
|
||||||
|
_viewModel.ThemeChanged += OnThemeChanged;
|
||||||
|
_viewModel.EditTaskRequested += OnEditTaskRequested;
|
||||||
|
|
||||||
|
Loaded += MainWindow_Loaded;
|
||||||
|
StateChanged += MainWindow_StateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEditTaskRequested(object? sender, ReminderTask? task)
|
||||||
|
{
|
||||||
|
if (task == null) return;
|
||||||
|
|
||||||
|
var taskWindow = new TaskWindow(task)
|
||||||
|
{
|
||||||
|
Owner = this
|
||||||
|
};
|
||||||
|
|
||||||
|
if (taskWindow.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
_ = _viewModel.SaveAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeChanged(object? sender, bool isDarkMode)
|
||||||
|
{
|
||||||
|
ApplyTheme(isDarkMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyTheme(bool isDarkMode)
|
||||||
|
{
|
||||||
|
if (ThemeTransitionOverlay == null) return;
|
||||||
|
|
||||||
|
var overlay = ThemeTransitionOverlay;
|
||||||
|
var overlayColor = isDarkMode ? Color.FromRgb(0x12, 0x12, 0x18) : Color.FromRgb(0xF1, 0xF5, 0xF9);
|
||||||
|
|
||||||
|
if (isDarkMode)
|
||||||
|
{
|
||||||
|
Resources["SidebarBrush"] = new SolidColorBrush(Color.FromRgb(0x1A, 0x1A, 0x24));
|
||||||
|
Resources["CardBrush"] = new SolidColorBrush(Color.FromRgb(0x22, 0x22, 0x2E));
|
||||||
|
Resources["TextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0xF5, 0xF5, 0xF5));
|
||||||
|
Resources["TextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0xCC, 0xCC, 0xCC));
|
||||||
|
Resources["BorderBrush"] = new SolidColorBrush(Color.FromRgb(0x3A, 0x3A, 0x4A));
|
||||||
|
Resources["BackgroundBrush"] = new SolidColorBrush(Color.FromRgb(0x12, 0x12, 0x18));
|
||||||
|
Resources["HoverBrush"] = new SolidColorBrush(Color.FromRgb(0x2A, 0x2A, 0x3A));
|
||||||
|
Resources["SidebarTextBrush"] = new SolidColorBrush(Color.FromRgb(0xF5, 0xF5, 0xF5));
|
||||||
|
Resources["SidebarSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x99, 0x99, 0xAA));
|
||||||
|
Resources["MenuBackgroundBrush"] = new SolidColorBrush(Color.FromRgb(0x22, 0x22, 0x2E));
|
||||||
|
Resources["PrimaryLightBrush"] = new SolidColorBrush(Color.FromRgb(0x37, 0x34, 0x5F));
|
||||||
|
Resources["HeaderBrush"] = new SolidColorBrush(Color.FromRgb(0x22, 0x22, 0x2E));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Resources["SidebarBrush"] = new SolidColorBrush(Color.FromRgb(0xF8, 0xFA, 0xFC));
|
||||||
|
Resources["CardBrush"] = new SolidColorBrush(Colors.White);
|
||||||
|
Resources["TextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x1E, 0x29, 0x3B));
|
||||||
|
Resources["TextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x64, 0x74, 0x8B));
|
||||||
|
Resources["BorderBrush"] = new SolidColorBrush(Color.FromRgb(0xE2, 0xE8, 0xF0));
|
||||||
|
Resources["BackgroundBrush"] = new SolidColorBrush(Color.FromRgb(0xF1, 0xF5, 0xF9));
|
||||||
|
Resources["HoverBrush"] = new SolidColorBrush(Color.FromRgb(0xE2, 0xE8, 0xF0));
|
||||||
|
Resources["SidebarTextBrush"] = new SolidColorBrush(Color.FromRgb(0x1E, 0x29, 0x3B));
|
||||||
|
Resources["SidebarSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x64, 0x74, 0x8B));
|
||||||
|
Resources["MenuBackgroundBrush"] = new SolidColorBrush(Colors.White);
|
||||||
|
Resources["PrimaryLightBrush"] = new SolidColorBrush(Color.FromRgb(0xEE, 0xF2, 0xFF));
|
||||||
|
Resources["HeaderBrush"] = new SolidColorBrush(Colors.White);
|
||||||
|
}
|
||||||
|
|
||||||
|
overlay.Background = new SolidColorBrush(overlayColor);
|
||||||
|
var fadeIn = new DoubleAnimation(0, 0.3, TimeSpan.FromMilliseconds(100));
|
||||||
|
var fadeOut = new DoubleAnimation(0.3, 0, TimeSpan.FromMilliseconds(200));
|
||||||
|
fadeIn.Completed += (s, args) => overlay.BeginAnimation(OpacityProperty, fadeOut);
|
||||||
|
overlay.BeginAnimation(OpacityProperty, fadeIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SetupTrayIcon();
|
||||||
|
await _viewModel.InitializeAsync();
|
||||||
|
ApplyTheme(_viewModel.IsDarkMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainWindow_StateChanged(object? sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
if (WindowState == WindowState.Minimized)
|
||||||
|
{
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TitleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.ClickCount == 2)
|
||||||
|
{
|
||||||
|
MaximizeRestore();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MinimizeButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Minimized;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MaximizeButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MaximizeRestore();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MaximizeRestore()
|
||||||
|
{
|
||||||
|
if (WindowState == WindowState.Maximized)
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
MaximizeButton.Content = "□";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Maximized;
|
||||||
|
MaximizeButton.Content = "❐";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetupTrayIcon()
|
||||||
|
{
|
||||||
|
_notifyIcon = new System.Windows.Forms.NotifyIcon
|
||||||
|
{
|
||||||
|
Icon = System.Drawing.SystemIcons.Information,
|
||||||
|
Visible = true,
|
||||||
|
Text = "Reminder Organizer"
|
||||||
|
};
|
||||||
|
|
||||||
|
ReminderOrganizer.Services.NotificationService.SharedTrayIcon = _notifyIcon;
|
||||||
|
|
||||||
|
var menu = new System.Windows.Forms.ContextMenuStrip();
|
||||||
|
menu.Items.Add(_viewModel.L("Open"), null, (s, e) => ShowMainWindow());
|
||||||
|
menu.Items.Add(_viewModel.L("Exit"), null, (s, e) => {
|
||||||
|
_notifyIcon?.Dispose();
|
||||||
|
_viewModel.Cleanup();
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
});
|
||||||
|
_notifyIcon.ContextMenuStrip = menu;
|
||||||
|
_notifyIcon.DoubleClick += (s, e) => ShowMainWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowMainWindow()
|
||||||
|
{
|
||||||
|
Show();
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
Activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FolderTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||||
|
{
|
||||||
|
_viewModel.SelectedFolder = e.NewValue as Folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteFolder_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_viewModel.SelectedFolder != null)
|
||||||
|
{
|
||||||
|
_viewModel.DeleteFolderCommand.Execute(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TreeViewItem_RightClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is TreeViewItem treeViewItem && treeViewItem.DataContext is Folder folder)
|
||||||
|
{
|
||||||
|
_viewModel.SelectedFolder = folder;
|
||||||
|
treeViewItem.IsSelected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RenameFolder_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_viewModel.SelectedFolder == null) return;
|
||||||
|
|
||||||
|
var inputDialog = new InputDialog(_viewModel.L("RenameFolder"), _viewModel.L("NewName"), _viewModel.SelectedFolder.Name);
|
||||||
|
if (inputDialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
_viewModel.SelectedFolder.Name = inputDialog.ResponseText;
|
||||||
|
_viewModel.SaveFolderCommand.Execute(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTaskToFolder_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_viewModel.SelectedFolder != null)
|
||||||
|
{
|
||||||
|
_viewModel.AddTaskToFolderCommand.Execute(_viewModel.SelectedFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TaskItem_Click(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is FrameworkElement element && element.DataContext is ReminderTask task)
|
||||||
|
{
|
||||||
|
_viewModel.SelectedTask = task;
|
||||||
|
|
||||||
|
if (e.ClickCount == 2)
|
||||||
|
{
|
||||||
|
_viewModel.EditTaskCommand.Execute(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TaskItem_MouseEnter(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Border border)
|
||||||
|
{
|
||||||
|
var scaleTransform = border.RenderTransform as System.Windows.Media.ScaleTransform;
|
||||||
|
if (scaleTransform != null)
|
||||||
|
{
|
||||||
|
var scaleXAnim = new System.Windows.Media.Animation.DoubleAnimation(1, 1.02, TimeSpan.FromMilliseconds(150));
|
||||||
|
var scaleYAnim = new System.Windows.Media.Animation.DoubleAnimation(1, 1.02, TimeSpan.FromMilliseconds(150));
|
||||||
|
scaleTransform.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleXProperty, scaleXAnim);
|
||||||
|
scaleTransform.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleYProperty, scaleYAnim);
|
||||||
|
}
|
||||||
|
|
||||||
|
var effect = border.Effect as System.Windows.Media.Effects.DropShadowEffect;
|
||||||
|
if (effect != null)
|
||||||
|
{
|
||||||
|
var blurAnim = new System.Windows.Media.Animation.DoubleAnimation(15, TimeSpan.FromMilliseconds(200));
|
||||||
|
var opacityAnim = new System.Windows.Media.Animation.DoubleAnimation(0.35, TimeSpan.FromMilliseconds(200));
|
||||||
|
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.BlurRadiusProperty, blurAnim);
|
||||||
|
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.OpacityProperty, opacityAnim);
|
||||||
|
}
|
||||||
|
|
||||||
|
var hoverColor = _viewModel?.IsDarkMode == true
|
||||||
|
? Color.FromRgb(0x2A, 0x2A, 0x3A)
|
||||||
|
: Color.FromRgb(0xE2, 0xE8, 0xF0);
|
||||||
|
border.Background = new SolidColorBrush(hoverColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TaskItem_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Border border)
|
||||||
|
{
|
||||||
|
var scaleTransform = border.RenderTransform as System.Windows.Media.ScaleTransform;
|
||||||
|
if (scaleTransform != null)
|
||||||
|
{
|
||||||
|
var scaleXAnim = new System.Windows.Media.Animation.DoubleAnimation(1, TimeSpan.FromMilliseconds(150));
|
||||||
|
var scaleYAnim = new System.Windows.Media.Animation.DoubleAnimation(1, TimeSpan.FromMilliseconds(150));
|
||||||
|
scaleTransform.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleXProperty, scaleXAnim);
|
||||||
|
scaleTransform.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleYProperty, scaleYAnim);
|
||||||
|
}
|
||||||
|
|
||||||
|
var effect = border.Effect as System.Windows.Media.Effects.DropShadowEffect;
|
||||||
|
if (effect != null)
|
||||||
|
{
|
||||||
|
var blurAnim = new System.Windows.Media.Animation.DoubleAnimation(0, TimeSpan.FromMilliseconds(150));
|
||||||
|
var opacityAnim = new System.Windows.Media.Animation.DoubleAnimation(0, TimeSpan.FromMilliseconds(150));
|
||||||
|
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.BlurRadiusProperty, blurAnim);
|
||||||
|
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.OpacityProperty, opacityAnim);
|
||||||
|
}
|
||||||
|
|
||||||
|
border.Background = new SolidColorBrush(Colors.Transparent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TaskItem_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed && sender is FrameworkElement element && element.DataContext is ReminderTask task)
|
||||||
|
{
|
||||||
|
DragDrop.DoDragDrop(element, task, DragDropEffects.Move);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Info_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://discord.gg/bTx6c9GU",
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[Info_Click] Error: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color GetHoverColor()
|
||||||
|
{
|
||||||
|
return _viewModel?.IsDarkMode == true
|
||||||
|
? Color.FromRgb(0x3A, 0x3A, 0x4A)
|
||||||
|
: Color.FromRgb(0xE2, 0xE8, 0xF0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SecondaryButton_MouseEnter(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Border border)
|
||||||
|
{
|
||||||
|
var scaleTransform = border.RenderTransform as ScaleTransform;
|
||||||
|
if (scaleTransform != null)
|
||||||
|
{
|
||||||
|
var scaleXAnim = new DoubleAnimation(1, 1.03, TimeSpan.FromMilliseconds(150));
|
||||||
|
var scaleYAnim = new DoubleAnimation(1, 1.03, TimeSpan.FromMilliseconds(150));
|
||||||
|
scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleXAnim);
|
||||||
|
scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleYAnim);
|
||||||
|
}
|
||||||
|
border.Background = new SolidColorBrush(GetHoverColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SecondaryButton_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Border border)
|
||||||
|
{
|
||||||
|
var scaleTransform = border.RenderTransform as ScaleTransform;
|
||||||
|
if (scaleTransform != null)
|
||||||
|
{
|
||||||
|
var scaleXAnim = new DoubleAnimation(1, TimeSpan.FromMilliseconds(150));
|
||||||
|
var scaleYAnim = new DoubleAnimation(1, TimeSpan.FromMilliseconds(150));
|
||||||
|
scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleXAnim);
|
||||||
|
scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleYAnim);
|
||||||
|
}
|
||||||
|
border.Background = new SolidColorBrush(Colors.Transparent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TreeView_DragOver(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(ReminderTask)))
|
||||||
|
{
|
||||||
|
e.Effects = DragDropEffects.Move;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effects = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TreeView_Drop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(ReminderTask)))
|
||||||
|
{
|
||||||
|
var task = e.Data.GetData(typeof(ReminderTask)) as ReminderTask;
|
||||||
|
if (task != null && FolderTree.SelectedItem is Folder targetFolder)
|
||||||
|
{
|
||||||
|
_viewModel.MoveTaskToFolderCommand.Execute((task, targetFolder));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TreeViewItem_DragOver(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(ReminderTask)))
|
||||||
|
{
|
||||||
|
e.Effects = DragDropEffects.Move;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effects = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TreeViewItem_Drop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(ReminderTask)))
|
||||||
|
{
|
||||||
|
var task = e.Data.GetData(typeof(ReminderTask)) as ReminderTask;
|
||||||
|
if (task != null && sender is TreeViewItem treeViewItem && treeViewItem.DataContext is Folder targetFolder)
|
||||||
|
{
|
||||||
|
_viewModel.MoveTaskToFolderCommand.Execute((task, targetFolder));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
133
Models/ReminderModels.cs
Normal file
133
Models/ReminderModels.cs
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using ReminderOrganizer.Core;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Models
|
||||||
|
{
|
||||||
|
public class ReminderTask : ViewModelBase
|
||||||
|
{
|
||||||
|
private string _id = Guid.NewGuid().ToString();
|
||||||
|
private string _name = "New Task";
|
||||||
|
private string _description = "";
|
||||||
|
private DateTime _reminderDate = DateTime.Now.AddHours(1);
|
||||||
|
private bool _isNotified = false;
|
||||||
|
private bool _isRecurring = false;
|
||||||
|
private RecurrenceType _recurrenceType = RecurrenceType.Yearly;
|
||||||
|
|
||||||
|
public string Id
|
||||||
|
{
|
||||||
|
get => _id;
|
||||||
|
set => SetProperty(ref _id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => _name;
|
||||||
|
set => SetProperty(ref _name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get => _description;
|
||||||
|
set => SetProperty(ref _description, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime ReminderDate
|
||||||
|
{
|
||||||
|
get => _reminderDate;
|
||||||
|
set => SetProperty(ref _reminderDate, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsNotified
|
||||||
|
{
|
||||||
|
get => _isNotified;
|
||||||
|
set => SetProperty(ref _isNotified, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsRecurring
|
||||||
|
{
|
||||||
|
get => _isRecurring;
|
||||||
|
set => SetProperty(ref _isRecurring, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RecurrenceType RecurrenceType
|
||||||
|
{
|
||||||
|
get => _recurrenceType;
|
||||||
|
set => SetProperty(ref _recurrenceType, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime GetNextOccurrence()
|
||||||
|
{
|
||||||
|
var next = ReminderDate;
|
||||||
|
while (next <= DateTime.Now)
|
||||||
|
{
|
||||||
|
next = RecurrenceType switch
|
||||||
|
{
|
||||||
|
RecurrenceType.Daily => next.AddDays(1),
|
||||||
|
RecurrenceType.Weekly => next.AddDays(7),
|
||||||
|
RecurrenceType.Monthly => next.AddMonths(1),
|
||||||
|
RecurrenceType.Yearly => next.AddYears(1),
|
||||||
|
_ => next.AddYears(1)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReminderTask() { }
|
||||||
|
|
||||||
|
public ReminderTask(string name, string description, DateTime reminderDate)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Description = description;
|
||||||
|
ReminderDate = reminderDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum RecurrenceType
|
||||||
|
{
|
||||||
|
Daily,
|
||||||
|
Weekly,
|
||||||
|
Monthly,
|
||||||
|
Yearly
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Folder : ViewModelBase
|
||||||
|
{
|
||||||
|
private string _id = Guid.NewGuid().ToString();
|
||||||
|
private string _name = "New Folder";
|
||||||
|
private ObservableCollection<ReminderTask> _tasks = new();
|
||||||
|
|
||||||
|
public string Id
|
||||||
|
{
|
||||||
|
get => _id;
|
||||||
|
set => SetProperty(ref _id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => _name;
|
||||||
|
set => SetProperty(ref _name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<ReminderTask> Tasks
|
||||||
|
{
|
||||||
|
get => _tasks;
|
||||||
|
set => SetProperty(ref _tasks, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Folder() { }
|
||||||
|
|
||||||
|
public Folder(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AppData
|
||||||
|
{
|
||||||
|
public ObservableCollection<Folder> Folders { get; set; } = new();
|
||||||
|
public string Language { get; set; } = "en";
|
||||||
|
public bool IsDarkMode { get; set; } = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
ReminderOrganizer.csproj
Normal file
26
ReminderOrganizer.csproj
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
|
<AssemblyName>ReminderOrganizer</AssemblyName>
|
||||||
|
<RootNamespace>ReminderOrganizer</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Locales\*.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="tasks.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
24
ReminderOrganizer.sln
Normal file
24
ReminderOrganizer.sln
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.5.2.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReminderOrganizer", "ReminderOrganizer.csproj", "{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {195DE7BA-8C52-4E36-B943-B093B9614618}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
30
ServiceLocator.cs
Normal file
30
ServiceLocator.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
using ReminderOrganizer.ViewModels;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer
|
||||||
|
{
|
||||||
|
public static class ServiceLocator
|
||||||
|
{
|
||||||
|
private static IServiceProvider? _serviceProvider;
|
||||||
|
|
||||||
|
public static IServiceProvider Services => _serviceProvider
|
||||||
|
?? throw new InvalidOperationException("ServiceLocator not initialized");
|
||||||
|
|
||||||
|
public static void Initialize()
|
||||||
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddSingleton<IDataService, DataService>();
|
||||||
|
services.AddSingleton<INotificationService, NotificationService>();
|
||||||
|
services.AddSingleton<IAutostartService, AutostartService>();
|
||||||
|
services.AddSingleton<ILocalizationService>(sp =>
|
||||||
|
new LocalizationService(sp.GetRequiredService<IDataService>()));
|
||||||
|
services.AddTransient<MainViewModel>();
|
||||||
|
|
||||||
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
55
Services/AutostartService.cs
Normal file
55
Services/AutostartService.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Services
|
||||||
|
{
|
||||||
|
public class AutostartService : IAutostartService
|
||||||
|
{
|
||||||
|
private const string RegistryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
|
||||||
|
private const string AppName = "ReminderOrganizer";
|
||||||
|
|
||||||
|
public bool IsAutostartEnabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var key = Registry.CurrentUser.OpenSubKey(RegistryKey, false);
|
||||||
|
var path = key?.GetValue(AppName) as string;
|
||||||
|
return path == Environment.ProcessPath;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ToggleAutostart()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var key = Registry.CurrentUser.OpenSubKey(RegistryKey, true);
|
||||||
|
if (key == null) return;
|
||||||
|
|
||||||
|
if (IsAutostartEnabled)
|
||||||
|
{
|
||||||
|
key.DeleteValue(AppName, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var path = Environment.ProcessPath;
|
||||||
|
if (!string.IsNullOrEmpty(path))
|
||||||
|
{
|
||||||
|
key.SetValue(AppName, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[AutostartService] Failed: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
57
Services/DataService.cs
Normal file
57
Services/DataService.cs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Services
|
||||||
|
{
|
||||||
|
public class DataService : IDataService
|
||||||
|
{
|
||||||
|
private static readonly JsonSerializerOptions _jsonOptions = new()
|
||||||
|
{
|
||||||
|
WriteIndented = true,
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
|
public string DataFilePath { get; }
|
||||||
|
|
||||||
|
public DataService()
|
||||||
|
{
|
||||||
|
DataFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "tasks.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AppData> LoadAsync()
|
||||||
|
{
|
||||||
|
if (!File.Exists(DataFilePath))
|
||||||
|
return new AppData();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var json = await File.ReadAllTextAsync(DataFilePath);
|
||||||
|
var data = JsonSerializer.Deserialize<AppData>(json, _jsonOptions);
|
||||||
|
return data ?? new AppData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[DataService] Load failed: {ex.Message}");
|
||||||
|
return new AppData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SaveAsync(AppData data)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var json = JsonSerializer.Serialize(data, _jsonOptions);
|
||||||
|
await File.WriteAllTextAsync(DataFilePath, json);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[DataService] Save failed: {ex.Message}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Services/Interfaces.cs
Normal file
36
Services/Interfaces.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Services
|
||||||
|
{
|
||||||
|
public interface IDataService
|
||||||
|
{
|
||||||
|
Task<AppData> LoadAsync();
|
||||||
|
Task SaveAsync(AppData data);
|
||||||
|
string DataFilePath { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface INotificationService
|
||||||
|
{
|
||||||
|
void ShowNotification(string title, string message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ILocalizationService
|
||||||
|
{
|
||||||
|
string GetString(string key);
|
||||||
|
void SetLanguage(string languageCode);
|
||||||
|
string CurrentLanguage { get; }
|
||||||
|
event EventHandler? LanguageChanged;
|
||||||
|
event EventHandler? StringsChanged;
|
||||||
|
void Initialize(AppData appData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IAutostartService
|
||||||
|
{
|
||||||
|
bool IsAutostartEnabled { get; }
|
||||||
|
void ToggleAutostart();
|
||||||
|
}
|
||||||
|
}
|
||||||
136
Services/LocalizationService.cs
Normal file
136
Services/LocalizationService.cs
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text.Json;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Services
|
||||||
|
{
|
||||||
|
public class LocalizationService : ILocalizationService
|
||||||
|
{
|
||||||
|
private Dictionary<string, string> _strings = new();
|
||||||
|
private string _currentLanguage = "en";
|
||||||
|
private AppData? _appData;
|
||||||
|
private readonly IDataService _dataService;
|
||||||
|
|
||||||
|
public string CurrentLanguage => _currentLanguage;
|
||||||
|
public event EventHandler? LanguageChanged;
|
||||||
|
public event EventHandler? StringsChanged;
|
||||||
|
|
||||||
|
public LocalizationService(IDataService dataService)
|
||||||
|
{
|
||||||
|
_dataService = dataService;
|
||||||
|
LoadLanguage(_currentLanguage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLanguage(string languageCode)
|
||||||
|
{
|
||||||
|
if (_currentLanguage == languageCode) return;
|
||||||
|
_currentLanguage = languageCode;
|
||||||
|
LoadLanguage(languageCode);
|
||||||
|
if (_appData != null)
|
||||||
|
{
|
||||||
|
_appData.Language = languageCode;
|
||||||
|
_ = _dataService.SaveAsync(_appData);
|
||||||
|
}
|
||||||
|
LanguageChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
StringsChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize(AppData appData)
|
||||||
|
{
|
||||||
|
_appData = appData;
|
||||||
|
if (!string.IsNullOrEmpty(appData.Language))
|
||||||
|
{
|
||||||
|
SetLanguage(appData.Language);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetString(string key)
|
||||||
|
{
|
||||||
|
return _strings.TryGetValue(key, out var value) ? value : key;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadLanguage(string languageCode)
|
||||||
|
{
|
||||||
|
var basePath = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
var filePath = Path.Combine(basePath, "Locales", $"{languageCode}.json");
|
||||||
|
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var json = File.ReadAllText(filePath);
|
||||||
|
_strings = JsonSerializer.Deserialize<Dictionary<string, string>>(json) ?? new();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
_strings = GetDefaultStrings(languageCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Dictionary<string, string> GetDefaultStrings(string lang)
|
||||||
|
{
|
||||||
|
return lang switch
|
||||||
|
{
|
||||||
|
"en" => new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
["AppTitle"] = "Reminder Organizer",
|
||||||
|
["File"] = "File",
|
||||||
|
["Exit"] = "Exit",
|
||||||
|
["Settings"] = "Settings",
|
||||||
|
["Language"] = "Language",
|
||||||
|
["German"] = "German",
|
||||||
|
["English"] = "English",
|
||||||
|
["AddFolder"] = "+ Folder",
|
||||||
|
["AddTask"] = "+ Task",
|
||||||
|
["Welcome"] = "Welcome",
|
||||||
|
["NoFolderSelected"] = "No folder selected",
|
||||||
|
["Name"] = "Name",
|
||||||
|
["Description"] = "Description",
|
||||||
|
["Date"] = "Date",
|
||||||
|
["Save"] = "Save",
|
||||||
|
["Cancel"] = "Cancel",
|
||||||
|
["OK"] = "OK",
|
||||||
|
["SelectFolder"] = "Please select a folder first",
|
||||||
|
["AutostartEnabled"] = "Autostart enabled",
|
||||||
|
["AutostartDisabled"] = "Autostart disabled",
|
||||||
|
["SaveError"] = "Error saving data",
|
||||||
|
["Open"] = "Open",
|
||||||
|
["Delete"] = "Delete",
|
||||||
|
["Rename"] = "Rename"
|
||||||
|
},
|
||||||
|
_ => new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
["AppTitle"] = "Reminder Organizer",
|
||||||
|
["File"] = "Datei",
|
||||||
|
["Exit"] = "Beenden",
|
||||||
|
["Settings"] = "Einstellungen",
|
||||||
|
["Language"] = "Sprache",
|
||||||
|
["German"] = "Deutsch",
|
||||||
|
["English"] = "Englisch",
|
||||||
|
["AddFolder"] = "+ Ordner",
|
||||||
|
["AddTask"] = "+ Task",
|
||||||
|
["Welcome"] = "Willkommen",
|
||||||
|
["NoFolderSelected"] = "Kein Ordner ausgewählt",
|
||||||
|
["Name"] = "Name",
|
||||||
|
["Description"] = "Beschreibung",
|
||||||
|
["Date"] = "Datum",
|
||||||
|
["Save"] = "Speichern",
|
||||||
|
["Cancel"] = "Abbrechen",
|
||||||
|
["OK"] = "OK",
|
||||||
|
["SelectFolder"] = "Bitte erst einen Ordner auswählen",
|
||||||
|
["AutostartEnabled"] = "Autostart aktiviert",
|
||||||
|
["AutostartDisabled"] = "Autostart deaktiviert",
|
||||||
|
["SaveError"] = "Fehler beim Speichern",
|
||||||
|
["Open"] = "Öffnen",
|
||||||
|
["Delete"] = "Löschen",
|
||||||
|
["Rename"] = "Umbenennen"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
Services/NotificationService.cs
Normal file
50
Services/NotificationService.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Services
|
||||||
|
{
|
||||||
|
public class NotificationService : INotificationService
|
||||||
|
{
|
||||||
|
private readonly object _lock = new();
|
||||||
|
|
||||||
|
public static NotifyIcon? SharedTrayIcon { get; set; }
|
||||||
|
|
||||||
|
public void ShowNotification(string title, string message)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[NotificationService] ShowNotification: {title} - {message}");
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[NotificationService] SharedTrayIcon is null: {SharedTrayIcon == null}");
|
||||||
|
ShowBalloonTip(title, message);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[NotificationService] Error: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowBalloonTip(string title, string message)
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
if (SharedTrayIcon != null)
|
||||||
|
{
|
||||||
|
SharedTrayIcon.BalloonTipTitle = title;
|
||||||
|
SharedTrayIcon.BalloonTipText = message;
|
||||||
|
SharedTrayIcon.BalloonTipIcon = ToolTipIcon.Info;
|
||||||
|
SharedTrayIcon.ShowBalloonTip(5000);
|
||||||
|
System.Diagnostics.Debug.WriteLine("[NotificationService] BalloonTip shown!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine("[NotificationService] SharedTrayIcon is null, cannot show balloon tip!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
118
TaskWindow.xaml
Normal file
118
TaskWindow.xaml
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<Window x:Class="ReminderOrganizer.TaskWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:models="clr-namespace:ReminderOrganizer.Models"
|
||||||
|
Title="{Binding WindowTitle}"
|
||||||
|
Height="420" Width="420"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
ShowInTaskbar="False"
|
||||||
|
WindowStyle="None"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Transparent"
|
||||||
|
MouseLeftButtonDown="Window_MouseLeftButtonDown">
|
||||||
|
<Window.Resources>
|
||||||
|
<SolidColorBrush x:Key="PrimaryBrush" Color="#6366F1"/>
|
||||||
|
<SolidColorBrush x:Key="PrimaryHoverBrush" Color="#4F46E5"/>
|
||||||
|
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#1E293B"/>
|
||||||
|
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#64748B"/>
|
||||||
|
<SolidColorBrush x:Key="BorderBrush" Color="#CBD5E1"/>
|
||||||
|
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
|
||||||
|
<SolidColorBrush x:Key="InputBackgroundBrush" Color="#F1F5F9"/>
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Border CornerRadius="12" Background="{DynamicResource CardBrush}" Margin="8">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect BlurRadius="20" ShadowDepth="5" Opacity="0.2" Direction="270" Color="Black"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<Border Grid.Row="0" Background="{DynamicResource PrimaryBrush}" CornerRadius="12,12,0,0" Padding="16,12">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="📋" FontSize="16" Foreground="White" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="{Binding WindowTitle}" FontSize="14" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="8,0,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
<Button Content="✕" HorizontalAlignment="Right" Foreground="White" Background="Transparent" BorderThickness="0"
|
||||||
|
Width="28" Height="28" Cursor="Hand" Command="{Binding CancelCommand}"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<StackPanel Grid.Row="1" Margin="16">
|
||||||
|
<TextBlock Text="{Binding NameLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,0,0,4"/>
|
||||||
|
<TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource InputBackgroundBrush}"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="10,8" FontSize="13"/>
|
||||||
|
|
||||||
|
<Grid Margin="0,12,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding DateLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,0,0,4"/>
|
||||||
|
|
||||||
|
<DatePicker Grid.Row="1" Grid.Column="0" SelectedDate="{Binding ReminderDate, Mode=TwoWay}" Height="32"/>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Margin="8,0,0,0">
|
||||||
|
<ComboBox Width="50" Height="32" SelectedIndex="{Binding SelectedHourIndex}">
|
||||||
|
<ComboBoxItem Content="00"/><ComboBoxItem Content="01"/><ComboBoxItem Content="02"/>
|
||||||
|
<ComboBoxItem Content="03"/><ComboBoxItem Content="04"/><ComboBoxItem Content="05"/>
|
||||||
|
<ComboBoxItem Content="06"/><ComboBoxItem Content="07"/><ComboBoxItem Content="08"/>
|
||||||
|
<ComboBoxItem Content="09"/><ComboBoxItem Content="10"/><ComboBoxItem Content="11"/>
|
||||||
|
<ComboBoxItem Content="12"/><ComboBoxItem Content="13"/><ComboBoxItem Content="14"/>
|
||||||
|
<ComboBoxItem Content="15"/><ComboBoxItem Content="16"/><ComboBoxItem Content="17"/>
|
||||||
|
<ComboBoxItem Content="18"/><ComboBoxItem Content="19"/><ComboBoxItem Content="20"/>
|
||||||
|
<ComboBoxItem Content="21"/><ComboBoxItem Content="22"/><ComboBoxItem Content="23"/>
|
||||||
|
</ComboBox>
|
||||||
|
<TextBlock Text=":" VerticalAlignment="Center" Margin="2,0" FontSize="14"/>
|
||||||
|
<ComboBox Width="50" Height="32" SelectedIndex="{Binding SelectedMinuteIndex}">
|
||||||
|
<ComboBoxItem Content="00"/><ComboBoxItem Content="05"/>
|
||||||
|
<ComboBoxItem Content="10"/><ComboBoxItem Content="15"/>
|
||||||
|
<ComboBoxItem Content="20"/><ComboBoxItem Content="25"/>
|
||||||
|
<ComboBoxItem Content="30"/><ComboBoxItem Content="35"/>
|
||||||
|
<ComboBoxItem Content="40"/><ComboBoxItem Content="45"/>
|
||||||
|
<ComboBoxItem Content="50"/><ComboBoxItem Content="55"/>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,12,0,0">
|
||||||
|
<CheckBox IsChecked="{Binding IsRecurring, Mode=TwoWay}" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="🔄" FontSize="12" Margin="4,0,0,0" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="{Binding RecurringLabel}" FontSize="12" Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center" Margin="4,0,0,0"/>
|
||||||
|
<ComboBox Margin="8,0,0,0" Width="90" Height="28" SelectedIndex="{Binding SelectedRecurrenceIndex}" IsEnabled="{Binding IsRecurring}">
|
||||||
|
<ComboBoxItem Content="{Binding DailyText}"/>
|
||||||
|
<ComboBoxItem Content="{Binding WeeklyText}"/>
|
||||||
|
<ComboBoxItem Content="{Binding MonthlyText}"/>
|
||||||
|
<ComboBoxItem Content="{Binding YearlyText}"/>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding DescriptionLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,12,0,4"/>
|
||||||
|
<TextBox Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource InputBackgroundBrush}"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="10,6" FontSize="12" Height="40"
|
||||||
|
TextWrapping="Wrap" AcceptsReturn="True"/>
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding ErrorMessage}" Foreground="#EF4444" FontSize="11" Margin="0,8,0,0"
|
||||||
|
Visibility="{Binding HasError, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
|
||||||
|
<Button Content="{Binding CancelText}" Background="Transparent" Foreground="{DynamicResource TextPrimaryBrush}"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="16,8" Cursor="Hand" Command="{Binding CancelCommand}"/>
|
||||||
|
<Button Content="{Binding SaveText}" Background="#6366F1" Foreground="White"
|
||||||
|
BorderThickness="0" Padding="16,8" Margin="8,0,0,0" Cursor="Hand" Command="{Binding SaveCommand}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Window>
|
||||||
53
TaskWindow.xaml.cs
Normal file
53
TaskWindow.xaml.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
using ReminderOrganizer.ViewModels;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer
|
||||||
|
{
|
||||||
|
public partial class TaskWindow : Window
|
||||||
|
{
|
||||||
|
private readonly TaskViewModel _viewModel;
|
||||||
|
|
||||||
|
public ReminderTask TaskResult => _viewModel.TaskResult;
|
||||||
|
|
||||||
|
public TaskWindow() : this(null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskWindow(ReminderTask? existingTask)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
var localizationService = ServiceLocator.Services.GetService(typeof(ILocalizationService)) as ILocalizationService;
|
||||||
|
|
||||||
|
if (localizationService == null)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine("[TaskWindow] LocalizationService is null!");
|
||||||
|
localizationService = new LocalizationService(ServiceLocator.Services.GetService(typeof(IDataService)) as IDataService
|
||||||
|
?? throw new InvalidOperationException("DataService not found"));
|
||||||
|
}
|
||||||
|
|
||||||
|
_viewModel = new TaskViewModel(localizationService, existingTask);
|
||||||
|
_viewModel.RequestClose += OnRequestClose;
|
||||||
|
|
||||||
|
DataContext = _viewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnRequestClose(object? sender, bool result)
|
||||||
|
{
|
||||||
|
DialogResult = result;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
ViewModels/LocalizedStrings.cs
Normal file
19
ViewModels/LocalizedStrings.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Windows;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.ViewModels
|
||||||
|
{
|
||||||
|
public class LocalizedStrings
|
||||||
|
{
|
||||||
|
private readonly ILocalizationService _localizationService;
|
||||||
|
|
||||||
|
public LocalizedStrings()
|
||||||
|
{
|
||||||
|
_localizationService = ServiceLocator.Services.GetService(typeof(ILocalizationService)) as ILocalizationService
|
||||||
|
?? throw new System.InvalidOperationException("LocalizationService not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string this[string key] => _localizationService.GetString(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
532
ViewModels/MainViewModel.cs
Normal file
532
ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,532 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using ReminderOrganizer.Core;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.ViewModels
|
||||||
|
{
|
||||||
|
public class MainViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private readonly IDataService _dataService;
|
||||||
|
private readonly INotificationService _notificationService;
|
||||||
|
private readonly ILocalizationService _localizationService;
|
||||||
|
private readonly IAutostartService _autostartService;
|
||||||
|
private readonly DispatcherTimer _reminderTimer;
|
||||||
|
|
||||||
|
private AppData _appData = new();
|
||||||
|
private Folder? _selectedFolder;
|
||||||
|
private ReminderTask? _selectedTask;
|
||||||
|
private bool _isLoading;
|
||||||
|
|
||||||
|
public bool IsLoading
|
||||||
|
{
|
||||||
|
get => _isLoading;
|
||||||
|
set => SetProperty(ref _isLoading, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<Folder> Folders => _appData.Folders;
|
||||||
|
|
||||||
|
public Folder? SelectedFolder
|
||||||
|
{
|
||||||
|
get => _selectedFolder;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (SetProperty(ref _selectedFolder, value))
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(SelectedFolderTasks));
|
||||||
|
OnPropertyChanged(nameof(SelectedFolderName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReminderTask? SelectedTask
|
||||||
|
{
|
||||||
|
get => _selectedTask;
|
||||||
|
set => SetProperty(ref _selectedTask, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<ReminderTask>? SelectedFolderTasks => SelectedFolder?.Tasks;
|
||||||
|
|
||||||
|
public string SelectedFolderName => SelectedFolder?.Name ?? L("Welcome");
|
||||||
|
|
||||||
|
public string AddFolderText => L("AddFolder");
|
||||||
|
public string AddTaskText => L("AddTask");
|
||||||
|
public string AutostartText => L("Autostart");
|
||||||
|
public string ExitText => L("Exit");
|
||||||
|
public string FileText => L("File");
|
||||||
|
public string SettingsText => L("Settings");
|
||||||
|
public string LanguageText => L("Language");
|
||||||
|
public string GermanText => L("German");
|
||||||
|
public string EnglishText => L("English");
|
||||||
|
public string DeleteText => L("Delete");
|
||||||
|
public string RenameText => L("Rename");
|
||||||
|
public string ViewText => L("View");
|
||||||
|
public string DarkModeText => L("DarkMode");
|
||||||
|
public string LightModeText => L("LightMode");
|
||||||
|
public string AddTaskToFolderText => L("AddTaskToFolder");
|
||||||
|
public string MinimizeTooltip => L("Minimize");
|
||||||
|
public string MaximizeTooltip => L("Maximize");
|
||||||
|
public string CloseTooltip => L("Close");
|
||||||
|
public string CreateTaskHint => L("CreateTaskHint");
|
||||||
|
public string NoTasks => L("NoTasks");
|
||||||
|
public string FoldersText => L("Folders");
|
||||||
|
public string NameColumnText => L("Name");
|
||||||
|
public string DateColumnText => L("Date");
|
||||||
|
public string EditTaskTooltip => L("EditTaskTooltip");
|
||||||
|
public string DeleteTaskTooltip => L("DeleteTaskTooltip");
|
||||||
|
public string InfoText => L("Info");
|
||||||
|
public string DiscordText => L("Discord");
|
||||||
|
public string ImportText => L("Import");
|
||||||
|
public string ExportText => L("Export");
|
||||||
|
public string ImportCsvText => L("ImportCsv");
|
||||||
|
public string ExportCsvText => L("ExportCsv");
|
||||||
|
public string TestNotificationText => L("TestNotification");
|
||||||
|
public string AppTitleText => L("AppTitle");
|
||||||
|
public string RecurringTaskTooltipText => L("RecurringTaskTooltip");
|
||||||
|
|
||||||
|
public bool IsGerman => _localizationService.CurrentLanguage == "de";
|
||||||
|
public bool IsEnglish => _localizationService.CurrentLanguage == "en";
|
||||||
|
|
||||||
|
private bool _isDarkMode = true;
|
||||||
|
public bool IsDarkMode
|
||||||
|
{
|
||||||
|
get => _isDarkMode;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (SetProperty(ref _isDarkMode, value))
|
||||||
|
{
|
||||||
|
ThemeChanged?.Invoke(this, value);
|
||||||
|
if (_appData != null)
|
||||||
|
{
|
||||||
|
_appData.IsDarkMode = value;
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<bool>? ThemeChanged;
|
||||||
|
|
||||||
|
public ICommand AddFolderCommand { get; }
|
||||||
|
public ICommand AddTaskCommand { get; }
|
||||||
|
public ICommand AddTaskToFolderCommand { get; }
|
||||||
|
public ICommand DeleteTaskCommand { get; }
|
||||||
|
public ICommand EditTaskCommand { get; }
|
||||||
|
public ICommand ToggleAutostartCommand { get; }
|
||||||
|
public ICommand ExitCommand { get; }
|
||||||
|
public ICommand DeleteFolderCommand { get; }
|
||||||
|
public ICommand SaveFolderCommand { get; }
|
||||||
|
public ICommand SetLanguageDeCommand { get; }
|
||||||
|
public ICommand SetLanguageEnCommand { get; }
|
||||||
|
public ICommand ToggleDarkModeCommand { get; }
|
||||||
|
public ICommand MoveTaskToFolderCommand { get; }
|
||||||
|
public ICommand TestNotificationCommand { get; }
|
||||||
|
public ICommand ImportCsvCommand { get; }
|
||||||
|
public ICommand ExportCsvCommand { get; }
|
||||||
|
|
||||||
|
public event EventHandler<ReminderTask?>? EditTaskRequested;
|
||||||
|
|
||||||
|
public MainViewModel(
|
||||||
|
IDataService dataService,
|
||||||
|
INotificationService notificationService,
|
||||||
|
ILocalizationService localizationService,
|
||||||
|
IAutostartService autostartService)
|
||||||
|
{
|
||||||
|
_dataService = dataService;
|
||||||
|
_notificationService = notificationService;
|
||||||
|
_localizationService = localizationService;
|
||||||
|
_autostartService = autostartService;
|
||||||
|
|
||||||
|
_localizationService.StringsChanged += (s, e) => RefreshStrings();
|
||||||
|
|
||||||
|
AddFolderCommand = new RelayCommand(AddFolder);
|
||||||
|
AddTaskCommand = new RelayCommand(AddTask, () => SelectedFolder != null);
|
||||||
|
AddTaskToFolderCommand = new RelayCommand<Folder>(AddTaskToFolder);
|
||||||
|
DeleteTaskCommand = new RelayCommand<ReminderTask>(DeleteTask);
|
||||||
|
EditTaskCommand = new RelayCommand<ReminderTask>(EditTask);
|
||||||
|
DeleteFolderCommand = new RelayCommand(DeleteFolder, () => SelectedFolder != null);
|
||||||
|
SaveFolderCommand = new RelayCommand(async () => await SaveAsync());
|
||||||
|
ToggleAutostartCommand = new RelayCommand(ToggleAutostart);
|
||||||
|
SetLanguageDeCommand = new RelayCommand(() => SetLanguage("de"));
|
||||||
|
SetLanguageEnCommand = new RelayCommand(() => SetLanguage("en"));
|
||||||
|
ToggleDarkModeCommand = new RelayCommand(() => IsDarkMode = !IsDarkMode);
|
||||||
|
ExitCommand = new RelayCommand(() => Application.Current.Shutdown());
|
||||||
|
MoveTaskToFolderCommand = new RelayCommand<(ReminderTask, Folder)>(MoveTaskToFolder);
|
||||||
|
TestNotificationCommand = new RelayCommand(TestNotification);
|
||||||
|
ImportCsvCommand = new RelayCommand(ImportCsv);
|
||||||
|
ExportCsvCommand = new RelayCommand(ExportCsv);
|
||||||
|
|
||||||
|
_reminderTimer = new DispatcherTimer
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromSeconds(30)
|
||||||
|
};
|
||||||
|
_reminderTimer.Tick += (s, e) => CheckReminders();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetLanguage(string lang)
|
||||||
|
{
|
||||||
|
_localizationService.SetLanguage(lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshStrings()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(AddFolderText));
|
||||||
|
OnPropertyChanged(nameof(AddTaskText));
|
||||||
|
OnPropertyChanged(nameof(AutostartText));
|
||||||
|
OnPropertyChanged(nameof(ExitText));
|
||||||
|
OnPropertyChanged(nameof(FileText));
|
||||||
|
OnPropertyChanged(nameof(SettingsText));
|
||||||
|
OnPropertyChanged(nameof(LanguageText));
|
||||||
|
OnPropertyChanged(nameof(GermanText));
|
||||||
|
OnPropertyChanged(nameof(EnglishText));
|
||||||
|
OnPropertyChanged(nameof(DeleteText));
|
||||||
|
OnPropertyChanged(nameof(RenameText));
|
||||||
|
OnPropertyChanged(nameof(ViewText));
|
||||||
|
OnPropertyChanged(nameof(DarkModeText));
|
||||||
|
OnPropertyChanged(nameof(LightModeText));
|
||||||
|
OnPropertyChanged(nameof(AddTaskToFolderText));
|
||||||
|
OnPropertyChanged(nameof(SelectedFolderName));
|
||||||
|
OnPropertyChanged(nameof(IsGerman));
|
||||||
|
OnPropertyChanged(nameof(IsEnglish));
|
||||||
|
OnPropertyChanged(nameof(MinimizeTooltip));
|
||||||
|
OnPropertyChanged(nameof(MaximizeTooltip));
|
||||||
|
OnPropertyChanged(nameof(CloseTooltip));
|
||||||
|
OnPropertyChanged(nameof(CreateTaskHint));
|
||||||
|
OnPropertyChanged(nameof(NoTasks));
|
||||||
|
OnPropertyChanged(nameof(FoldersText));
|
||||||
|
OnPropertyChanged(nameof(NameColumnText));
|
||||||
|
OnPropertyChanged(nameof(DateColumnText));
|
||||||
|
OnPropertyChanged(nameof(EditTaskTooltip));
|
||||||
|
OnPropertyChanged(nameof(DeleteTaskTooltip));
|
||||||
|
OnPropertyChanged(nameof(InfoText));
|
||||||
|
OnPropertyChanged(nameof(DiscordText));
|
||||||
|
OnPropertyChanged(nameof(ImportText));
|
||||||
|
OnPropertyChanged(nameof(ExportText));
|
||||||
|
OnPropertyChanged(nameof(ImportCsvText));
|
||||||
|
OnPropertyChanged(nameof(ExportCsvText));
|
||||||
|
OnPropertyChanged(nameof(TestNotificationText));
|
||||||
|
OnPropertyChanged(nameof(AppTitleText));
|
||||||
|
OnPropertyChanged(nameof(RecurringTaskTooltipText));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task InitializeAsync()
|
||||||
|
{
|
||||||
|
IsLoading = true;
|
||||||
|
_appData = await _dataService.LoadAsync();
|
||||||
|
_localizationService.Initialize(_appData);
|
||||||
|
|
||||||
|
if (_appData.Folders.Count == 0)
|
||||||
|
{
|
||||||
|
_appData.Folders.Add(new Folder(L("MyTasks")));
|
||||||
|
await SaveAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
_isDarkMode = _appData.IsDarkMode;
|
||||||
|
OnPropertyChanged(nameof(IsDarkMode));
|
||||||
|
OnPropertyChanged(nameof(Folders));
|
||||||
|
_reminderTimer.Start();
|
||||||
|
IsLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string L(string key) => _localizationService.GetString(key);
|
||||||
|
|
||||||
|
private void AddFolder()
|
||||||
|
{
|
||||||
|
var folder = new Folder(L("AddFolder").Replace("+ ", ""));
|
||||||
|
_appData.Folders.Add(folder);
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteFolder()
|
||||||
|
{
|
||||||
|
if (SelectedFolder == null) return;
|
||||||
|
|
||||||
|
_appData.Folders.Remove(SelectedFolder);
|
||||||
|
SelectedFolder = _appData.Folders.FirstOrDefault();
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTask()
|
||||||
|
{
|
||||||
|
AddTaskInternal(SelectedFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTaskToFolder(Folder? folder)
|
||||||
|
{
|
||||||
|
AddTaskInternal(folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTaskInternal(Folder? folder)
|
||||||
|
{
|
||||||
|
if (folder == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Kein Ordner ausgewählt! Bitte wähle erst einen Ordner aus.", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var mainWindow = Application.Current.MainWindow;
|
||||||
|
var taskWindow = new TaskWindow();
|
||||||
|
|
||||||
|
if (mainWindow != null)
|
||||||
|
{
|
||||||
|
taskWindow.Owner = mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taskWindow.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
folder.Tasks.Add(taskWindow.TaskResult);
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteTask(ReminderTask? task)
|
||||||
|
{
|
||||||
|
if (task == null || SelectedFolder == null) return;
|
||||||
|
SelectedFolder.Tasks.Remove(task);
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MoveTaskToFolder((ReminderTask Task, Folder TargetFolder) args)
|
||||||
|
{
|
||||||
|
var (task, targetFolder) = args;
|
||||||
|
if (task == null || targetFolder == null) return;
|
||||||
|
|
||||||
|
var sourceFolder = _appData.Folders.FirstOrDefault(f => f.Tasks.Contains(task));
|
||||||
|
if (sourceFolder == null || sourceFolder == targetFolder) return;
|
||||||
|
|
||||||
|
sourceFolder.Tasks.Remove(task);
|
||||||
|
targetFolder.Tasks.Add(task);
|
||||||
|
_ = SaveAsync();
|
||||||
|
|
||||||
|
if (SelectedFolder == sourceFolder)
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(SelectedFolderTasks));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EditTask(ReminderTask? task)
|
||||||
|
{
|
||||||
|
if (task == null) return;
|
||||||
|
SelectedTask = task;
|
||||||
|
EditTaskRequested?.Invoke(this, task);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleAutostart()
|
||||||
|
{
|
||||||
|
_autostartService.ToggleAutostart();
|
||||||
|
var message = _autostartService.IsAutostartEnabled
|
||||||
|
? L("AutostartEnabled")
|
||||||
|
: L("AutostartDisabled");
|
||||||
|
MessageBox.Show(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckReminders()
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[CheckReminders] Timer fired at {DateTime.Now}");
|
||||||
|
bool hasChanges = false;
|
||||||
|
foreach (var folder in _appData.Folders)
|
||||||
|
{
|
||||||
|
foreach (var task in folder.Tasks)
|
||||||
|
{
|
||||||
|
if (!task.IsNotified && task.ReminderDate <= DateTime.Now)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[CheckReminders] Task fällig: {task.Name}");
|
||||||
|
_notificationService.ShowNotification($"🔔 {task.Name}", task.Description);
|
||||||
|
|
||||||
|
if (task.IsRecurring)
|
||||||
|
{
|
||||||
|
task.ReminderDate = task.GetNextOccurrence();
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[CheckReminders] Next occurrence: {task.ReminderDate}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
task.IsNotified = true;
|
||||||
|
}
|
||||||
|
hasChanges = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasChanges) _ = SaveAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TestNotification()
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine("[TestNotification] Button clicked!");
|
||||||
|
_notificationService.ShowNotification(L("TestNotificationTitle"), L("TestNotificationMessage"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ImportCsv()
|
||||||
|
{
|
||||||
|
var dialog = new Microsoft.Win32.OpenFileDialog
|
||||||
|
{
|
||||||
|
Filter = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*",
|
||||||
|
Title = "Import CSV"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (dialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var lines = System.IO.File.ReadAllLines(dialog.FileName);
|
||||||
|
int imported = 0;
|
||||||
|
int skipped = 0;
|
||||||
|
var folderMap = new Dictionary<string, Folder>();
|
||||||
|
|
||||||
|
foreach (var folder in _appData.Folders)
|
||||||
|
{
|
||||||
|
folderMap[folder.Name] = folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dateFormat = "yyyy-MM-dd HH:mm";
|
||||||
|
|
||||||
|
for (int i = 1; i < lines.Length; i++)
|
||||||
|
{
|
||||||
|
var line = lines[i];
|
||||||
|
if (string.IsNullOrWhiteSpace(line)) continue;
|
||||||
|
|
||||||
|
var parts = line.Split(';');
|
||||||
|
|
||||||
|
if (parts.Length < 4)
|
||||||
|
{
|
||||||
|
skipped++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var folderName = parts[0].Trim();
|
||||||
|
var name = parts[1].Trim();
|
||||||
|
var description = parts.Length > 2 ? parts[2].Trim() : "";
|
||||||
|
|
||||||
|
var dateStr = parts.Length > 3 ? parts[3].Trim() : "";
|
||||||
|
if (!DateTime.TryParseExact(dateStr, dateFormat,
|
||||||
|
System.Globalization.CultureInfo.InvariantCulture,
|
||||||
|
System.Globalization.DateTimeStyles.None, out var date))
|
||||||
|
{
|
||||||
|
skipped++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(folderName))
|
||||||
|
{
|
||||||
|
skipped++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!folderMap.TryGetValue(folderName, out var targetFolder))
|
||||||
|
{
|
||||||
|
targetFolder = new Folder(folderName);
|
||||||
|
_appData.Folders.Add(targetFolder);
|
||||||
|
folderMap[folderName] = targetFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
var task = new ReminderTask(name, description, date);
|
||||||
|
|
||||||
|
if (parts.Length >= 6)
|
||||||
|
{
|
||||||
|
var recurringStr = parts[4].Trim();
|
||||||
|
if (bool.TryParse(recurringStr, out var isRecurring))
|
||||||
|
{
|
||||||
|
task.IsRecurring = isRecurring;
|
||||||
|
}
|
||||||
|
var recTypeStr = parts[5].Trim();
|
||||||
|
if (Enum.TryParse<RecurrenceType>(recTypeStr, out var recType))
|
||||||
|
{
|
||||||
|
task.RecurrenceType = recType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
targetFolder.Tasks.Add(task);
|
||||||
|
imported++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ = SaveAsync();
|
||||||
|
OnPropertyChanged(nameof(Folders));
|
||||||
|
OnPropertyChanged(nameof(SelectedFolderTasks));
|
||||||
|
|
||||||
|
var msg = skipped > 0
|
||||||
|
? $"{L("ImportSuccess").Replace("{0}", imported.ToString())} ({skipped} skipped)"
|
||||||
|
: L("ImportSuccess").Replace("{0}", imported.ToString());
|
||||||
|
MessageBox.Show(msg);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(L("ImportError").Replace("{0}", ex.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExportCsv()
|
||||||
|
{
|
||||||
|
var dialog = new Microsoft.Win32.SaveFileDialog
|
||||||
|
{
|
||||||
|
Filter = "CSV Files (*.csv)|*.csv",
|
||||||
|
Title = "Export CSV",
|
||||||
|
FileName = "tasks.csv"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (dialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var writer = new System.IO.StreamWriter(dialog.FileName);
|
||||||
|
writer.WriteLine("Folder;Name;Description;Date;IsRecurring;RecurrenceType");
|
||||||
|
|
||||||
|
foreach (var folder in _appData.Folders)
|
||||||
|
{
|
||||||
|
foreach (var task in folder.Tasks)
|
||||||
|
{
|
||||||
|
var line = string.Join(";",
|
||||||
|
CsvEscape(folder.Name),
|
||||||
|
CsvEscape(task.Name),
|
||||||
|
CsvEscape(task.Description),
|
||||||
|
task.ReminderDate.ToString("yyyy-MM-dd HH:mm"),
|
||||||
|
task.IsRecurring.ToString(),
|
||||||
|
task.RecurrenceType.ToString());
|
||||||
|
writer.WriteLine(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show(L("ExportSuccess"));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(L("ExportError").Replace("{0}", ex.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string CsvEscape(string value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(value)) return "";
|
||||||
|
if (value.Contains(";") || value.Contains("\"") || value.Contains("\n"))
|
||||||
|
{
|
||||||
|
return "\"" + value.Replace("\"", "\"\"") + "\"";
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SaveAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _dataService.SaveAsync(_appData);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"{L("SaveError")}: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Cleanup()
|
||||||
|
{
|
||||||
|
_reminderTimer.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
264
ViewModels/TaskViewModel.cs
Normal file
264
ViewModels/TaskViewModel.cs
Normal file
@@ -0,0 +1,264 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using ReminderOrganizer.Core;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.ViewModels
|
||||||
|
{
|
||||||
|
public class TaskViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private readonly ILocalizationService _localizationService;
|
||||||
|
private readonly ReminderTask _originalTask;
|
||||||
|
private readonly bool _isNewTask;
|
||||||
|
private string _name = "";
|
||||||
|
private string _description = "";
|
||||||
|
private DateTime _reminderDate = DateTime.Now.AddHours(1);
|
||||||
|
private string _errorMessage = "";
|
||||||
|
private bool _hasError = false;
|
||||||
|
private bool _isRecurring = false;
|
||||||
|
private int _selectedRecurrenceIndex = 3;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => _name;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _name, value);
|
||||||
|
ValidateInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get => _description;
|
||||||
|
set => SetProperty(ref _description, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime ReminderDate
|
||||||
|
{
|
||||||
|
get => _reminderDate;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _reminderDate, value);
|
||||||
|
UpdateHourMinuteIndices();
|
||||||
|
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime MinDate => DateTime.Now.AddMinutes(-1);
|
||||||
|
|
||||||
|
public int SelectedHourIndex
|
||||||
|
{
|
||||||
|
get => _reminderDate.Hour;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var newDate = new DateTime(_reminderDate.Year, _reminderDate.Month, _reminderDate.Day, value, _reminderDate.Minute, 0);
|
||||||
|
SetProperty(ref _reminderDate, newDate);
|
||||||
|
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SelectedMinuteIndex
|
||||||
|
{
|
||||||
|
get => _reminderDate.Minute / 5;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var newDate = new DateTime(_reminderDate.Year, _reminderDate.Month, _reminderDate.Day, _reminderDate.Hour, value * 5, 0);
|
||||||
|
SetProperty(ref _reminderDate, newDate);
|
||||||
|
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ErrorMessage
|
||||||
|
{
|
||||||
|
get => _errorMessage;
|
||||||
|
set => SetProperty(ref _errorMessage, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasError
|
||||||
|
{
|
||||||
|
get => _hasError;
|
||||||
|
set => SetProperty(ref _hasError, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsRecurring
|
||||||
|
{
|
||||||
|
get => _isRecurring;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _isRecurring, value);
|
||||||
|
_originalTask.IsRecurring = value;
|
||||||
|
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SelectedRecurrenceIndex
|
||||||
|
{
|
||||||
|
get => _selectedRecurrenceIndex;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedRecurrenceIndex, value);
|
||||||
|
_originalTask.RecurrenceType = (RecurrenceType)value;
|
||||||
|
OnPropertyChanged(nameof(IsDailySelected));
|
||||||
|
OnPropertyChanged(nameof(IsWeeklySelected));
|
||||||
|
OnPropertyChanged(nameof(IsMonthlySelected));
|
||||||
|
OnPropertyChanged(nameof(IsYearlySelected));
|
||||||
|
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsDailySelected
|
||||||
|
{
|
||||||
|
get => _selectedRecurrenceIndex == 0;
|
||||||
|
set { if (value) { SelectedRecurrenceIndex = 0; } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsWeeklySelected
|
||||||
|
{
|
||||||
|
get => _selectedRecurrenceIndex == 1;
|
||||||
|
set { if (value) { SelectedRecurrenceIndex = 1; } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsMonthlySelected
|
||||||
|
{
|
||||||
|
get => _selectedRecurrenceIndex == 2;
|
||||||
|
set { if (value) { SelectedRecurrenceIndex = 2; } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsYearlySelected
|
||||||
|
{
|
||||||
|
get => _selectedRecurrenceIndex == 3;
|
||||||
|
set { if (value) { SelectedRecurrenceIndex = 3; } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string NextOccurrenceText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!IsRecurring) return "";
|
||||||
|
|
||||||
|
var tempTask = new ReminderTask
|
||||||
|
{
|
||||||
|
ReminderDate = ReminderDate,
|
||||||
|
RecurrenceType = (RecurrenceType)_selectedRecurrenceIndex
|
||||||
|
};
|
||||||
|
var next = tempTask.GetNextOccurrence();
|
||||||
|
return next.ToString("dd.MM.yyyy HH:mm");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string WindowTitle => _isNewTask
|
||||||
|
? _localizationService.GetString("AddTask")
|
||||||
|
: _localizationService.GetString("EditTask");
|
||||||
|
|
||||||
|
public string NameLabel => _localizationService.GetString("Name");
|
||||||
|
public string DescriptionLabel => _localizationService.GetString("Description");
|
||||||
|
public string DateLabel => _localizationService.GetString("Date");
|
||||||
|
public string SaveText => _localizationService.GetString("Save");
|
||||||
|
public string CancelText => _localizationService.GetString("Cancel");
|
||||||
|
public string RecurringLabel => _localizationService.GetString("Recurring");
|
||||||
|
public string DailyText => _localizationService.GetString("Daily");
|
||||||
|
public string WeeklyText => _localizationService.GetString("Weekly");
|
||||||
|
public string MonthlyText => _localizationService.GetString("Monthly");
|
||||||
|
public string YearlyText => _localizationService.GetString("Yearly");
|
||||||
|
|
||||||
|
public ICommand SaveCommand { get; }
|
||||||
|
public ICommand CancelCommand { get; }
|
||||||
|
public ICommand SetTomorrowCommand { get; }
|
||||||
|
public ICommand SetNextWeekCommand { get; }
|
||||||
|
public ICommand SetNextMonthCommand { get; }
|
||||||
|
|
||||||
|
public ReminderTask TaskResult => _originalTask;
|
||||||
|
|
||||||
|
public event EventHandler<bool>? RequestClose;
|
||||||
|
|
||||||
|
public TaskViewModel(ILocalizationService localizationService, ReminderTask? existingTask = null)
|
||||||
|
{
|
||||||
|
_localizationService = localizationService;
|
||||||
|
_isNewTask = existingTask == null;
|
||||||
|
|
||||||
|
if (_isNewTask)
|
||||||
|
{
|
||||||
|
_originalTask = new ReminderTask();
|
||||||
|
_reminderDate = DateTime.Now.AddHours(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_originalTask = existingTask!;
|
||||||
|
_name = existingTask!.Name;
|
||||||
|
_description = existingTask.Description;
|
||||||
|
_reminderDate = existingTask.ReminderDate;
|
||||||
|
_isRecurring = existingTask.IsRecurring;
|
||||||
|
_selectedRecurrenceIndex = (int)existingTask.RecurrenceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveCommand = new RelayCommand(Save, CanSave);
|
||||||
|
CancelCommand = new RelayCommand(Cancel);
|
||||||
|
SetTomorrowCommand = new RelayCommand(SetTomorrow);
|
||||||
|
SetNextWeekCommand = new RelayCommand(SetNextWeek);
|
||||||
|
SetNextMonthCommand = new RelayCommand(SetNextMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateHourMinuteIndices()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(SelectedHourIndex));
|
||||||
|
OnPropertyChanged(nameof(SelectedMinuteIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanSave() => !string.IsNullOrWhiteSpace(Name);
|
||||||
|
|
||||||
|
private void ValidateInput()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(Name))
|
||||||
|
{
|
||||||
|
ErrorMessage = _localizationService.GetString("NameRequired");
|
||||||
|
HasError = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ErrorMessage = "";
|
||||||
|
HasError = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetTomorrow()
|
||||||
|
{
|
||||||
|
ReminderDate = DateTime.Now.Date.AddDays(1).AddHours(9);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetNextWeek()
|
||||||
|
{
|
||||||
|
var nextWeek = DateTime.Now.Date.AddDays(7);
|
||||||
|
var dayOfWeek = nextWeek.DayOfWeek;
|
||||||
|
if (dayOfWeek == DayOfWeek.Saturday) nextWeek = nextWeek.AddDays(2);
|
||||||
|
else if (dayOfWeek == DayOfWeek.Sunday) nextWeek = nextWeek.AddDays(1);
|
||||||
|
ReminderDate = nextWeek.AddHours(9);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetNextMonth()
|
||||||
|
{
|
||||||
|
var nextMonth = DateTime.Now.Date.AddMonths(1);
|
||||||
|
ReminderDate = new DateTime(nextMonth.Year, nextMonth.Month, 1).AddHours(9);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Save()
|
||||||
|
{
|
||||||
|
if (!CanSave()) return;
|
||||||
|
|
||||||
|
_originalTask.Name = Name;
|
||||||
|
_originalTask.Description = Description;
|
||||||
|
_originalTask.ReminderDate = ReminderDate;
|
||||||
|
_originalTask.IsNotified = false;
|
||||||
|
_originalTask.IsRecurring = IsRecurring;
|
||||||
|
_originalTask.RecurrenceType = (RecurrenceType)SelectedRecurrenceIndex;
|
||||||
|
RequestClose?.Invoke(this, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Cancel()
|
||||||
|
{
|
||||||
|
RequestClose?.Invoke(this, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
app.manifest
Normal file
25
app.manifest
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?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="ReminderOrganizer"/>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||||
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
|
||||||
|
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
|
||||||
|
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<windowsSettings>
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
||||||
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||||
|
</windowsSettings>
|
||||||
|
</application>
|
||||||
|
</assembly>
|
||||||
BIN
docs/screenshots/1.png
Normal file
BIN
docs/screenshots/1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
docs/screenshots/2.png
Normal file
BIN
docs/screenshots/2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
docs/screenshots/3.png
Normal file
BIN
docs/screenshots/3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
docs/screenshots/4.png
Normal file
BIN
docs/screenshots/4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
BIN
docs/screenshots/main-window.png
Normal file
BIN
docs/screenshots/main-window.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
47
release.bat
Normal file
47
release.bat
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
@echo off
|
||||||
|
cd /d "%~dp0"
|
||||||
|
echo.
|
||||||
|
echo ============================================
|
||||||
|
echo ReminderOrganizer - Release Builder
|
||||||
|
echo ============================================
|
||||||
|
echo.
|
||||||
|
|
||||||
|
echo [1/4] Loesche alte Dateien...
|
||||||
|
if exist "publish" rmdir /s /q "publish"
|
||||||
|
if exist "ReminderOrganizer.zip" del "ReminderOrganizer.zip"
|
||||||
|
|
||||||
|
echo [2/4] Baue Single-File EXE...
|
||||||
|
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true -o publish
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo *** FEHLER beim Bauen! ***
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo [3/4] Kopiere Locales Ordner...
|
||||||
|
xcopy /E /I /Y "Locales" "publish\Locales" >nul
|
||||||
|
|
||||||
|
echo [4/4] Erstelle ZIP Datei...
|
||||||
|
powershell -Command "Compress-Archive -Path 'publish\ReminderOrganizer.exe', 'publish\Locales\*' -DestinationPath 'ReminderOrganizer.zip' -Force"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo *** FEHLER beim ZIP erstellen! ***
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ============================================
|
||||||
|
echo FERTIG!
|
||||||
|
echo ReminderOrganizer.zip wurde erstellt.
|
||||||
|
echo ============================================
|
||||||
|
echo Inhalt:
|
||||||
|
echo - ReminderOrganizer.exe
|
||||||
|
echo - Locales\de.json (Deutsch)
|
||||||
|
echo - Locales\en.json (English)
|
||||||
|
echo ============================================
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
1
tasks.json
Normal file
1
tasks.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"Folders":[{"Name":"Neuer Ordner","Tasks":[]},{"Name":"Neuer Ordner","Tasks":[]},{"Name":"Neuer Ordner","Tasks":[{"Name":"Tesr","Description":"test","Note":"","ReminderDate":"2026-03-19T09:36:00","IsNotified":true}]},{"Name":"Neuer Ordner","Tasks":[]}],"Language":"en"}
|
||||||
Reference in New Issue
Block a user