Exemplo n.º 1
0
        /// <summary>
        /// Attach the view to the model.
        /// </summary>
        /// <param name="model">The initial water model</param>
        /// <param name="view">The initial water view</param>
        /// <param name="explorerPresenter">The parent explorer presenter</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.initialWater = model as InitialWater;
            this.initialWaterView = view as IInitialWaterView;
            this.explorerPresenter = explorerPresenter as ExplorerPresenter;

            this.initialWaterView.RelativeToCrops = this.initialWater.RelativeToCrops;
            this.ConnectViewEvents();
            this.PopulateView();

            this.explorerPresenter.CommandHistory.ModelChanged += OnModelChanged;

            // Populate the graph.
            this.graph = Utility.Graph.CreateGraphFromResource(model.GetType().Name + "Graph");
            this.initialWater.Parent.Children.Add(this.graph);
            this.graph.Parent = this.initialWater.Parent;
            this.graphPresenter = new GraphPresenter();
            this.graphPresenter.Attach(this.graph, this.initialWaterView.Graph, this.explorerPresenter);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Attach the view to the model.
        /// </summary>
        /// <param name="model">The initial water model</param>
        /// <param name="view">The initial water view</param>
        /// <param name="explorerPresenter">The parent explorer presenter</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.initialWater      = model as InitialWater;
            this.initialWaterView  = view as IInitialWaterView;
            this.explorerPresenter = explorerPresenter as ExplorerPresenter;

            this.initialWaterView.RelativeToCrops = this.initialWater.RelativeToCrops;
            this.ConnectViewEvents();
            this.PopulateView();

            this.explorerPresenter.CommandHistory.ModelChanged += OnModelChanged;

            // Populate the graph.
            this.graph = Utility.Graph.CreateGraphFromResource(model.GetType().Name + "Graph");
            this.initialWater.Parent.Children.Add(this.graph);
            this.graph.Parent   = this.initialWater.Parent;
            this.graphPresenter = new GraphPresenter();
            this.graphPresenter.Attach(this.graph, this.initialWaterView.Graph, this.explorerPresenter);
        }