예제 #1
0
        private void ButtonExit_Click(object sender, RoutedEventArgs e)
        {
            var propDict = typeof(AddCustomer).GetProperties().ToDictionary(p => p.Name, p => p);
            //var test = typeof(AddCustomer).BuildDynamicTypeWithProperties(propDict);
            //var testInstance = Activator.CreateInstance(test);
            var customer = new AddCustomer()
            {
                ID        = Guid.NewGuid(),
                Firstname = "testt",
                Lastname  = "testt"
            };
            var wrapped = customer.Wrap();
            var test    = wrapped["ID"];

            wrapped["ID"] = Guid.NewGuid();

            Console.WriteLine(test);
            //dynamic expando = new expandable<AddCustomer>(ref customer);
            //expando.Firstname = "test13";
            //var t = expando.Firstname;
            //foreach (var item in expando.GetType().GetProperties())
            //{
            //    Console.WriteLine(item.Name);
            //}
            //foreach (var property in test.GetProperties())
            //{
            //    property.SetValue(testInstance, typeof(AddCustomer).GetProperty(property.Name).GetValue(customer));
            //}
            //var observable = new ObservableObject<AddCustomer>(customer);
            //var results = _mediator.Send<AddCustomer, object>(customer);

            //Application.Current.Shutdown();
        }