Exemple #1
0
 public IActionResult StoreTypesTest(SerializationViewModel model)
 {
     if (ModelState.IsValid)
     {
     }
     return(View(model));
 }
Exemple #2
0
        /// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        public ModelContextViewModel(ViewModelStore viewModelStore, BaseModelContext baseModelContext, bool isLocked)
            : base(viewModelStore)
        {
            this.modelContext = baseModelContext;

            this.copyCommand              = new DelegateCommand(CopyCommand_Executed, CopyCommand_CanExecute);
            this.pasteCommand             = new DelegateCommand(PasteCommand_Executed, PasteCommand_CanExecute);
            this.copyAllTreeCommand       = new DelegateCommand(CopyAllTreeCommand_Executed, CopyAllTreeCommand_CanExecute);
            this.copyEmbeddingTreeCommand = new DelegateCommand(CopyEmbeddingTreeCommand_Executed, CopyAllTreeCommand_CanExecute);
            this.copyReferenceTreeCommand = new DelegateCommand(CopyReferenceTreeCommand_Executed, CopyAllTreeCommand_CanExecute);
            //this.cutCommand = new DelegateCommand(CutCommand_Executed, CutCommand_CanExecute);
            this.optimizeCommand = new DelegateCommand(OptimizeCommand_Executed);

            if (baseModelContext is ModelContext)
            {
                ModelContext modelContext = baseModelContext as ModelContext;

                this.modelTreeViewModel          = new ModelTreeViewModel(viewModelStore, this, modelContext.ViewContext.DomainModelTreeView);
                this.modelTreeViewModel.IsLocked = isLocked;
                this.diagramViewModel            = new DiagramViewModel(viewModelStore, this, modelContext.ViewContext.DiagramView);
                this.serializationViewModel      = new SerializationViewModel(viewModelStore, modelContext.SerializationModel);

                this.modelContextType = ModelContextViewType.ModelContext;
            }
            else if (baseModelContext is ExternModelContext)
            {
                ExternModelContext modelContext = baseModelContext as ExternModelContext;
                if (modelContext.ModelContext != null)
                {
                    this.AddModelContext(modelContext.ModelContext);
                }

                this.EventManager.GetEvent <ModelElementLinkAddedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(ExternModelContextReferencesModelContext.DomainClassId),
                                                                                    true, this.modelContext.Id, new System.Action <ElementAddedEventArgs>(OnModelContextAdded));
                this.EventManager.GetEvent <ModelElementLinkDeletedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRelationship(ExternModelContextReferencesModelContext.DomainClassId),
                                                                                      true, this.modelContext.Id, new System.Action <ElementDeletedEventArgs>(OnModelContextRemoved));
                this.EventManager.GetEvent <ModelRolePlayerChangedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRole(ExternModelContextReferencesModelContext.ExternModelContextDomainRoleId),
                                                                                     new System.Action <RolePlayerChangedEventArgs>(OnModelContextChanged));
                this.EventManager.GetEvent <ModelRolePlayerChangedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRole(ExternModelContextReferencesModelContext.ModelContextDomainRoleId),
                                                                                     new System.Action <RolePlayerChangedEventArgs>(OnModelContextChanged));

                this.modelContextType = ModelContextViewType.ExternModelContext;
            }
            else if (baseModelContext is LibraryModelContext)
            {
                LibraryModelContext modelContext = baseModelContext as LibraryModelContext;
                this.modelTreeViewModel          = new ModelTreeViewModel(viewModelStore, this, modelContext.ViewContext.DomainModelTreeView);
                this.modelTreeViewModel.IsLocked = isLocked;
                this.diagramViewModel            = new DiagramViewModel(viewModelStore, this, modelContext.ViewContext.DiagramView);
                this.modelContextType            = ModelContextViewType.LibraryContext;
                this.serializationViewModel      = new SerializationViewModel(viewModelStore, modelContext.SerializationModel);
            }

            this.selectedItem = this.ModelTreeViewModel;

            if (this.ModelContext != null)
            {
                this.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(
                    this.Store.DomainDataDirectory.GetDomainProperty(BaseModelContext.NameDomainPropertyId), this.ModelContext.Id, new System.Action <ElementPropertyChangedEventArgs>(NamePropertyChanged));
            }
        }