예제 #1
0
 /// <summary>Moves the specified model down.</summary>
 /// <param name="model">The model to move.</param>
 public void MoveDown(IModel model)
 {
     try
     {
         MoveModelUpDownCommand command = new MoveModelUpDownCommand(model, false, this.view);
         CommandHistory.Add(command, true);
     }
     catch (Exception err)
     {
         MainPresenter.ShowError(err);
     }
 }
예제 #2
0
        public void MoveUpDown()
        {
            CommandHistory commandHistory = new CommandHistory();
            Model          modelToMove    = Apsim.Get(simulations, "APS14.Factors.Permutation.NRate") as Model;

            MoveModelUpDownCommand moveCommand = new MoveModelUpDownCommand(modelToMove, true, null);

            moveCommand.Do(commandHistory);

            Model modelToMove2 = Apsim.Get(simulations, "APS14.Factors.NRate") as Model;

            Assert.AreEqual(simulations.Children[2].Children[0].Children[0].Children[0].Name, "NRate");
            Assert.AreEqual(simulations.Children[2].Children[0].Children[0].Children[0].Children.Count, 4);
        }
예제 #3
0
        public void MoveUpDown()
        {
            var            tree           = new MockTreeView();
            CommandHistory commandHistory = new CommandHistory(tree);
            Model          modelToMove    = simulations.FindByPath("APS14.Factors.Permutation.NRate")?.Value as Model;

            MoveModelUpDownCommand moveCommand = new MoveModelUpDownCommand(modelToMove, true);

            moveCommand.Do(tree, _ => {});

            Model modelToMove2 = simulations.FindByPath("APS14.Factors.NRate")?.Value as Model;

            Assert.AreEqual(simulations.Children[2].Children[0].Children[0].Children[0].Name, "NRate");
            Assert.AreEqual(simulations.Children[2].Children[0].Children[0].Children[0].Children.Count, 4);
        }
예제 #4
0
        public void MoveUpDown()
        {
            IExplorerView     explorerView      = new ExplorerView();
            ExplorerPresenter explorerPresenter = new ExplorerPresenter();
            CommandHistory    commandHistory    = new CommandHistory();

            explorerPresenter.Attach(simulations, explorerView, null);

            Model modelToMove = Apsim.Get(simulations, "APS14.Factors.NRate") as Model;

            MoveModelUpDownCommand moveCommand = new MoveModelUpDownCommand(modelToMove, true, explorerView);

            moveCommand.Do(commandHistory);

            Model modelToMove2 = Apsim.Get(simulations, "APS14.Factors.NRate") as Model;

            Assert.AreEqual(simulations.Children[2].Children[0].Children[0].Name, "NRate");
            Assert.AreEqual(simulations.Children[2].Children[0].Children[0].Children.Count, 4);
        }
예제 #5
0
        /// <summary>Moves the specified model down.</summary>
        /// <param name="model">The model to move.</param>
        public void MoveDown(IModel model)
        {
            MoveModelUpDownCommand command = new MoveModelUpDownCommand(model, false, this.view);

            this.CommandHistory.Add(command, true);
        }
예제 #6
0
 /// <summary>Moves the specified model up.</summary>
 /// <param name="model">The model to move.</param>
 public void MoveUp(IModel model)
 {
     MoveModelUpDownCommand command = new MoveModelUpDownCommand(model, true, this.view);
     this.CommandHistory.Add(command, true);
 }