示例#1
0
        /// <summary>
        /// Build the list of columns for the given profile
        /// </summary>
        private void AddColumnsAndDependents(IList <LogColumn> columns, LogProfile newProfile)
        {
            List <LogColumn> dependencies = new List <LogColumn>();

            foreach (LogColumn column in newProfile.Columns)
            {
                Parameter  parameter  = column.Parameter;
                Conversion conversion = column.Conversion;

                DependencyMap dependencyMap = null;

                if (parameter.IsCalculated)
                {
                    dependencyMap = new DependencyMap();

                    foreach (Parameter dependency in parameter.Dependencies)
                    {
                        string     depencencyKey;
                        Conversion dependencyConversion;

                        InternalLogProfile.GetDependencyConversion(
                            dependency,
                            conversion,
                            out dependencyConversion,
                            out depencencyKey);

                        this.VerifyParameter(dependency);

                        LogColumn dependencyColumn = LogColumn.GetInstance(
                            dependency,
                            dependencyConversion,
                            null,
                            true);
                        dependencyMap[depencencyKey] = dependencyColumn;
                        dependencies.Add(dependencyColumn);
                    }
                }

                this.VerifyParameter(parameter);
                LogColumn newColumn = LogColumn.GetInstance(parameter, conversion, dependencyMap, false);
                columns.Add(newColumn);
            }

            if (dependencies != null)
            {
                foreach (LogColumn dependency in dependencies)
                {
                    columns.Add(dependency);
                }
            }
        }
示例#2
0
        public void Add(Parameter parameter, Conversion conversion)
        {
            LogColumn column = LogColumn.GetInstance(parameter, conversion, null, false);

            for (int i = 0; i < this.columns.Count; i++)
            {
/* Not sure what I had in mind for this, but it breaks the SawMill UI:
 *              LogColumn candidate = this.columns[i];
 *              if (string.Compare(
 *                  parameter.Name,
 *                  candidate.Parameter.Name,
 *                  StringComparison.OrdinalIgnoreCase) < 0)
 *              {
 *                  this.columns.Insert(i, column);
 *                  return;
 *              }
 */
            }
            this.columns.Add(column);
        }