/// <summary> /// Initializes a new instance of the <see cref="RenameModelCommand"/> class. /// </summary> /// <param name="modelToRename">The model to rename.</param> /// <param name="newName">The new name.</param> /// <param name="explorerView">The explorer view.</param> public RenameModelCommand(Model modelToRename, string newName, Interfaces.IExplorerView explorerView) { if (modelToRename.ReadOnly) { throw new ApsimXException(modelToRename, string.Format("Unable to rename {0} - it is read-only.", modelToRename.Name)); } this.modelToRename = modelToRename; this.newName = newName.Trim(); this.explorerView = explorerView; }
/// <summary> /// Initializes a new instance of the <see cref="RenameModelCommand"/> class. /// </summary> /// <param name="modelToRename">The model to rename.</param> /// <param name="newName">The new name.</param> /// <param name="explorerView">The explorer view.</param> public RenameModelCommand(Model modelToRename, string newName, Interfaces.IExplorerView explorerView) { this.modelToRename = modelToRename; this.newName = newName; this.explorerView = explorerView; }