Skip to content

Conversation

Lamparter
Copy link
Owner

@Lamparter Lamparter commented Feb 28, 2025

Add InitializeComponentAttribute feature to the project.

  • Attribute Class: Add InitializeComponentAttribute class in src/core/Riverside.Extensions.WinUI/InitializeComponentAttribute.cs.

    • Define InitializeComponentAttribute partial class in Riverside.Extensions.WinUI namespace.
    • Mark the class with [AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)].
    • Add a constructor to the class.
  • Source Generator: Add source generator for InitializeComponentAttribute in src/core/Riverside.Extensions.WinUI/InitializeComponentAttribute.SourceGenerator.cs.

    • Define InitializeComponentGenerator partial class in Riverside.Extensions.WinUI namespace.
    • Implement ISourceGenerator interface.
    • Implement Initialize method.
    • Implement Execute method to generate the constructor with this.InitializeComponent() for classes with InitializeComponentAttribute.

@github-project-automation github-project-automation bot moved this to 🆕 New in CubeKit Feb 28, 2025
@Lamparter Lamparter self-assigned this Feb 28, 2025
@Lamparter Lamparter added this to the New APIs for CubeKit milestone Feb 28, 2025
Fixes #62

Add `InitializeComponentAttribute` feature to the project.

* **Attribute Class**: Add `InitializeComponentAttribute` class in `src/core/Riverside.Extensions.WinUI/InitializeComponentAttribute.cs`.
  - Define `InitializeComponentAttribute` partial class in `Riverside.Extensions.WinUI` namespace.
  - Mark the class with `[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)]`.
  - Add a constructor to the class.

* **Source Generator**: Add source generator for `InitializeComponentAttribute` in `src/core/Riverside.Extensions.WinUI/InitializeComponentAttribute.SourceGenerator.cs`.
  - Define `InitializeComponentGenerator` partial class in `Riverside.Extensions.WinUI` namespace.
  - Implement `ISourceGenerator` interface.
  - Implement `Initialize` method.
  - Implement `Execute` method to generate the constructor with `this.InitializeComponent()` for classes with `InitializeComponentAttribute`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/RiversideValley/Toolkit/issues/62?shareId=XXXX-XXXX-XXXX-XXXX).
@Lamparter Lamparter force-pushed the Lamparter/lamparter/initializecomponentattribute branch from fa5594f to 9fdd361 Compare March 1, 2025 09:01
@Lamparter
Copy link
Owner Author

It doesn't work 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: InitializeComponentAttribute
1 participant