Esempio n. 1
0
        /// <summary>Attach the model to the view.</summary>
        /// <param name="model">The model.</param>
        /// <param name="view">The view.</param>
        /// <param name="parentPresenter">The explorer presenter.</param>
        public void Attach(object modelObject, object viewObject, ExplorerPresenter parentPresenter)
        {
            experiment        = modelObject as Experiment;
            view              = viewObject as ExperimentView;
            explorerPresenter = parentPresenter;


            // Once the simulation is finished, we will need to reset the disabled simulation names.
            //runner.Finished += OnSimulationsCompleted;

            view.EnableAction.Clicked        += OnEnable;
            view.DisableAction.Clicked       += OnDisable;
            view.ExportToCSVAction.Clicked   += OnExportCsv;
            view.ImportFromCSVAction.Clicked += OnImportCsv;
            view.RunAPSIMAction.Clicked      += OnRunSims;
            view.MaximumNumSimulations.Leave += OnSetMaxNumSims;

            // Give the view the default maximum number of simulations to display.
            view.MaximumNumSimulations.Text = DefaultMaxSims.ToString();

            // Get a list of all simulation descriptions (even disabled ones).
            GetAllSimulationDescriptionsFromExperiment();

            // Populate the view.
            PopulateView();
        }
Esempio n. 2
0
        /// <summary>Attach the model to the view.</summary>
        /// <param name="model">The model.</param>
        /// <param name="view">The view.</param>
        /// <param name="parentPresenter">The explorer presenter.</param>
        public void Attach(object modelObject, object viewObject, ExplorerPresenter parentPresenter)
        {
            model     = modelObject as Experiment;
            view      = viewObject as ExperimentView;
            presenter = parentPresenter;

            runner = new RunCommand(model, presenter, false, storage);
            // Once the simulation is finished, we will need to reset the disabled simulation names.
            runner.Finished += OnSimulationsCompleted;

            view.EnableSims  += OnEnable;
            view.DisableSims += OnDisable;
            view.ExportCsv   += OnExportCsv;
            view.ImportCsv   += OnImportCsv;
            view.RunSims     += OnRunSims;
            view.SetMaxSims  += OnSetMaxNumSims;

            maxSimsToDisplay = DefaultMaxSims;
            List <List <FactorValue> > allCombinations = model.AllCombinations();

            if (allCombinations == null || !allCombinations.Any())
            {
                throw new Exception(string.Format("Unable to generate a list of factors for experiment {0}.", model.Name));
            }

            headers     = GetHeaderNames(allCombinations.First());
            simulations = GetTableData(allCombinations);

            view.Initialise(headers);
            UpdateView();
        }