CodeEmitter CreateEmitter() { CodeEmitter codeEmitter = new CodeEmitter(); codeEmitter.Namespace = m_Config.NameSpace; codeEmitter.AddUsing("System"); codeEmitter.AddUsing("System.Collections"); codeEmitter.AddUsing("System.Collections.Generic"); codeEmitter.AddUsing("ILib.MVVM"); ClassEmitter classEmitter = codeEmitter.AddClass(); classEmitter.Accessibility = "public partial"; classEmitter.Name = m_Name + m_Config.NameSuffix; classEmitter.Extends.Add("ViewModelBase"); m_View.Prepare(true); HashSet <string> path = new HashSet <string>(); List <IViewElement> elements = new List <IViewElement>(); m_View.GetElements(elements); foreach (var elm in elements) { if (elm is EventButton) { continue; } var bindable = elm as IBindable; if (bindable != null && path.Add(bindable.Path)) { if (m_Config.ReactivePropertyMode) { ReactivePropertyEmit(bindable, classEmitter.Members); } else { PropertyEmit(bindable, classEmitter.Members); } } var viewEvent = elm as IViewEvent; if (viewEvent != null) { if (m_Config.CommandMode) { CommandEmit(viewEvent, classEmitter.Members); } else { EventEmit(viewEvent, classEmitter.Members); } } } return(codeEmitter); }