Beispiel #1
0
        /// <summary>
        /// Attaches the model to the view.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="view">The view.</param>
        /// <param name="explorerPresenter">The explorer presenter.</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.view      = view as IGraphPanelView;
            this.panel     = model as GraphPanel;
            this.presenter = explorerPresenter;
            graphs         = new List <GraphTab>();

            if (this.view == null || this.panel == null || this.presenter == null)
            {
                throw new ArgumentException();
            }

            presenter.CommandHistory.ModelChanged += OnModelChanged;
            this.view.GraphViewCreated            += ModifyGraphView;

            properties = new PropertyPresenter();
            properties.Attach(panel, this.view.PropertiesView, presenter);

            processingThread                            = new BackgroundWorker();
            processingThread.DoWork                    += WorkerThread;
            processingThread.RunWorkerCompleted        += OnProcessingFinished;
            processingThread.WorkerSupportsCancellation = true;

            processingThread.RunWorkerAsync();
        }
Beispiel #2
0
        /// <summary>
        /// Attaches the model to the view.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="view">The view.</param>
        /// <param name="explorerPresenter">The explorer presenter.</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.view      = view as IGraphPanelView;
            this.panel     = model as GraphPanel;
            this.presenter = explorerPresenter;
            graphs         = new List <GraphTab>();

            if (this.view == null || this.panel == null || this.presenter == null)
            {
                throw new ArgumentException();
            }

            presenter.CommandHistory.ModelChanged += OnModelChanged;
            this.view.GraphViewCreated            += ModifyGraphView;

            properties = new PropertyPresenter();
            properties.Attach(panel, this.view.PropertiesView, presenter);

            (processingThread, startTime) = StartWork();
        }