private void RemoveDetailViewModel(int id, string viewModelName) { var detailViewModel = DetailViewModels.SingleOrDefault(vm => vm.Id == id && vm.GetType().Name == viewModelName); if (detailViewModel != null) { DetailViewModels.Remove(detailViewModel); } }
private void RemoveDetailMethod(int id, string viewModelName) { var detailsViewModel = DetailViewModels .SingleOrDefault(e => e.Id == id && e.GetType().Name == viewModelName); if (detailsViewModel != null) { DetailViewModels.Remove(detailsViewModel); } }
private void AfterDetailDeleted(AfterDetailDeletedEventArgs args) { var detailViewModel = DetailViewModels .SingleOrDefault(vm => vm.Id == args.Id && vm.GetType().Name == args.ViewModelName); if (detailViewModel != null) { DetailViewModels.Remove(detailViewModel); } }
private void RemoveDetailViewModel(int id, string viewModelName) { Int64 startTicks = Log.VIEWMODEL("Enter", Common.LOG_CATEGORY); var detailViewModel = DetailViewModels .SingleOrDefault(vm => vm.Id == id && vm.GetType().Name == viewModelName); if (detailViewModel != null) { DetailViewModels.Remove(detailViewModel); } Log.VIEWMODEL("Exit", Common.LOG_CATEGORY, startTicks); }
/** * RemoveDetailViewModel : Notic this method just remove the detailViewModel from DetailViewModels collection * not the entity[Db] it self : * So we shared it with AfterDetailDeleted/AfterDetailClosed because either entity deleted * or user decide to close this detailWindow we need to do the same behaviour : just close the window */ private void RemoveDetailViewModel(int id, string viewModelName) { /** * Get the desired detailViewModel by it's id and viewModelName * Because if we used just id may be the entites from different tables has the same id * but this is impossible with thee entities at the same table * and we use separate viewModel for very single table * so we need to query with viewModelName */ var detailViewModel = DetailViewModels .SingleOrDefault(vm => vm.Id == id && vm.GetType().Name == viewModelName); if (detailViewModel != null) { DetailViewModels.Remove(detailViewModel); } }