public static void LoadDetailedXml(DesignerViewer LibnoiseDesigner) { Stream detailedXml = EmbeddedResourceUtils.GetEmbeddedResourceStream("WorldForge.Resources.detailed.xml"); XmlDocument doc = new XmlDocument(); doc.Load(detailedXml); LoadLibnoiseXml(doc, LibnoiseDesigner); }
public static void LoadLibnoiseXml(XmlDocument doc, DesignerViewer LibnoiseDesigner) { XmlNodeList moduleList = doc.GetElementsByTagName("Module"); List<LoadedModule> loadedModules = GetModules(moduleList); LibnoiseDesigner.ViewModel.DeleteAllNodes(); //loop through modules, create nodes foreach (LoadedModule lm in loadedModules) { NodeViewModel node = LibnoiseDesigner.ViewModel.CreateNode(lm.Module, lm.Location, false); node.Module.ID = lm.ID; } foreach (LoadedModule lm in loadedModules) { int count = 0; NodeViewModel destinationNodeModel = LibnoiseDesigner.ViewModel.Network.Nodes.First(n => n.Module.ID.Equals(lm.ID)); foreach (string link in lm.Links) { NodeViewModel sourceNodeModel = LibnoiseDesigner.ViewModel.Network.Nodes.First(n => n.Module.ID.Equals(link)); ConnectionViewModel cvm = new ConnectionViewModel(); cvm.DestConnector = destinationNodeModel.InputConnectors[count]; cvm.SourceConnector = sourceNodeModel.OutputConnectors[0]; // only ever one output connector in our Libnoise model LibnoiseNode sourceNode = sourceNodeModel.Module; LibnoiseNode destinationNode = destinationNodeModel.Module; ModuleBase sourceModule = sourceNode.LibnoiseModule; ModuleBase destinationModule = destinationNode.LibnoiseModule; destinationModule.Modules[count] = sourceModule; destinationNode.Inputs[count] = sourceNode; LibnoiseDesigner.ViewModel.Network.Connections.Add(cvm); count++; } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MainMenu = ((System.Windows.Controls.Menu)(target)); return; case 2: this.FileMenu = ((System.Windows.Controls.MenuItem)(target)); return; case 3: #line 16 "..\..\MainAppWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.NewItem_Click); #line default #line hidden return; case 4: #line 18 "..\..\MainAppWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.LibnoiseSimpleItem_Click); #line default #line hidden return; case 5: #line 19 "..\..\MainAppWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.LibnoiseDetailedItem_Click); #line default #line hidden return; case 6: #line 21 "..\..\MainAppWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveLibnoise_Click); #line default #line hidden return; case 7: #line 22 "..\..\MainAppWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.LoadLibnoiseItem_Click); #line default #line hidden return; case 8: #line 24 "..\..\MainAppWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ExportClassItem_Click); #line default #line hidden return; case 9: #line 25 "..\..\MainAppWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ExportImage_Click); #line default #line hidden return; case 10: #line 27 "..\..\MainAppWindow.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ExitItem_Click); #line default #line hidden return; case 11: this.DesignerViewer = ((WorldForge.LibnoiseDesigner.Viewer.DesignerViewer)(target)); return; } this._contentLoaded = true; }