Esempio n. 1
0
        private void LoadModelDataHelper()
        {
            try{
                DocData = new VModellXTDocumentData();

                VModellXTViewModelStore vStore;
                if (this.WelcomeViewModel != null)
                {
                    vStore = new VModellXTViewModelStore(DocData, WelcomeViewModel.Options);
                }
                else
                {
                    vStore = new VModellXTViewModelStore(DocData);
                }

                MainViewModel = new VModellXTMainViewModel(vStore);

                this.LoadPlugins();
            }
            catch {}
            finally
            {
                viewModelInitializedEvent.Set();
            }
        }
        /// <summary>
        /// Loads the model from the given file path and sets it to its appropriate element.
        /// </summary>
        /// <param name="filePath">File path to load the model from. Can be null to indicate that there is no referenced domain model.</param>
        protected override void SetReferencedModel(string filePath)
        {
            using (new Tum.PDE.ToolFramework.Modeling.Visualization.ViewModel.UI.WaitCursor())
            {
                global::Tum.VModellXT.Musterbibliothek model = this.Elements[0] as global::Tum.VModellXT.Musterbibliothek;
                string file = filePath;

                DslEditorModeling::IParentModelElement parent = model.GetDomainModelServices().ElementParentProvider.GetParentModelElement(model);
                if (parent == null)
                {
                    throw new System.ArgumentNullException("Parent of element " + model.ToString() + " can not be null");
                }

                string path             = parent.DomainFilePath;
                string vModellDirectory = new System.IO.FileInfo(path).DirectoryName;
                //string curPath = Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions.Path.PathHelper.EvaluateRelativePath(
                //	vModellDirectory, file);

                // load model
                try
                {
                    if (!System.IO.File.Exists(file))
                    {
                        System.IO.FileStream s = System.IO.File.Create(file);
                        s.Close();
                    }

                    using (DslModeling::Transaction transaction = this.Store.TransactionManager.BeginTransaction("Set referenced model"))
                    {
                        global::Tum.VModellXT.VModellXTDocumentData data = this.ViewModelStore.ModelData as global::Tum.VModellXT.VModellXTDocumentData;
                        global::Tum.VModellXT.VModell referenceModel     = data.ModelContextVModellXT.LoadInternal(file) as  global::Tum.VModellXT.VModell;
                        model.VModell = referenceModel;

                        transaction.Commit();
                    }
                }
                catch (System.Exception ex)
                {
                    DslEditorViewModelServices::IMessageBoxService messageBox = this.GlobalServiceProvider.Resolve <DslEditorViewModelServices::IMessageBoxService>();
                    messageBox.ShowError(ex.Message);
                }

                this.ModelData.FlushUndoRedoStacks();
            }
        }
Esempio n. 3
0
		private void LoadModelDataHelper()
		{
			try{
				DocData = new VModellXTDocumentData();
				
				VModellXTViewModelStore vStore;
				if( this.WelcomeViewModel != null )
					vStore = new VModellXTViewModelStore(DocData, WelcomeViewModel.Options);
				else
					vStore = new VModellXTViewModelStore(DocData);
				
	         	MainViewModel = new VModellXTMainViewModel(vStore);
				
                this.LoadPlugins();
			}
			catch{}
			finally
			{
				viewModelInitializedEvent.Set();
			} 	
		}