Example #1
0
        private async void GenerateRandomNodes()
        {
            var nodes = RandomNodesGenerator.GenerateNodes <FlowNodeViewModel>(new NodesGeneratorSettings(Settings.MinNodes)
            {
                MinNodesCount  = Settings.MinNodes,
                MaxNodesCount  = Settings.MaxNodes,
                MinInputCount  = Settings.MinConnectors,
                MaxInputCount  = Settings.MaxConnectors,
                MinOutputCount = Settings.MinConnectors,
                MaxOutputCount = Settings.MaxConnectors,
                GridSnap       = EditorSettings.Instance.GridSpacing
            });

            GraphViewModel.Nodes.Clear();
            await CopyToAsync(nodes, GraphViewModel.Nodes);

            if (Settings.ShouldConnectNodes)
            {
                await ConnectNodes();
            }
        }
Example #2
0
        private async void PerformanceTest()
        {
            uint count    = Settings.PerformanceTestNodes;
            int  distance = 500;
            int  size     = (int)count / (int)Math.Sqrt(count);

            var nodes = RandomNodesGenerator.GenerateNodes <FlowNodeViewModel>(new NodesGeneratorSettings(count)
            {
                NodeLocationGenerator = (s, i) => new System.Windows.Point(i % size * distance, i / size * distance),
                MinInputCount         = Settings.MinConnectors,
                MaxInputCount         = Settings.MaxConnectors,
                MinOutputCount        = Settings.MinConnectors,
                MaxOutputCount        = Settings.MaxConnectors,
                GridSnap = EditorSettings.Instance.GridSpacing
            });

            GraphViewModel.Nodes.Clear();
            await CopyToAsync(nodes, GraphViewModel.Nodes);

            if (Settings.ShouldConnectNodes)
            {
                await ConnectNodes();
            }
        }