public void Execute(TabbedExplorerPresenter tabbedExplorerPresenter)
    {
        // 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\" + modelName + @"\" + modelName + "Validation.apsimx");

        tabbedExplorerPresenter.OpenApsimXFileInTab(fileName);

        // Get the presenter for this tab.
        ExplorerPresenter presenter = tabbedExplorerPresenter.Presenters[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.
        tabbedExplorerPresenter.Close(false);
    }
Example #2
0
    public void Execute(TabbedExplorerPresenter tabbedExplorerPresenter)
    {
        // Open the standard toolbox in a tab
        tabbedExplorerPresenter.OnStandardToolboxClick(null, null);

        // Get the presenter for this tab.
        ExplorerPresenter presenter = tabbedExplorerPresenter.Presenters[0];

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

        // Close the user interface.
        tabbedExplorerPresenter.Close();
    }
Example #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainForm(string[] args)
        {
            InitializeComponent();
            Application.EnableVisualStyles();

            // Adjust font size for MONO.
            if (Environment.OSVersion.Platform != PlatformID.Win32NT &&
                Environment.OSVersion.Platform != PlatformID.Win32Windows)
            {
                this.Font = new Font(this.Font.FontFamily, 10.2F);
            }
            tabbedExplorerView1.Font = this.Font;
            tabbedExplorerView2.Font = this.Font;

            Presenter1 = new TabbedExplorerPresenter();
            Presenter1.Attach(tabbedExplorerView1);

            Presenter2 = new TabbedExplorerPresenter();
            Presenter2.Attach(tabbedExplorerView2);

            SplitContainer.Panel2Collapsed = true;
            commandLineArguments           = args;
        }
Example #4
0
    public void Execute(TabbedExplorerPresenter tabbedExplorerPresenter)
    {
        // Open test.apsimx in a tab
        tabbedExplorerPresenter.OpenApsimXFileInTab(@"..\Tests\Test.apsimx");

        // Get the presenter for this tab.
        ExplorerPresenter presenter = tabbedExplorerPresenter.Presenters[0] as ExplorerPresenter;

        if (presenter != null)
        {
            // Select the field model.
            presenter.SelectNode(".Simulations.Test");

            // Copy the simulation model.
            ContextMenu menu = new ContextMenu(presenter);
            menu.OnCopyClick(null, null);

            // Select the top model
            presenter.SelectNode(".Simulations");

            // Paste the model.
            menu.OnPasteClick(null, null);

            // Make sure the paste has worked by clicking on a child.
            presenter.SelectNode(".Simulations.Test1.Clock");

            // Make sure the parenting of children has worked correctly.
            Clock clock = Apsim.Get(presenter.ApsimXFile, ".Simulations.Test1.Clock") as Clock;
            if (clock.Parent == null)
            {
                throw new Exception("Parenting of models after copy/paste hasn't worked");
            }
        }

        // Close the user interface.
        tabbedExplorerPresenter.Close(false);
    }
Example #5
0
    public void Execute(TabbedExplorerPresenter tabbedExplorerPresenter)
    {
        // Set the current working directory to the bin folder.
        string binFolder = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);

        Directory.SetCurrentDirectory(binFolder);

        ///////////////////////////////////////////////////////////////////
        // Wheat
        ///////////////////////////////////////////////////////////////////

        // Open wheat validation in a tab
        string fileName = Path.Combine(binFolder, @"..\Tests\Wheat\WheatValidation.apsimx");

        tabbedExplorerPresenter.OpenApsimXFileInTab(fileName);

        // Get the presenter for this tab.
        ExplorerPresenter presenter = tabbedExplorerPresenter.Presenters[0];
        ContextMenu       menu      = new ContextMenu(presenter);

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

        Directory.CreateDirectory(folderName);
        presenter.SelectNode(".Simulations.APS26.APS26NRate160WaterWet.paddock.Wheat");
        menu.ExportToHTML(folderName);
        presenter.SelectNode(".Simulations");
        menu.ExportToHTML(folderName);

        ///////////////////////////////////////////////////////////////////
        // OilPalm
        ///////////////////////////////////////////////////////////////////

        // Open oil palm validation in a tab
        fileName = Path.Combine(binFolder, @"..\Tests\OilPalm\OilPalmValidation.apsimx");
        tabbedExplorerPresenter.OpenApsimXFileInTab(fileName);

        // Get the presenter for this tab.
        presenter = tabbedExplorerPresenter.Presenters[1];
        menu      = new ContextMenu(presenter);

        // Export the model to HTML
        folderName = Path.Combine(binFolder, @"..\Documentation\html\OilPalm");
        Directory.CreateDirectory(folderName);
        presenter.SelectNode(".Simulations.Sangara.Base324.Field.OilPalm");
        menu.ExportToHTML(folderName);
        presenter.SelectNode(".Simulations");
        menu.ExportToHTML(folderName);

        ///////////////////////////////////////////////////////////////////
        // Potato
        ///////////////////////////////////////////////////////////////////

        // Open potato validation in a tab
        fileName = Path.Combine(binFolder, @"..\Tests\Potato\PotatoValidation.apsimx");
        tabbedExplorerPresenter.OpenApsimXFileInTab(fileName);

        // Get the presenter for this tab.
        presenter = tabbedExplorerPresenter.Presenters[2];
        menu      = new ContextMenu(presenter);

        // Export the model to HTML
        folderName = Path.Combine(binFolder, @"..\Documentation\html\Potato");
        Directory.CreateDirectory(folderName);
        presenter.SelectNode(".Simulations.Potato.RussetBurbank.Field.Potato");
        menu.ExportToHTML(folderName);
        presenter.SelectNode(".Simulations");
        menu.ExportToHTML(folderName);

        // Close the user interface.
        tabbedExplorerPresenter.Close(false);
    }