Beispiel #1
0
        private void RunBuntton_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (_dGraph == null) //|| _dGraph.Vertices.Any(v => v.Visited))
            {
                MessageBox.Show("Загрузите новый лабиринт!", "Warning", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }
            //запускаем параллельно все наши алгоритмы
            if (dijkstraButton.Down)
            {
                Task.Run(() => DijkstraAlgorithm.Execute(_dGraph, dijkstraPanel, dijkstraFirst, dijkstraBest));
                return;
            }

            if (bfsButton.Down)
            {
                Task.Run(() => BreadthFirst.Execute(_bGraph, bFirstPanel, bfFirst, bfBest));
                return;
            }

            if (astarButton.Down)
            {
                Task.Run(() => AStar.Execute(_aGraph, aStarPanel, asFirst, asBest));
                return;
            }
            Task.Run(() => DijkstraAlgorithm.Execute(_dGraph, dijkstraPanel, dijkstraFirst, dijkstraBest));
            Task.Run(() => BreadthFirst.Execute(_bGraph, bFirstPanel, bfFirst, bfBest));
            Task.Run(() => AStar.Execute(_aGraph, aStarPanel, asFirst, asBest));
        }