public void GraphCollectionBasic3()
        {
            GraphCollection collection = new GraphCollection();
            Graph           g          = new Graph();

            collection.Add(g, true);

            Assert.IsTrue(collection.Contains(g.BaseUri));
        }
Пример #2
0
        private void Save()
        {
            int count = GraphCollection.Count;

            if (IdState < GraphCollection.Count)
            {
                for (int i = 0; i < count - IdState; i++)
                {
                    GraphCollection.Remove(GraphCollection.Last());
                }
            }
            IdState++;
            GraphCollection.Add(new Graph
            {
                Vertexes = new ObservableCollection <Vertex>(),
                Edges    = new ObservableCollection <Edge>()
            });
            foreach (var v in Graph.Vertexes)
            {
                GraphCollection.Last().Vertexes.Add(new Vertex
                {
                    IsMouseRightButtonDown = v.IsMouseRightButtonDown,
                    IsMouseLeftButtonDown  = v.IsMouseLeftButtonDown,

                    IdVertex          = v.IdVertex,
                    Position          = v.Position,
                    Path              = v.Path,
                    Margin            = v.Margin,
                    ConnectedVertexes = new List <Vertex>(),
                    ConnectedEdges    = new List <Edge>()
                });
                foreach (var conver in v.ConnectedVertexes)
                {
                    GraphCollection.Last().Vertexes.Last().ConnectedVertexes.Add(new Vertex
                    {
                        IsMouseRightButtonDown = conver.IsMouseRightButtonDown,
                        IsMouseLeftButtonDown  = conver.IsMouseLeftButtonDown,
                        IdVertex = conver.IdVertex,
                        Position = conver.Position,
                        Path     = conver.Path,
                        Margin   = conver.Margin
                    });
                }
                foreach (var coned in v.ConnectedEdges)
                {
                    GraphCollection.Last().Edges.Add(new Edge
                    {
                        StartPoint            = coned.StartPoint,
                        EndPoint              = coned.EndPoint,
                        EndVertexId           = coned.EndVertexId,
                        IdEdge                = coned.IdEdge,
                        IsMouseLeftButtonDown = coned.IsMouseLeftButtonDown,
                        StartVertexId         = coned.StartVertexId
                    });
                }
            }
        }
Пример #3
0
        private void OpenWindowRandom(object obj)
        {
            Graph = new Graph();
            RandomWindowViewModel randomViewModel = new RandomWindowViewModel(Graph, 400, 400);
            var winRandom = new RandomWindow(randomViewModel);

            randomViewModel.Window = winRandom;
            winRandom.ShowDialog();
            if (randomViewModel.ReadTo)
            {
                GraphCollection.Add(Graph);
                AddToObjectCompositeCollection();
            }
        }
Пример #4
0
        private void OpenWindowLoadGraph(object obj)
        {
            Graph = new Graph();
            LoadGraphViewModel loadGraphViewModel = new LoadGraphViewModel(Graph);
            var winLoad = new LoadGraphWindow(loadGraphViewModel);

            loadGraphViewModel.Window = winLoad;
            winLoad.ShowDialog();
            if (loadGraphViewModel.ReadTo)
            {
                GraphCollection.Add(Graph);
                AddToObjectCompositeCollection();
            }
        }
Пример #5
0
        private void OpenWindowPrufer(object obj)
        {
            Graph = new Graph();
            PruferWindowViewModel pruferViewModel = new PruferWindowViewModel(Graph, 400, 400);
            var winPrufer = new PruferWindow(pruferViewModel);

            pruferViewModel.Window = winPrufer;
            winPrufer.ShowDialog();

            if (pruferViewModel.ReadTo)
            {
                GraphCollection.Add(Graph);
                AddToObjectCompositeCollection();
            }
        }
Пример #6
0
 private void CleanScreen(object obj)
 {
     Graph = new Graph();
     GraphCollection.Add(Graph);
     AddToObjectCompositeCollection();
 }