Exemplo n.º 1
0
        public List <ColumnConfig> RestoreColumnConfig(ListViewConfig initial, ListViewConfig active)
        {
            var columnMismatch = false;

            if (initial.Columns.Count == active.Columns.Count)
            {
                var comparer = new StrictKeyEqualityComparer <ColumnConfig, string>(x => x.Name);
                columnMismatch = !initial.Columns.SequenceEqual(active.Columns, comparer);
            }

            // if column count miss match or column missmatch replace columns with initial.
            if (initial.Columns.Count != active.Columns.Count ||
                columnMismatch)
            {
                active.Columns = initial.Columns.ToList(); // copy initial columns to active.
            }
            return(active.Columns);
        }
Exemplo n.º 2
0
 private static int ColumnCount(ListViewConfig lvc)
 {
     return(lvc != null && lvc.Columns != null ? lvc.Columns.Count : 0);
 }