void AddDiplayGroup(string paramGroup, IList <KnownUOM> uoms, int group, int ptPopularity, string paramName, ParamType pt, ref int order)
        {
            List <ParamType> pTypes = null;

            if (pt != null)
            {
                pTypes = new List <ParamType>();
                _paramDisplayGroups.Add(pTypes);
                pTypes.Add(pt);
            }

            foreach (var uom in uoms)
            {
                order++;
                ChooseMultiUomRowInfo rowInfo = new ChooseMultiUomRowInfo()
                {
                    Parent    = this,
                    Group     = $"{group:000}",
                    Order     = $"{order:000000}",
                    Parameter = $"{paramName}",
                    Unit      = uom.Name,

                    ParamGroup = paramGroup,
                    Uom        = uom,
                    ParamTypes = pTypes,

                    IsSelected = false,
                };

                RowInfoCollection.Add(rowInfo);
            }
        }
Exemplo n.º 2
0
        private void TidyUpSelections(ChooseMultiUomRowInfo rowInfo)
        {
            try
            {
                // Remove a previous selection that clashes with this new one
                ChooseMultiUomRowInfo selectionToRemove = null;
                foreach (ChooseMultiUomRowInfo item in unitsGrid.SelectedItems)
                {
                    if (item.Uom.Equals(rowInfo.Uom) && item.Uom.Dimensions.Equals(rowInfo.Uom.Dimensions))
                    {
                        selectionToRemove = item;
                        break;      // Should only ever be one that matches, otherwise there was a clash already
                    }
                }
                if (selectionToRemove != null)
                {
                    unitsGrid.SelectedItems.Remove(selectionToRemove);
                }

                // Select all identical appearances
                IList <ChooseMultiUomRowInfo> selectionsToAdd = new List <ChooseMultiUomRowInfo>();

                foreach (ChooseMultiUomRowInfo row in _vmChooseMultiUom.RowInfoCollection)
                {
                    if (row != rowInfo && row.Uom.Equals(rowInfo.Uom))
                    {
                        unitsGrid.SelectedItems.Add(row);
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.LogException(ex);
                throw;
            }
        }