Exemple #1
0
 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);
     }
 }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
        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();
            }
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
 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);
     }
 }