Exemplo n.º 1
0
        private void RefreshRowInfo()
        {
            int group = 0;
            int order = 0;

            IList <ParamType> paramTypes = _ParamTypes.Select(x => x).ToList();

            // Only show recent items that match the param types
            IList <KnownUOM> filteredRecent = new List <KnownUOM>();

            if (ParamTypes == null || ParamTypes.Count == 0)
            {
                filteredRecent = RecentSelections;      // No filtering
            }
            else
            {
                foreach (var item1 in RecentSelections)
                {
                    bool bShow = false;
                    foreach (var item2 in ParamTypes)
                    {
                        if (Dimensions.AreEqual(item1.Dimensions, item2.Dimensions))
                        {
                            bShow = true;
                            break;
                        }
                    }
                    if (bShow)
                    {
                        filteredRecent.Add(item1);
                    }
                }
            }

            if (_allowUnspecified)
            {
                group++;
                AddUnspecifiedItem(group, ref order);
            }

            group++;
            AddDiplayGroup("_Recent", filteredRecent, group, 999, "_Recent", null, ref order);

            foreach (var pt in _ParamTypes)
            {
                if (!AddToExistingDisplayGroup(pt))
                {
                    IList <KnownUOM> uoms = ContentManager.GetKnownUOMs(pt);
                    if (uoms?.Count > 0)
                    {
                        string paramGroup = ((_ParamTypes.Count == 1) ? "Param Type is " : ContentManager.DescribePopularity(pt.Popularity));
                        group++;
                        AddDiplayGroup(paramGroup, uoms, group, pt.Popularity, pt.Name, pt, ref order);
                    }
                }
            }

            RenameRowInfoParams();
        }
Exemplo n.º 2
0
        // ---------------------------------------

        public override Result <Dimensions> CalcDimensions(IList <Dimensions> argDimensions, IList <double?> argConstants)
        {
            if (argDimensions.Count != 2)
            {
                return(Result <Dimensions> .Bad(Name + " must have 2 arguments"));
            }

            if (argDimensions[0] == null && argDimensions[1] == null)
            {
                return(Result <Dimensions> .Good(null));
            }

            if (!Dimensions.AreEqual(argDimensions[0], argDimensions[1]))
            {
                return(Result <Dimensions> .Bad("Inconsistent Dimensions"));
            }

            return(Result <Dimensions> .Good(argDimensions[0]));
        }
Exemplo n.º 3
0
        /// Returns true if the ParamType matches one already added
        bool AddToExistingDisplayGroup(ParamType pt)
        {
            foreach (var ptGroup in _paramDisplayGroups)
            {
                ParamType pt2 = ptGroup[0];
                if (Dimensions.AreEqual(pt.Dimensions, pt2.Dimensions))
                {
                    ptGroup.Add(pt);

                    // RowInfo items will be renamed later
                    //foreach (var rowInfo in RowInfoCollection)
                    //{
                    //    if (rowInfo.ParamTypes==ptGroup)
                    //    {
                    //        rowInfo.Parameter += $", {pt.Name}";
                    //    }
                    //}

                    return(true);
                }
            }
            return(false);
        }