Exemplo n.º 1
0
    public void Execute(MainPresenter mainPresenter)
    {
        // Set the current working directory to the bin folder.
        string binFolder = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
        Directory.SetCurrentDirectory(binFolder);

        // Get the environment variable 'ModelName'
        string modelName = System.Environment.GetEnvironmentVariable("ModelName");

        // Open wheat validation in a tab
        string fileName = Path.Combine(binFolder, @"..\Tests\Validation\" + modelName + @"\" + modelName + ".apsimx");
        if (File.Exists(fileName))
        {
            mainPresenter.OpenApsimXFileInTab(fileName, true);

            // Get the presenter for this tab.
            ExplorerPresenter presenter = mainPresenter.presenters1[0];
            presenter.SelectNode(".Simulations");

            // Export the model to HTML
            string folderName = Path.Combine(binFolder, @"..\Documentation\PDF");
            Directory.CreateDirectory(folderName);

            ExportNodeCommand command = new ExportNodeCommand(presenter, presenter.CurrentNodePath);
            command.Do(null);

            // Copy the file into the PDF directory.
            File.Copy(command.FileNameWritten, @"..\Documentation\PDF\" + modelName + ".pdf");
        }
        // Close the user interface.
        mainPresenter.Close(false);
    }
Exemplo n.º 2
0
    public void Execute(MainPresenter mainPresenter)
    {
        // Open the standard toolbox in a tab
        mainPresenter.OnStandardToolboxClick(null, null);

        // Get the presenter for this tab.
        ExplorerPresenter presenter = mainPresenter.presenters1[0];

        // Loop through all nodes in the standard toolbox and select each in turn.
        while (presenter.SelectNextNode());

        // Close the user interface.
        mainPresenter.Close(askToSave:false);
    }