コード例 #1
0
        public void EditAddressMap()
        {
            SelectedAddressDataWrapper = SelectedAddressDataWrappers.FirstOrDefault();
            var vm = MvvmInstanceExtension.Create <AddressMapEditViewModel>();

            vm.SelectedAddressDataWrapper = Domain.AutoMapper.Mapper.Map <AddressDataWrapper>(SelectedAddressDataWrapper);

            window = new AddressMapEditView
            {
                DataContext = vm,
            };
            var result = window.ShowDialog();

            if (result == true)
            {
                foreach (var item in vm.PropertyChangeds)//변경내용 적용
                {
                    if (item.Value != SelectedAddressDataWrapper.GetPropertyValue(item.Key))
                    {
                        SelectedAddressDataWrapper.State = State.Update;
                        SelectedAddressDataWrapper.SetPropertyValue(item.Key, item.Value);
                    }
                }
                //if (vm.SelectedAddressDataWrapper.State == State.Update)
                //{
                //    SelectedAddressDataWrapper = vm.SelectedAddressDataWrapper;
                //}
            }
        }
コード例 #2
0
        public void AddAddressMap()
        {
            SelectedAddressDataWrapper = SelectedAddressDataWrappers.FirstOrDefault();
            var vm = MvvmInstanceExtension.Create <AddressMapEditViewModel>();

            vm.SelectedAddressDataWrapper = new AddressDataWrapper()
            {
                State = State.Insert
            };

            window = new AddressMapEditView
            {
                DataContext = vm,
            };
            window.ShowDialog();
        }