Ejemplo n.º 1
0
 /// <summary>
 /// Browse button was clicked by user.
 /// </summary>
 private void OnBrowseButtonClicked(object sender, OpenDialogArgs e)
 {
     try
     {
         ExplorerPresenter.CommandHistory.Add(new Commands.ChangeProperty(Input, "FullFileName", e.FileNames[0]));
     }
     catch (Exception err)
     {
         ExplorerPresenter.ShowMessage(err.Message, DataStore.ErrorLevel.Error);
     }
 }
Ejemplo n.º 2
0
        public void OnUpgrade(object sender, EventArgs e)
        {
            Version version = new Version(Application.ProductVersion);

            if (version.Revision == 0)
            {
                explorerPresenter.ShowMessage("You are on a custom build. You cannot upgrade.", DataStore.ErrorLevel.Error);
            }
            else
            {
                UpgradeForm form = new UpgradeForm(explorerPresenter);
                form.Show();
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// User has clicked RunAPSIM
 /// </summary>
 private void OnRunApsimClick(object sender, EventArgs e)
 {
     try
     {
         Simulation          simulation = Experiment.CreateSpecificSimulation(ListView.MemoLines[ListView.CurrentPosition.Y]);
         Commands.RunCommand run        = new Commands.RunCommand(Apsim.Parent(Experiment, typeof(Simulations)) as Simulations,
                                                                  simulation,
                                                                  ExplorerPresenter);
         run.Do(null);
     }
     catch (Exception err)
     {
         ExplorerPresenter.ShowMessage(err.Message, Models.DataStore.ErrorLevel.Error);
     }
 }
Ejemplo n.º 4
0
        public void CreateDocumentation(object sender, EventArgs e)
        {
            string destinationFolder = Path.Combine(Path.GetDirectoryName(this.explorerPresenter.ApsimXFile.FileName), "Doc");

            if (destinationFolder != null)
            {
                explorerPresenter.ShowMessage("Creating documentation...", DataStore.ErrorLevel.Information);
                Cursor.Current = Cursors.WaitCursor;

                try
                {
                    ExportNodeCommand command = new ExportNodeCommand(this.explorerPresenter, this.explorerPresenter.CurrentNodePath);
                    this.explorerPresenter.CommandHistory.Add(command, true);
                    explorerPresenter.ShowMessage("Finished creating documentation", DataStore.ErrorLevel.Information);
                    Process.Start(command.FileNameWritten);
                }
                catch (Exception err)
                {
                    explorerPresenter.ShowMessage(err.Message, DataStore.ErrorLevel.Error);
                }

                Cursor.Current = Cursors.Default;
            }
        }