Exemplo n.º 1
0
        private void AddColumns()
        {
            var cols = new SortableColumn [] {
                Create("Title", Catalog.GetString("Title"), 0.9, true, new ColumnCellText(null, true)),
                Create("Creator", Catalog.GetString("Creator"), 0.15, true, new ColumnCellText(null, true)),
                Create("Publisher", Catalog.GetString("Publisher"), 0.15, false, new ColumnCellText(null, true)),
                Create("Description", Catalog.GetString("Description"), 0.35, false, new ColumnCellText(null, true)),
                Create("AvgRatingInt", Catalog.GetString("Rating"), 0.15, true, new ColumnCellRating(null, true)
                {
                    ReadOnly = true
                }),
                Create("Year", Catalog.GetString("Year"), 0.15, true, new ColumnCellPositiveInt(null, true, 4, 4)
                {
                    CultureFormatted = false
                }),
                Create("Downloads", Catalog.GetString("Downloads"), 0.15, true, new ColumnCellPositiveInt(null, true, 2, 5)),
                Create("Format", Catalog.GetString("Formats"), 0.15, false, new ColumnCellText(null, true)),
                Create("LicenseUrl", Catalog.GetString("License"), 0.15, true, new ColumnCellCreativeCommons(null, true)),
                Create("DateAdded", Catalog.GetString("Added"), 0.15, false, new ColumnCellDateTime(null, true)
                {
                    Format = DateTimeFormat.ShortDate
                })
            };

            foreach (var col in cols)
            {
                list_view.ColumnController.Add(col);
            }
        }
Exemplo n.º 2
0
        public SortableColumn GetSortingUsingColHeader(string header)
        {
            SortableColumn clickedColumn = null;

            switch (header)
            {
            case COL_SENDER:
                clickedColumn = new SortingBySender();
                break;

            case COL_TITLE:
                clickedColumn = new SortingByName();
                break;

            case COL_STATUS:
                clickedColumn = new SortingByStatus();
                break;

            case COL_DATE:
                clickedColumn = new SortingByDate();
                break;

            case COL_ATTRIBUTE:
                clickedColumn = new SortingByAttribute();
                break;

            default:
                clickedColumn = new SortingByDate();
                break;
            }

            return(clickedColumn);
        }
        private void SortEventsUsingLastOrderFromCache()
        {
            string         sortCol        = AppConfigManager.GetKeyValue(Properties.Resources.TAG_SORT_NAME);
            SortableColumn CurrentSorting = dataGridManager.GetSortingUsingColHeader(sortCol);

            CurrentSorting.Direction = AppConfigManager.GetIntKeyValue(Properties.Resources.TAG_SORT_DIR);
            CurrentSorting.Sort(Events);
            dataGridManager.PopulateDataGrid(Events, dataGridView);
        }
        public void SortEventsUsingHeader(string header)
        {
            SortableColumn CurrentSorting = dataGridManager.GetSortingUsingColHeader(header);

            SortDirection           *= DIRECTION_MULTIPLIER;
            CurrentSorting.Direction = SortDirection;
            CurrentSorting.Sort(Events);
            dataGridManager.PopulateDataGrid(Events, dataGridView);
            SaveSortColumnAndDirectionToCache(header, SortDirection);
        }
Exemplo n.º 5
0
        public static SortableColumn Create (QueryField field, double width, bool visible, ColumnCell cell)
        {
            cell.Property = field.PropertyName;
            SortableColumn col = new SortableColumn (
                field.ShortLabel,
                cell,
                width, field.Name, visible
            );
            col.LongTitle = field.Label;
            col.Field = field;

            return col;
        }
        public void SetFirst(SortableColumn column)
        {
            if (!this.Selectors.HasItems()) return;

            if (this.Selectors[0].Current == column)
            {
                this.Selectors[0].SafeUpdate(this.Selectors[0].IsDescending);
            }
            else
            {
                this.Selectors[0].SafeUpdate(column);
                this.Selectors[0].SafeUpdate(!column.DefaultIsDescending);
            }

            this.UpdateSelectors();
        }
 public void Should_return_a_GridData_With_the_newly_added_SortableColumn()
 {
     var sortableColumn = new SortableColumn<TestData.Item>(item => item.ItemName, "FieldName", "ColumnHeader");
     var grid = _gridData.WithColumn(sortableColumn);
     Assert.AreSame(_gridData, grid);
     _gridData.GridColumns.ToList().Count.ShouldBeEqualTo(1);
 }
 internal void SafeUpdate(SortableColumn column)
 {
     this._Current = column;
     this.RaisePropertyChanged(nameof(this.Current));
 }
 public void Should_return_Sortable()
 {
     var column = new SortableColumn<int>(i => i.ToString(), "Bar", "Int");
     column.Type.ShouldBeEqualTo(GridColumnType.Sortable);
 }
 public void BeforeEachTest()
 {
     Expression<Func<Item, int?>> expr = item => item.ItemId;
     _sortableColumn = SortableGridColumn.For(expr);
 }
 public void BeforeEachTest()
 {
     _sortableColumn = new SortableColumn<TestData.Item>(item => item.ItemName, "FieldName", "ColumnHeader");
 }