protected void SetActiveView(IEnumerable <VisibleViewModelBase> views, VisibleViewModelBase wm)
        {
            ICollectionView collectionView = CollectionViewSource.GetDefaultView(views);

            if (collectionView != null && collectionView.Contains(wm))
            {
                collectionView.MoveCurrentTo(wm);
            }
        }
示例#2
0
        public void PublishViewModel(TModel model)
        {
            VisibleViewModelBase wm = InternalCreateNewViewModel(model);

            if (wm != null)
            {
                OpenViewModels.Add(wm as EntityViewModelBase <TModel>);
            }
            wm.PublishEvent(EventTopicNames.ViewAdded);
        }
示例#3
0
        protected override void OnDuplicateItem(object obj)
        {
            var duplicate = ObjectCloner.EntityClone(SelectedItem.Model);

            duplicate.Id = 0;
            EntityIdFixer.FixEntityIdNumber(duplicate, x => 0);
            duplicate.Name = "_" + duplicate.Name;
            VisibleViewModelBase wm = InternalCreateNewViewModel(duplicate);

            if (wm != null)
            {
                OpenViewModels.Add(wm as EntityViewModelBase <TModel>);
            }
            wm.PublishEvent(EventTopicNames.ViewAdded);
        }