Complete TodoApp sample application with: - App.xaml/cs: Colors and styles for light/dark themes - TodoListPage: Task list with theme toggle switch - NewTodoPage: Form to create new tasks - TodoDetailPage: Edit task details with delete option - TodoItem.cs/TodoService.cs: Data model and service - SVG icons for save, delete, and add actions Theme switching via toggle on main page applies app-wide. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System;
|
|
using Microsoft.Maui.Controls;
|
|
|
|
namespace TodoApp;
|
|
|
|
public partial class TodoDetailPage : ContentPage
|
|
{
|
|
private readonly TodoService _service = TodoService.Instance;
|
|
private readonly TodoItem _item;
|
|
|
|
public TodoDetailPage(TodoItem item)
|
|
{
|
|
InitializeComponent();
|
|
_item = item;
|
|
|
|
TitleEntry.Text = item.Title;
|
|
NotesEditor.Text = item.Notes;
|
|
CompletedCheckBox.IsChecked = item.IsCompleted;
|
|
CreatedLabel.Text = $"Created {item.CreatedAt:MMMM d, yyyy} at {item.CreatedAt:h:mm tt}";
|
|
}
|
|
|
|
private async void OnSaveClicked(object? sender, EventArgs e)
|
|
{
|
|
_item.Title = TitleEntry.Text ?? "";
|
|
_item.Notes = NotesEditor.Text ?? "";
|
|
_item.IsCompleted = CompletedCheckBox.IsChecked;
|
|
await Navigation.PopAsync();
|
|
}
|
|
|
|
private async void OnDeleteClicked(object? sender, EventArgs e)
|
|
{
|
|
bool confirm = await DisplayAlert("Delete Task",
|
|
"Are you sure you want to delete this task?",
|
|
"Delete", "Cancel");
|
|
|
|
if (confirm)
|
|
{
|
|
_service.RemoveTodo(_item);
|
|
await Navigation.PopAsync();
|
|
}
|
|
}
|
|
}
|