Beispiel #1
0
        public bool Execute(Controller controller)
        {
            var modeller = controller as ModellerController;

            if (modeller == null)
            {
                throw new XTMFRuntimeException(this, "In '" + Name + "' we were not given a modeller controller!");
            }
            string result = null;

            if (modeller.Run(this, ToolName, GetParameters(), ref result))
            {
                if (SumOfReport != null)
                {
                    if (float.TryParse(result, out float value))
                    {
                        ISetableDataSource <float> dataSource = ((ISetableDataSource <float>)SumOfReport.GetDataSource());
                        if (!dataSource.Loaded)
                        {
                            dataSource.LoadData();
                        }
                        dataSource.SetData(value);
                    }
                }
                return(true);
            }
            return(false);
        }
Beispiel #2
0
 private static bool SetIfExists <T>(ISetableDataSource <T> dataSource, T value)
 {
     if (dataSource != null)
     {
         if (!dataSource.Loaded)
         {
             dataSource.LoadData();
         }
         dataSource.SetData(value);
         return(true);
     }
     return(false);
 }