Esempio n. 1
0
        protected override ObservableCollection <ICommandViewModel> CreateCommands()
        {
            var cmds = base.CreateCommands();

            if (AllowAddExisting)
            {
                cmds.Add(AddExistingCommand);
            }
            if (AllowAddNew)
            {
                cmds.Add(CreateNewCommand);
            }
            if (AllowRemove)
            {
                cmds.Add(RemoveCommand);
            }
            if (AllowDelete)
            {
                cmds.Add(DeleteCommand);
            }

            if (ObjectCollectionModel.RelEnd != null && ObjectCollectionModel is BasePropertyValueModel)
            {
                var obj       = (IDataObject)((BasePropertyValueModel)ObjectCollectionModel).Object;
                var navigator = ObjectCollectionModel.RelEnd.Navigator;
                ObjectReferenceHelper.AddActionViewModels(cmds, obj, navigator.Methods, this, ViewModelFactory);
            }

            return(cmds);
        }
Esempio n. 2
0
        protected override ObservableCollection <ICommandViewModel> CreateCommands()
        {
            var cmds = base.CreateCommands();

            cmds.Add(SelectValueCommand);
            cmds.Add(CreateNewItemAndSetValueCommand);
            cmds.Add(OpenReferenceCommand);
            cmds.Add(ClearValueCommand);

            if (ObjectReferenceModel.RelEnd != null && ObjectReferenceModel is BasePropertyValueModel)
            {
                var obj       = (IDataObject)((BasePropertyValueModel)ObjectReferenceModel).Object;
                var navigator = ObjectReferenceModel.RelEnd.Navigator;
                ObjectReferenceHelper.AddActionViewModels(cmds, obj, navigator.Methods, this, ViewModelFactory);
            }

            return(cmds);
        }