Hidden Code Auto GeneratorCreated by Icer Overview
InstallationMake sure you have VS2015 installed, then run Open it and install to your VS. Feature
Getting startedSet Put following code at top of your code: (of course, you should make sure the corresponding generator exists in the relative path)
Currently available generators: UsageCurrently, four generator available, mainly focused on WPF MVVM development. For details, you can refer to Test Cases Relay CommandTurn this: [AutoGenCommand("NewProject")][AutoGenCommand("OpenProject", "this.NewProject")][AutoGenCommand("SaveProject", "this.SaveProject", "this.CanSaveProject")] To this: /// <summary>/// The NewProject command/// </summary>private RelayCommand _newProjectCommand;/// <summary>/// Gets the NewProject command./// </summary>/// <value>The NewProject command.</value>public ICommand NewProjectCommand{ get { return this._newProjectCommand ?? (this._newProjectCommand = new RelayCommand(this.ExecuteNewProjectWrap)); }}/// <summary>/// delegate for invoking NewProjectCommand/// </summary>private void ExecuteNewProjectWrap(object obj){ ExecuteNewProject(obj);}/// <summary>/// Invoked when NewProjectCommand invokes/// </summary>partial void ExecuteNewProject(object obj);/// <summary>/// The OpenProject command/// </summary>private RelayCommand _openProjectCommand;/// <summary>/// Gets the OpenProject command./// </summary>/// <value>The OpenProject command.</value>public ICommand OpenProjectCommand{ get { return this._openProjectCommand ?? (this._openProjectCommand = new RelayCommand(this.NewProject)); }}/// <summary>/// The SaveProject command/// </summary>private RelayCommand _saveProjectCommand;/// <summary>/// Gets the SaveProject command./// </summary>/// <value>The SaveProject command.</value>public ICommand SaveProjectCommand{ get { return this._saveProjectCommand ?? (this._saveProjectCommand = new RelayCommand(this.SaveProject, this.CanSaveProject)); }} Dependency PropertyTurn this: [AutoGenDP("WireInfo", typeof(string), "null")][AutoGenDP("WireInfo2", typeof(Wire), "new Wire()")] To this: /// <summary>/// Gets / sets the WireInfo property value, This is a dependency property/// </summary>public string WireInfo{ get { return (string)GetValue(WireInfoProperty); } set { SetValue(WireInfoProperty, value); }}/// <summary>/// Defines the WireInfo dependnecy property./// </summary>public static readonly System.Windows.DependencyProperty WireInfoProperty = System.Windows.DependencyProperty.Register("WireInfo", typeof(string), typeof(WireBaseViewModel), new System.Windows.PropertyMetadata("null", new System.Windows.PropertyChangedCallback(OnWireInfoPropertyChanged)));/// <summary>/// Invoked when the WireInfo property changes/// </summary>partial void OnWireInfoPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e);private static void OnWireInfoPropertyChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e){ WireBaseViewModel control = d as WireBaseViewModel; control.OnWireInfoPropertyChanged(e);}/// <summary>/// Gets / sets the WireInfo2 property value, This is a dependency property/// </summary>public Wire WireInfo2{ get { return (Wire)GetValue(WireInfo2Property); } set { SetValue(WireInfo2Property, value); }}/// <summary>/// Defines the WireInfo2 dependnecy property./// </summary>public static readonly System.Windows.DependencyProperty WireInfo2Property = System.Windows.DependencyProperty.Register("WireInfo2", typeof(Wire), typeof(WireBaseViewModel), new System.Windows.PropertyMetadata(new Wire(), new System.Windows.PropertyChangedCallback(OnWireInfo2PropertyChanged)));/// <summary>/// Invoked when the WireInfo2 property changes/// </summary>partial void OnWireInfo2PropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e);private static void OnWireInfo2PropertyChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e){ WireBaseViewModel control = d as WireBaseViewModel; control.OnWireInfo2PropertyChanged(e);} Notified PropertyTurn this: [AutoGen("WireData", typeof(string), "null")][AutoGen("Visibility", typeof(Visibility), "Visibility.Hidden")] To this: /// <summary>/// Field which backs the WireData property/// </summary>private string _wireData = "null";/// <summary>/// Gets / sets the WireData value/// </summary>public string WireData{ get { return _wireData; } set { if (_wireData == value) return; _wireData = value; OnWireDataChanged(value); OnPropertyChanged("WireData"); }}/// <summary>/// Invoked when the value of WireData changes/// </summary>partial void OnWireDataChanged(string value);/// <summary>/// Field which backs the Visibility property/// </summary>private Visibility _visibility = Visibility.Hidden;/// <summary>/// Gets / sets the Visibility value/// </summary>public Visibility Visibility{ get { return _visibility; } set { if (_visibility == value) return; _visibility = value; OnVisibilityChanged(value); OnPropertyChanged("Visibility"); }}/// <summary>/// Invoked when the value of Visibility changes/// </summary>partial void OnVisibilityChanged(Visibility value); EntityTurn this: [AutoGenEntity("WireData", typeof(string), false)][AutoGenEntity("Visibility", typeof(Visibility), true, "Visibility.Hidden")] To this: public string WireData { get; set; }public Visibility Visibility { get; private set; }public WireBaseViewModel(string wireData, Visibility visibility = Visibility.Hidden){ this.WireData = wireData; this.Visibility = visibility;} ContributingIssues and PR are welcome. Please pass unit tests before raise PR. |