Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support C# Typegen +WinUI 3 Sample #255

Closed
wants to merge 3 commits into from
Closed

Conversation

huwaireb
Copy link

@huwaireb huwaireb commented Jul 5, 2024

Closes #164

The typegen implementation primarily done, just need to push up the requests overload.
Example will be pushed tomorrow hopefully, as I clean up given it's 3 am currently 😅 and merge into simple_calculator.

Preview

Windows.11.C.Windows.App.SDK.mov

@huwaireb huwaireb changed the title feat(typegen): support c# Support C# Typegen +WinUI 3 Sample Jul 5, 2024
…t enum variants

Implements a class otherwise, always for enums. Which isn't ideal, however
passing the option to the user might be wiser.

let config = serde_generate::CodeGeneratorConfig::new(package_name.to_string())
.with_encodings(vec![Encoding::Bincode])
.with_c_style_enums(true);
Copy link
Author

@huwaireb huwaireb Jul 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An enum like

enum Event {
    Increment,
    Decrement,
    Reset,
}

would translate to

enum Event {
        Increment = 0,
        Decrement = 1,
        Reset = 2,
    }

instead of generating classes for each variant e.g Increment. Limited to enums that don't store data, those who do serde-reflection will generate a class for them.

Should we make it a parameter of the function for flexibility, or is it fine as is?

@huwaireb
Copy link
Author

huwaireb commented Jul 17, 2024

Yeah, this won't work. I managed to get it working twice, each different implementation both with drawbacks that are just not worth it.

Screenshot 2024-07-17 at 18 08 56

I'll close this, I don't wish this on anyone. If I find a better way to do this, i'll share, for now i'm not even sure what i'll do for my own project.

@huwaireb huwaireb closed this Jul 17, 2024
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.

Thoughts on Windows 11 C# Windows App SDK WinUI 3 XAML
1 participant