예제 #1
0
 /// <summary>
 /// Разорвать связь между текущим презентером и представлением
 /// </summary>
 public void DetatchFromPresenter()
 {
     lock (this)
     {
         if (Presenter != null)
         {
             Presenter.DisconnectView(this);
             Presenter = null;
         }
     }
 }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
 public void SetPresenter(IGraphPresenter presenter)
 {
     _presenter = presenter;
 }