public WareGroupViewModel(IWareGroupModel wareGroupModel, IViewFactory viewFactory) { _wareGroupModel = wareGroupModel; _viewFactory = viewFactory; _rootWareGroups = _wareGroupModel.GetAllRootWareGroups(); _rootedWrappers = new ObservableCollection<WareGroupTreeViewWrapper>( (from root in _rootWareGroups select new WareGroupTreeViewWrapper(root, (o => EditSelected()), (o => CurrentSelectedWareGroup = o)) )); }
public virtual void SetUp(Func<WareGroupTreeViewWrapper>getSelected,IWareGroupModel wareGroupModel) { if (getSelected == null) throw new ArgumentNullException("getSelected"); if (wareGroupModel == null) throw new ArgumentNullException("wareGroupModel"); var waregroup = getSelected(); if (waregroup==null) throw new ArgumentException("Ничего не выбрано"); _wareGroup = waregroup; _parentBeforeSave = _wareGroup.Parent; _getSelected = getSelected; _wareGroupModel = wareGroupModel; }