private void AddPerson(object o)
        {
            try
            {
                ListCollectionView lcv = GetIt <ListCollectionView>(PROP_NAME);

                if (TryGetViewManager(PROP_NAME, out IManageCViews cViewManager))
                {
                    PersonVM newPerson = (PersonVM)cViewManager.GetNewItem();
                    lcv.AddNewItem(newPerson);
                    lcv.MoveCurrentTo(newPerson);
                }

                //if (TryGetViewManager("Business", typeof(PersonDAL), out IManageCViews cViewManager))
                //{
                //    PersonVM newPerson = (PersonVM) cViewManager.GetNewItem();
                //    lcv.AddNewItem(newPerson);
                //    lcv.MoveCurrentTo(newPerson);
                //}
                //else
                //{
                //    System.Diagnostics.Debug.WriteLine($"Could not get the view manager -- Fix this message.");
                //}
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
            }
        }
Exemple #2
0
        // This constructor is required for AutoMapperSupport when using "Emit_Proxy."
        // TODO: Consider having DRM.PropBag.TypeWrapper.SimpleWrapperTypeEmitter create this
        // constructor if one was not declared.
        public PersonVM(PersonVM copySource)
            : base(copySource)
        {
            //PropBagTypeDescriptionProvider<PersonVM> tdp = RegisterTypeDescriptorProvider<PersonVM>(_propModel);
            //_propModel.TypeDescriptionProvider = tdp;

            //TypeDescriptor.AddProvider(tdp, this);
            //System.Diagnostics.Debug.WriteLine("PersonVM is being created from an existing instance of a PersonVM.");
        }
        private void DeletePerson(object o)
        {
            ListCollectionView lcv = GetIt <ListCollectionView>(PROP_NAME);

            PersonVM selectedPerson = (PersonVM)lcv.CurrentItem;

            if (selectedPerson == null)
            {
                return;
            }

            lcv.MoveCurrentToNext();

            lcv.Remove(selectedPerson);
            ShowMessage("Selected Person has been removed!");

            //ShowMessage("This is a test.");
        }