Beispiel #1
0
        private Column ApplyLayerStyling(Column top, IColumnLayer <object, object> layer)
        {
            if (top.Name.Contains("_Layer") == false)
            {
                throw new ArgumentException("layer '" + top + "' must contain '_Layer' in it's name");
            }
            if (layer.LowerLayer.DisplayIndex == 0)
            {
                grid.HideFirstColumn();
                top.DisplayIndex = 0;
            }

            if (grid._customNames.ContainsKey(top.Name)) //Apply Name
            {
                top.HeaderText = grid._customNames[top.Name];
            }

            if (grid._customizeColumns.ContainsKey(top.Name)) //Apply custom property
            {
                grid._customizeColumns[top.Name].ApplyProperties(top);
            }

            layer.LowerLayer.Visible = layer.AreLowerVisible;
            top.ReadOnly             = layer.IsReadOnly;
            return(top);
        }
Beispiel #2
0
        /*///
         * Hierchy before showing grid:
         * Insert Data (Once) to dataset - Collecting
         * Create Representive Layer -> Fill it corresponding to the data below it - Designing
         * Display Layers - (Least work) - Showing
         */

        private void Process()
        {
            //POST Binding
            DataGridViewColumn[] columns = grid.Columns.Cast <Column>().ToArray();
            foreach (DataGridViewColumn low in columns)
            {
                //todo PARALLELISM!!
                IColumnLayer <object, object> _layer =
                    Layerers.FirstOrDefault(lay => String.Equals(lay.LowerLayerName, low.Name, StringComparison.InvariantCultureIgnoreCase));
                if (_layer == null)
                {
                    continue;
                }
                _layer.LowerLayer = low;
                grid.Columns.Add(ApplyLayerStyling(_layer.CreateLayeredColumn(), _layer));
            }

            foreach (var layer in ManualLayerers)
            {
                //todo PARALLELISM!!
                layer.LowerLayers =
                    layer.LowerLayersNames.Select(n => columns.FirstOrDefault(c => c.Name.Equals(n)))
                    .Where(c => c != null);
                grid.Columns.Add(ApplyLayerStyling(layer.CreateLayeredColumn(), layer));
            }
        }