/// <summary> /// Конструктор /// </summary> /// <param name="model">Модель кратчайщего пути</param> /// <param name="Graph">Модель графа</param> public ShortestPathPresenter(IShortestPathModel model, IGraphModel graph) { m_cModel = model; m_cGraph = graph; m_cModel.OnWeightsUpdate += M_cModel_OnPathUpdated; m_cModel.OnUpdateGraph += M_cModel_OnUpdateGraph; m_cModel.OnBenchmarkTimeUpdate += M_cModel_OnBenchmarkTimeUpdate; }
/// <summary> /// Конструктор /// </summary> /// <param name="model">Модель</param> public GraphPresenter(IGraphModel model, IShortestPathModel shortestPath) { m_cModel = model ?? throw new ArgumentNullException(nameof(model)); m_cShortestPath = shortestPath ?? throw new ArgumentNullException(nameof(shortestPath)); m_cModel.OnUpdateCell += HandleUpdateCell; m_cModel.OnUpdateMatrix += HandleUpdateMatrix; m_cModel.OnRemoveVertex += HandleRemoveVertex; m_cModel.OnAddVertex += HandleAddVertex; m_cModel.OnPathBuilt += HandleBuildPath; }
public MainView() { InitializeComponent(); graph = new GraphModel(4); shortestPath = new ShortestPathModel(); graphPresenter = new GraphPresenter(graph, shortestPath); shortestPathPresenter = new ShortestPathPresenter(shortestPath, graph); algorithmControlView1.AttachToPresenter(shortestPathPresenter, true); shortestPathView1.AttachToPresenter(shortestPathPresenter, true); GraphControlView.AttachToPresenter(graphPresenter, true); GraphMatrixView.AttachToPresenter(graphPresenter, true); graphLogicalView1.AttachToPresenter(graphPresenter, true); }