/// <summary>Loads meta model from XML.</summary> public static MetaModel LoadFromXml(XElement xml) { string name = xml.Attribute("name").Value; string desc = xml.Attribute("description").Value; MetaModel model = new MetaModel(name, desc); XElement xPackages = xml.Element("Packages"); if (xPackages != null) { foreach (XElement xPackage in xPackages.Elements("Package")) { MetaPackage package = MetaPackage.LoadFromXml(xPackage); if (package != null) { model.Packages.Add(package); } } } return model; }
/// <summary>Handles load model button click event.</summary> private void _onLoadModel(object sender, RoutedEventArgs e) { try { // Open model file and update model tree string[] filters = { "xml files (*.xml)|*.xml" }; string path = FileDialogs.ChooseFileToOpen(Shell.UserDataFolder, "Choose model file to load", filters); if (string.IsNullOrEmpty(path)) return; this.modelPath = path; this.TxtModelPath.Text = this.modelPath; this.TxtModelPath.Visibility = Visibility.Visible; XElement element = XElement.Load(this.modelPath); this.metaModel = MetaModel.LoadFromXml(element); this.MetaModelControl.MetaModel = this.metaModel; _updateView(); } catch (Exception) { } }
public XmiBplGenerator() { this.metaModel = new MetaModel("BPL", "BPL Meta Model"); }