{"id":21348418,"url":"https://github.com/ex-exe/enumnotifygenerator","last_synced_at":"2025-10-07T13:57:15.908Z","repository":{"id":225647386,"uuid":"766499492","full_name":"EX-EXE/EnumNotifyGenerator","owner":"EX-EXE","description":"EnumAttributeGenerator is a C# source generator that facilitates the automatic generation of attributed properties based on changes to specified enum values.","archived":false,"fork":false,"pushed_at":"2024-03-06T12:43:02.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T04:19:19.168Z","etag":null,"topics":["csharp","library","sourcegenerator"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EX-EXE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-03T12:46:53.000Z","updated_at":"2024-03-07T11:09:23.000Z","dependencies_parsed_at":"2025-01-22T16:42:34.558Z","dependency_job_id":"a184e153-5beb-4202-a54e-72de779521f9","html_url":"https://github.com/EX-EXE/EnumNotifyGenerator","commit_stats":null,"previous_names":["ex-exe/enumnotifygenerator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EX-EXE/EnumNotifyGenerator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EX-EXE%2FEnumNotifyGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EX-EXE%2FEnumNotifyGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EX-EXE%2FEnumNotifyGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EX-EXE%2FEnumNotifyGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EX-EXE","download_url":"https://codeload.github.com/EX-EXE/EnumNotifyGenerator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EX-EXE%2FEnumNotifyGenerator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278786670,"owners_count":26045588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","library","sourcegenerator"],"created_at":"2024-11-22T02:20:54.563Z","updated_at":"2025-10-07T13:57:15.885Z","avatar_url":"https://github.com/EX-EXE.png","language":"C#","readme":"[![NuGet version](https://badge.fury.io/nu/EnumNotifyGenerator.svg)](https://badge.fury.io/nu/EnumNotifyGenerator)\n\n# EnumNotifyGenerator\nEnumAttributeGenerator is a C# source generator that facilitates the automatic generation of attributed properties based on changes to specified enum values.   \nWhen an enum value is modified, properties adorned with specific attributes are automatically updated.\n\n## Usage\n\n### Install by NuGet\nPM\u003e Install-Package [EnumNotifyGenerator](https://www.nuget.org/packages/EnumNotifyGenerator)\n\n### Base Source\n```csharp\nusing EnumNotifyGenerator;\npublic enum LanguageType\n{\n\tJapanese,\n\tEnglish,\n}\n[EnumNotify(typeof(LanguageType),\"CurrentLanguage\")]\npublic partial class Message : INotifyPropertyChanged\n{\n\tprivate static Message? instance = null;\n\tpublic static Message Shared =\u003e instance ??= new Message();\n\n\tpublic event PropertyChangedEventHandler? PropertyChanged;\n\n\t[EnumValue(LanguageType.Japanese, \"成功\")]\n\t[EnumValue(LanguageType.English, \"Success\")]\n\tprivate string successMessage = string.Empty;\n\n\t[EnumValue(LanguageType.Japanese,\"エラー\")]\n\t[EnumValue(LanguageType.English, \"Error\")]\n\tprivate string errorMessage = string.Empty;\n\n}\n\n```\n\n### Generated Source\n\n```csharp\npartial class Message\n{\n\tprivate global::EnumNotifyWpf.LanguageType _CurrentLanguage;\n\tpublic global::EnumNotifyWpf.LanguageType CurrentLanguage\n\t{\n\t\tget\n\t\t{\n\t\t\treturn _CurrentLanguage;\n\t\t}\n\t\tset\n\t\t{\n\t\t\tif(_CurrentLanguage == value)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t_CurrentLanguage = value;\n\t\t\tif(PropertyChanged != null)\n\t\t\t{\n\t\t\t\tPropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(\"CurrentLanguage\"));\n\t\t\t\tPropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(\"SuccessMessage\"));\n\t\t\t\tPropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(\"ErrorMessage\"));\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic string SuccessMessage\n\t{\n\t\tget\n\t\t{\n\t\t\tswitch(_CurrentLanguage)\n\t\t\t{\n\t\t\t\tcase (global::EnumNotifyWpf.LanguageType)0:\n\t\t\t\t\treturn @\"成功\";\n\t\t\t\tcase (global::EnumNotifyWpf.LanguageType)1:\n\t\t\t\t\treturn @\"Success\";\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn successMessage;\n\t\t}\n\t}\n\tpublic string ErrorMessage\n\t{\n\t\tget\n\t\t{\n\t\t\tswitch(_CurrentLanguage)\n\t\t\t{\n\t\t\t\tcase (global::EnumNotifyWpf.LanguageType)0:\n\t\t\t\t\treturn @\"エラー\";\n\t\t\t\tcase (global::EnumNotifyWpf.LanguageType)1:\n\t\t\t\t\treturn @\"Error\";\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn errorMessage;\n\t\t}\n\t}\n}\n```\n### Usage(WPF)\n![image](https://github.com/EX-EXE/EnumNotifyGenerator/assets/114784289/0633a519-38e0-4a9f-8eba-fcb3337120f9)\n#### MessageBinding.cs\n```csharp\npublic class MessageBinding(string path) : MarkupExtension\n{\n\tpublic string Path { get; set; } = path;\n\n\tpublic override object ProvideValue(IServiceProvider serviceProvider)\n\t{\n\t\tvar binding =  new Binding(Path)\n\t\t{\n\t\t\tSource = Message.Shared,\n\t\t\tMode = BindingMode.OneWay,\n\t\t};\n\t\treturn binding.ProvideValue(serviceProvider);\n\t}\n}\n```\n\n#### MainWindow.xaml\n```xaml\n\u003cWindow x:Class=\"EnumNotifyWpf.MainWindow\"\n        xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n        xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n        xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n        xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n        xmlns:local=\"clr-namespace:EnumNotifyWpf\"\n        mc:Ignorable=\"d\"\n        Title=\"MainWindow\" Height=\"200\" Width=\"300\"\u003e\n\n    \u003cStackPanel\u003e\n        \u003cComboBox SelectionChanged=\"ComboBox_SelectionChanged\"\u003e\n            \u003cComboBoxItem\u003eJapanese\u003c/ComboBoxItem\u003e\n            \u003cComboBoxItem\u003eEnglish\u003c/ComboBoxItem\u003e\n        \u003c/ComboBox\u003e\n        \u003cTextBlock Text=\"{local:MessageBinding SuccessMessage}\"\u003e\u003c/TextBlock\u003e\n        \u003cTextBlock Text=\"{local:MessageBinding ErrorMessage}\"\u003e\u003c/TextBlock\u003e\n    \u003c/StackPanel\u003e\n\u003c/Window\u003e\n```\n\n#### MainWindow.xaml.cs\n```csharp\npublic partial class MainWindow : Window\n{\n\tpublic MainWindow()\n\t{\n\t\tInitializeComponent();\n\t}\n\n\tprivate void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)\n\t{\n\t\tif(sender is ComboBox comboBox \u0026\u0026 \n\t\t\tcomboBox.SelectedItem is ComboBoxItem comboBoxItem \u0026\u0026\n\t\t\tcomboBoxItem.Content is string comboBoxItemContent)\n\t\t{\n\t\t\tswitch(comboBoxItemContent)\n\t\t\t{\n\t\t\t\tcase \"Japanese\":\n\t\t\t\t\tMessage.Shared.CurrentLanguage = LanguageType.Japanese;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"English\":\n\t\t\t\t\tMessage.Shared.CurrentLanguage = LanguageType.English;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fex-exe%2Fenumnotifygenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fex-exe%2Fenumnotifygenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fex-exe%2Fenumnotifygenerator/lists"}