From df0eae256c40c05a43bc66a6279b5ee1bdbe7a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Wed, 29 Oct 2025 18:44:58 +0100 Subject: [PATCH] Add copilot instructions. --- .github/copilot-instructions.md | 64 +++++++++++++++++++++++++++++++++ WinoMail.slnx | 1 + 2 files changed, 65 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..135e6a2a --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,64 @@ +# Copilot Instructions for Wino-Mail Project + +## ViewModels Development Guidelines + +### Observable Properties +- **ALWAYS** use `public partial` observable properties in ViewModels +- **NEVER** use private fields with `[ObservableProperty]` attribute +- **Correct Pattern:** + ```csharp + [ObservableProperty] + public partial string SearchQuery { get; set; } = string.Empty; + ``` +- **Incorrect Pattern:** + ```csharp + [ObservableProperty] + private string searchQuery = string.Empty; + ``` + +### ViewModels Structure +- All ViewModels should inherit from appropriate base classes (MailBaseViewModel, CoreBaseViewModel, etc.) +- Use `[RelayCommand]` for command methods +- Follow the existing dependency injection patterns +- Use `IMailDialogService` for Mail-related dialogs, `IDialogServiceBase` for core dialogs + +### Strings and Localization +- All strings should be added in English to en-US.json file and used via Translator class. +- Avoid hardcoding strings in the codebase. +- Use Translator.{TranslationKey} with property to retrieve string in view models. +- Use Translator as well in the XAML files with x:Bind. Always use OneTime mode. + +### Dialog Services +- Use `InfoBarMessage()` method for simple notifications +- Use `ShowConfirmationDialogAsync()` for confirmation dialogs +- Use `PickFilesAsync()` for file selection +- Always check for null/empty results from dialog operations + +### File Structure +- Place ViewModels in appropriate projects (Wino.Mail.ViewModels, Wino.Core.ViewModels, etc.) +- Create abstract page classes in Views/Abstract folders +- Follow the existing naming conventions + +### Error Handling +- Always wrap async operations in try-catch blocks +- Use InfoBar messages for user-friendly error notifications +- Log errors appropriately but don't expose technical details to users + +### Collection Management +- Use ObservableCollection for UI-bound collections +- Implement proper filtering and search functionality +- Use virtualization for large datasets (ListView, ItemsView) + +### Contact Management Specific +- Respect IsRootContact property - root contacts cannot be deleted +- Check IsOverridden property during synchronization +- Always validate contact data before operations +- Use PersonPicture controls for contact avatars +- Support multiple selection where appropriate + +## Code Style +- Use var where type is obvious +- Use string interpolation over string.Format where simple +- Keep methods focused and single-responsibility +- Use meaningful variable names +- Add XML documentation for public APIs diff --git a/WinoMail.slnx b/WinoMail.slnx index e632e793..c1218d4b 100644 --- a/WinoMail.slnx +++ b/WinoMail.slnx @@ -6,6 +6,7 @@ +