Ejemplo n.º 1
0
 /// <summary>
 /// Разорвать связь между текущим презентером и представлением
 /// </summary>
 public void DetatchFromPresenter()
 {
     lock (this)
     {
         if (Presenter != null)
         {
             Presenter.DisconnectView(this);
             Presenter = null;
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Связать представление с презентером
        /// </summary>
        /// <param name="presenter">Презентер</param>
        /// <param name="requiresInitialState">Нужна ли инициализация представления ?</param>
        public void AttachToPresenter(IGraphPresenter presenter, bool requiresInitialState)
        {
            if (presenter == null)
            {
                throw new ArgumentNullException(nameof(presenter));
            }

            DetatchFromPresenter();

            Presenter = presenter;
            Presenter.ConnectView(this, requiresInitialState);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public void SetPresenter(IGraphPresenter presenter)
 {
     _presenter = presenter;
 }