public void ShowModelStructure(object sender, EventArgs e) { try { IModel model = explorerPresenter.CurrentNode; if (model != null) { foreach (IModel child in model.FindAllDescendants()) { child.IsHidden = !child.IsHidden; } foreach (IModel child in model.Children) { if (child.IsHidden) { explorerPresenter.Tree.Delete(child.FullPath); } } explorerPresenter.PopulateContextMenu(model.FullPath); explorerPresenter.RefreshNode(model); } } catch (Exception err) { explorerPresenter.MainPresenter.ShowError(err); } }
public void ShowModelStructure(object sender, EventArgs e) { IModel model = Apsim.Get(explorerPresenter.ApsimXFile, explorerPresenter.CurrentNodePath) as IModel; if (model != null) { foreach (IModel child in Apsim.ChildrenRecursively(model)) { child.IsHidden = !child.IsHidden; } explorerPresenter.PopulateContextMenu(explorerPresenter.CurrentNodePath); explorerPresenter.Refresh(); } }
public void Enabled(object sender, EventArgs e) { IModel model = Apsim.Get(explorerPresenter.ApsimXFile, explorerPresenter.CurrentNodePath) as IModel; if (model != null) { model.Enabled = !model.Enabled; foreach (IModel child in Apsim.ChildrenRecursively(model)) { child.Enabled = model.Enabled; } explorerPresenter.PopulateContextMenu(explorerPresenter.CurrentNodePath); explorerPresenter.Refresh(); } }
public void IncludeInDocumentation(object sender, EventArgs e) { try { IModel model = Apsim.Get(explorerPresenter.ApsimXFile, explorerPresenter.CurrentNodePath) as IModel; model.IncludeInDocumentation = !model.IncludeInDocumentation; // toggle switch foreach (IModel child in Apsim.ChildrenRecursively(model)) { child.IncludeInDocumentation = model.IncludeInDocumentation; } explorerPresenter.PopulateContextMenu(explorerPresenter.CurrentNodePath); } catch (Exception err) { explorerPresenter.MainPresenter.ShowMessage(err.ToString(), Models.DataStore.ErrorLevel.Error); } }
public void ShowModelStructure(object sender, EventArgs e) { try { IModel model = explorerPresenter.ApsimXFile.FindByPath(explorerPresenter.CurrentNodePath)?.Value as IModel; if (model != null) { foreach (IModel child in model.FindAllDescendants()) { child.IsHidden = !child.IsHidden; } explorerPresenter.PopulateContextMenu(explorerPresenter.CurrentNodePath); explorerPresenter.Refresh(); } } catch (Exception err) { explorerPresenter.MainPresenter.ShowError(err); } }