public static void AssembleSelectableRemovableBusinessGroup() { ITypeConfig typeConfig = Core.FindOrCreateTypeConfig <ISelectableRemovableBusinessGroup, ISelectableRemovableBusinessGroupWrapper>(); typeConfig.SetInit <SingleSelectionObservableCollection <ISelectableRemovablePerson> >(nameof(IBusinessGroup.People)); typeConfig.SetEventArgThisIdx(nameof(INotifyPropertyChanged.PropertyChanged), 0); typeConfig.SetThisMemberMap ( nameof(ISelectableRemovableBusinessGroupWrapper.TheParentChildSelectionBehavior), nameof(ParentChildSelectionBehavior <ISelectableRemovableBusinessGroup, ISelectableRemovablePerson> .Parent) ); typeConfig.SetMemberMap ( nameof(ISelectableRemovableBusinessGroupWrapper.TheParentChildSelectionBehavior), nameof(ParentChildSelectionBehavior <ISelectableRemovableBusinessGroup, ISelectableRemovablePerson> .Children), nameof(IBusinessGroup.People) ); typeConfig.SetMemberMap ( nameof(ISelectableRemovableBusinessGroupWrapper.TheRemovableCollectionBehavior), nameof(RemovableCollectionBehavior.TheCollection), nameof(IBusinessGroup.People) ); typeConfig.ConfigurationCompleted(); }
public static void RunTest() { Core.SetSaveOnErrorPath("GeneratedCode"); ITypeConfig typeConfig = Core.FindOrCreateTypeConfig <ISelectableData, SelectableWrapperInterface>(); typeConfig.SetEventArgThisIdx(nameof(ISelectableData.IsSelectedChanged), 0); typeConfig.ConfigurationCompleted(); ISelectableData myInterfaceObj = typeConfig.CreateInstanceOfType <ISelectableData>(); myInterfaceObj.FirstName = "Nick"; myInterfaceObj.LastName = "Polyak"; bool isSelectedChanged = false; myInterfaceObj.IsSelectedChanged += (selectableItem) => { isSelectedChanged = true; }; myInterfaceObj.IsSelected = true; Assert.Equal("Nick", myInterfaceObj.FirstName); Assert.Equal("Polyak", myInterfaceObj.LastName); Assert.True(isSelectedChanged); }
public static void AssembleSelectableRemovablePerson() { ITypeConfig typeConfig = Core.FindOrCreateTypeConfig <ISelectableRemovablePerson, PersonDataVM, ISelectableRemovablePersonWrapper>(); typeConfig.SetEventArgThisIdx(nameof(INotifyPropertyChanged.PropertyChanged), 0); typeConfig.ConfigurationCompleted(); }
static void Main(string[] args) { ITypeConfig typeConfig = Core.FindOrCreateTypeConfig <ISelectableData, MyData, WrapperInterface>(); typeConfig.SetEventArgThisIdx(nameof(ISelectableData.IsSelectedChanged), 0); typeConfig.ConfigurationCompleted(); ISelectableData myInterfaceObj = Core.GetInstanceOfGeneratedType <ISelectableData>(typeConfig.ClassName) as ISelectableData; myInterfaceObj.FirstName = "Nick"; myInterfaceObj.LastName = "Polyak"; myInterfaceObj.IsSelectedChanged += MyInterfaceObj_IsSelectedChanged; myInterfaceObj.IsSelected = true; }
static void Main(string[] args) { ITypeConfig removableTypeConfig = Core.FindOrCreateTypeConfig <IRemovableData, NoClass, IRemovableWrapper>(); string className = removableTypeConfig.ClassName; removableTypeConfig.SetEventArgThisIdx(nameof(IRemovableData.RemoveEvent), 0); removableTypeConfig.ConfigurationCompleted(); IRemovableData removableObj1 = Core.GetInstanceOfGeneratedType <IRemovableData>(); removableObj1.FirstName = "Joe"; removableObj1.LastName = "Doe"; IRemovableData removableObj2 = Core.GetInstanceOfGeneratedType <IRemovableData>(); removableObj2.FirstName = "Jane"; removableObj2.LastName = "Dane"; #region Using removableCollectionBehavior on top of the collection ObservableCollection <IRemovableData> collectionWithRemovabledItems = new ObservableCollection <IRemovableData>(); collectionWithRemovabledItems.Add(removableObj1); collectionWithRemovabledItems.Add(removableObj2); RemovableCollectionBehavior removableCollectionBehavior = new RemovableCollectionBehavior(); removableCollectionBehavior.TheCollection = collectionWithRemovabledItems; removableObj1.Remove(); removableObj2.Remove(); #endregion Using removableCollectionBehavior on top of the collection #region dynamically creating an observable collection class with removableCollectionBehavior inside ITypeConfig <NoInterface, ObservableCollection <IRemovableData>, IRemovableBehaviorCollectionWrapper> collectionTypeConfig = Core.FindOrCreateTypeConfig <NoInterface, ObservableCollection <IRemovableData>, IRemovableBehaviorCollectionWrapper>("CollectionWithRemovableBehavior"); collectionTypeConfig.UnInitAction = (intrfc, superClass, collWrapper) => { collWrapper.TheRemovableCollectionBehavior.TheCollection = null; }; collectionTypeConfig.InitAction = (intrfc, superClass, collWrapper) => { collWrapper.TheRemovableCollectionBehavior.TheCollection = superClass; }; collectionTypeConfig.ConfigurationCompleted(); ObservableCollection <IRemovableData> collection = Core.GetInstanceOfGeneratedType <ObservableCollection <IRemovableData> >(); collection.Add(removableObj1); collection.Add(removableObj2); removableObj1.Remove(); #endregion dynamically creating an observable collection class with removableCollectionBehavior inside }