/// <summary>
 /// Отключиться от презентера
 /// </summary>
 public void DetatchFromPresenter()
 {
     lock (this)
     {
         if (Presenter != null)
         {
             Presenter.DisconnectView(this);
             Presenter = null;
         }
     }
 }
        /// <summary>
        /// Подключиться к презентеру
        /// </summary>
        /// <param name="presenter">Презентер</param>
        /// <param name="requiresInitialState">Нужно ли обновление данных с модели для представлния</param>
        public void AttachToPresenter(IShortestPathPresenter presenter, bool requiresInitialState)
        {
            if (presenter == null)
            {
                throw new ArgumentNullException(nameof(presenter));
            }

            DetatchFromPresenter();

            Presenter = presenter;
            Presenter.ConnectView(this, requiresInitialState);
        }
Exemple #3
0
        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);
        }