{"id":13342442,"url":"https://github.com/Maxumka/NOB","last_synced_at":"2025-03-12T01:37:15.770Z","repository":{"id":49078954,"uuid":"381266626","full_name":"Maxumka/NOB","owner":"Maxumka","description":"Not boilerplate in WPF MVVM","archived":false,"fork":false,"pushed_at":"2021-07-12T09:51:35.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-30T21:04:26.309Z","etag":null,"topics":["boilerplate","csharp","dotnet","mvvm","sourcegenerator","wpf"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Maxumka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-29T06:47:07.000Z","updated_at":"2021-11-12T12:45:43.000Z","dependencies_parsed_at":"2022-09-13T22:00:54.668Z","dependency_job_id":null,"html_url":"https://github.com/Maxumka/NOB","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxumka%2FNOB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxumka%2FNOB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxumka%2FNOB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxumka%2FNOB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Maxumka","download_url":"https://codeload.github.com/Maxumka/NOB/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221260196,"owners_count":16787078,"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","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":["boilerplate","csharp","dotnet","mvvm","sourcegenerator","wpf"],"created_at":"2024-07-29T19:29:26.274Z","updated_at":"2024-10-24T01:31:04.903Z","avatar_url":"https://github.com/Maxumka.png","language":"C#","readme":"# NOB\nNOB - its a source generator that allows you not to write boilerplate code in the WPF.\n## Features\n1. Generate property\n2. Generate INotifyPropertyChanged\n3. Generate ICommand\n4. Generate Command (only without parameters)\n## Example\nMake your viewmodel a partial class, add the viewmodel attribute to the class, the property attribute to the fields, the command attribute to the methods.\n```CSharp    \n    [ViewModel]\n    public partial class MainWindowViewModel\n    {\n        [Property]\n        private string text1;\n\n        [Command]\n        private void ClearText1() =\u003e PropertyText1 = \"\";\n\n        public MainWindowViewModel() { }\n    }\n```\nAnd this is what your viewmodel will become\n```CSharp    \nusing System;\nusing System.ComponentModel;\nusing System.Windows.Input;\nusing GeneratedCommand;\nnamespace GeneratedAttribute\n{\n  [AttributeUsage(AttributeTargets.Class)]\n  public class ViewModelAttribute : Attribute { }\n  [AttributeUsage(AttributeTargets.Field)]\n  public class PropertyAttribute : Attribute { }\n  [AttributeUsage(AttributeTargets.Method)]\n  public class CommandAttribute : Attribute { }\n}\n\nnamespace GeneratedCommand\n{\n  public class Command : ICommand\n  {\n  private readonly Action _execute;\n  private readonly Func\u003cbool\u003e _canExecute;\n  public event EventHandler CanExecuteChanged\n  {\n    add { CommandManager.RequerySuggested += value; }\n    remove { CommandManager.RequerySuggested -= value; }\n  }\n  public Command(Action execute, Func\u003cbool\u003e canExecute = null)\n    =\u003e (_execute, _canExecute) = (execute, canExecute);\n  public bool CanExecute(object parameter) =\u003e true;\n  public void Execute(object parameter) =\u003e _execute();\n  }\n}\nnamespace NOB.SampleProject.ViewModels\n{\n  public partial class MainWindowViewModel : INotifyPropertyChanged\n  {\n    public string PropertyText1\n    {\n      get =\u003e text1;\n      set \n      {\n        text1 = value; OnPropertyChanged(nameof(PropertyText1));\n      }\n    }\n  private Command commandClearText1;\n  public Command CommandClearText1\n  {\n    get =\u003e new(ClearText1);\n  }\n  public event PropertyChangedEventHandler PropertyChanged;\n  public void OnPropertyChanged(string propertyName = null) \n  { \n    PropertyChanged?.Invoke(this, new(propertyName)); \n  }\n }\n}\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaxumka%2FNOB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMaxumka%2FNOB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaxumka%2FNOB/lists"}