Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            // map IPersonDataVM interface into the IPersonDataWrapper interface
            // that defines how to implement it
            Core.SetWrapperType <IPersonDataVM, IPersonDataWrapper>();

            // map ISelectableItem interface into the ISelectableItemWrapper interface
            // that defines how to implement it
            Core.SetWrapperType(typeof(ISelectableItem <>), typeof(ISelectableItemWrapper <>));

            // create the instance of a class that implements ISelectablePersonVM
            // using automatic wrapper mappings defined above
            ISelectablePersonVM personVM =
                Core.CreateInstanceOfGeneratedType <ISelectablePersonVM>();

            personVM.FirstName = "Joe";
            personVM.LastName  = "Doe";

            // make sure that FullName is "Joe Doe"
            Console.WriteLine($"FullName is '{personVM.FullName}'");

            // make sure that the IsSelectedChanged event fires.
            personVM.IsSelectedChanged += PersonVM_IsSelectedChanged;

            // when IsSelected changes.
            personVM.IsSelected = true;
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // add NP.Utilities assembly
            Core.AddTypeAssemblyStatic <ISelectableItem <ISelectablePersonVM> > ();
            // add this (NP.Roxy.DefaultWrappersWithAttrsTest) assembly
            Core.AddTypeAssemblyStatic <ISelectablePersonVM>();

            // create the instance of a class that implements ISelectablePersonVM
            // using automatic wrapper mappings defined above
            ISelectablePersonVM personVM =
                Core.CreateInstanceOfGeneratedType <ISelectablePersonVM>();

            personVM.FirstName = "Joe";
            personVM.LastName  = "Doe";

            // make sure that FullName is "Joe Doe"
            Console.WriteLine($"FullName is '{personVM.FullName}'");

            // make sure that the IsSelectedChanged event fires.
            personVM.IsSelectedChanged += PersonVM_IsSelectedChanged;

            // when IsSelected changes.
            personVM.IsSelected = true;
        }