Exemple #1
0
        public void RefreshRow(string productId)
        {
            var rowId = getRowId((ge) => ge.GetBook().AudibleProductId == productId);

            // update cells incl Liberate button text
            dataGridView.InvalidateRow(rowId);

            BackupCountsChanged?.Invoke(this, EventArgs.Empty);
        }
Exemple #2
0
        public void RefreshRow(string productId)
        {
            var rowId = getRowId((ge) => ge.GetBook().AudibleProductId == productId);

            // update cells incl Liberate button text
            dataGridView.InvalidateRow(rowId);

            // needed in case filtering by -IsLiberated and it gets changed to Liberated. want to immediately show the change
            filter();

            BackupCountsChanged?.Invoke(this, EventArgs.Empty);
        }
Exemple #3
0
        public void Display()
        {
            if (hasBeenDisplayed)
            {
                return;
            }
            hasBeenDisplayed = true;

            //
            // transform into sorted GridEntry.s BEFORE binding
            //
            context = DbContexts.GetContext();
            var lib = context.GetLibrary_Flat_WithTracking();

            // if no data. hide all columns. return
            if (!lib.Any())
            {
                for (var i = dataGridView.ColumnCount - 1; i >= 0; i--)
                {
                    dataGridView.Columns.RemoveAt(i);
                }
                return;
            }

            var orderedGridEntries = lib
                                     .Select(lb => new GridEntry(lb)).ToList()
                                     // default load order
                                     .OrderByDescending(ge => ge.Purchase_Date)
                                     //// more advanced example: sort by author, then series, then title
                                     //.OrderBy(ge => ge.Authors)
                                     //    .ThenBy(ge => ge.Series)
                                     //    .ThenBy(ge => ge.Title)
                                     .ToList();

            //
            // BIND
            //
            gridEntryBindingSource.DataSource = orderedGridEntries.ToSortableBindingList();

            //
            // FILTER
            //
            filter();

            BackupCountsChanged?.Invoke(this, EventArgs.Empty);
        }