C# Класс BrightIdeasSoftware.DataSourceAdapter

A helper class that translates DataSource events for an ObjectListView
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
DataSourceAdapter ( ObjectListView olv ) : System

Make a DataSourceAdapter

Dispose ( ) : void

Release all the resources used by this instance

Dispose ( bool fromUser ) : void

Release all the resources used by this instance

Защищенные методы

Метод Описание
BindDataSource ( ) : void
BindListView ( ObjectListView olv ) : void
ChangePosition ( int index ) : void

Change the control's position (which is it's currently selected row) to the n'th row in the dataset

ConfigureColumn ( OLVColumn column, PropertyDescriptor property ) : void

Configure the given column to show the given property. The title and aspect name of the column are already filled in.

CreateColumnsFromSource ( ) : void

Create columns for the listview based on what properties are available in the data source

This method will create columns if there is not already a column displaying that property.

CreateMissingAspectGettersAndPutters ( ) : void

Generate aspect getters and putters for any columns that are missing them (and for which we have enough information to actually generate a getter)

CurrencyManagerListChanged ( object sender, ListChangedEventArgs e ) : void

CurrencyManager ListChanged event handler. Deals with fine-grained changes to list items.

It's actually difficult to deal with these changes in a fine-grained manner. If our listview is grouped, then any change may make a new group appear or an old group disappear. It is rarely enough to simply update the affected row.

HandleCurrencyManagerMetaDataChanged ( object sender, EventArgs e ) : void

The CurrencyManager calls this if the data source looks different. We just reload everything.

CHECK: Do we need this if we are handle ListChanged metadata events?

HandleCurrencyManagerPositionChanged ( object sender, EventArgs e ) : void

Called by the CurrencyManager when the currently selected item changes. We update the ListView selection so that we stay in sync with any other controls bound to the same source.

HandleListChangedItemAdded ( ListChangedEventArgs e ) : void

Handle an ItemAdded event.

HandleListChangedItemChanged ( ListChangedEventArgs e ) : void

Handle ItemChanged event. This is triggered when a single item has changed, so just refresh that one item.

Even in this simple case, we should probably rebuild the list. For example, the change could put the item into its own new group.

HandleListChangedItemDeleted ( ListChangedEventArgs e ) : void

Handle the ItemDeleted event

HandleListChangedItemMoved ( ListChangedEventArgs e ) : void

Handle ItemMoved event

HandleListChangedMetadataChanged ( ListChangedEventArgs e ) : void

Handle PropertyDescriptor* events

HandleListChangedReset ( ListChangedEventArgs e ) : void

Handle the Reset event

HandleListViewBindingContextChanged ( object sender, EventArgs e ) : void

Handle a change to the BindingContext of our ListView.

HandleListViewFreezing ( object sender, BrightIdeasSoftware.FreezeEventArgs e ) : void

Handle the frozenness of our ListView changing.

HandleListViewSelectedIndexChanged ( object sender, EventArgs e ) : void

Handle the selection changing in our ListView. We need to tell our currency manager about the new position.

InitializeDataSource ( ) : void

The data source for this control has changed. Reconfigure the control for the new source

RebindDataSource ( ) : void

Our data source has changed. Figure out how to handle the new source

RebindDataSource ( bool forceDataInitialization ) : void

Our data source has changed. Figure out how to handle the new source

SetListContents ( ) : void

Take the contents of the currently bound list and put them into the control

ShouldCreateColumn ( PropertyDescriptor property ) : bool

Decide if a new column should be added to the control to display the given property

UnbindDataSource ( ) : void
UnbindListView ( ObjectListView olv ) : void

Описание методов

BindDataSource() защищенный Метод

protected BindDataSource ( ) : void
Результат void

BindListView() защищенный Метод

protected BindListView ( ObjectListView olv ) : void
olv ObjectListView
Результат void

ChangePosition() защищенный Метод

Change the control's position (which is it's currently selected row) to the n'th row in the dataset
protected ChangePosition ( int index ) : void
index int The index of the row to be selected
Результат void

ConfigureColumn() защищенный Метод

Configure the given column to show the given property. The title and aspect name of the column are already filled in.
protected ConfigureColumn ( OLVColumn column, PropertyDescriptor property ) : void
column OLVColumn
property System.ComponentModel.PropertyDescriptor
Результат void

CreateColumnsFromSource() защищенный Метод

Create columns for the listview based on what properties are available in the data source

This method will create columns if there is not already a column displaying that property.

protected CreateColumnsFromSource ( ) : void
Результат void

CreateMissingAspectGettersAndPutters() защищенный Метод

Generate aspect getters and putters for any columns that are missing them (and for which we have enough information to actually generate a getter)
protected CreateMissingAspectGettersAndPutters ( ) : void
Результат void

CurrencyManagerListChanged() защищенный Метод

CurrencyManager ListChanged event handler. Deals with fine-grained changes to list items.
It's actually difficult to deal with these changes in a fine-grained manner. If our listview is grouped, then any change may make a new group appear or an old group disappear. It is rarely enough to simply update the affected row.
protected CurrencyManagerListChanged ( object sender, ListChangedEventArgs e ) : void
sender object
e System.ComponentModel.ListChangedEventArgs
Результат void

DataSourceAdapter() публичный Метод

Make a DataSourceAdapter
public DataSourceAdapter ( ObjectListView olv ) : System
olv ObjectListView
Результат System

Dispose() публичный Метод

Release all the resources used by this instance
public Dispose ( ) : void
Результат void

Dispose() публичный Метод

Release all the resources used by this instance
public Dispose ( bool fromUser ) : void
fromUser bool
Результат void

HandleCurrencyManagerMetaDataChanged() защищенный Метод

The CurrencyManager calls this if the data source looks different. We just reload everything.
CHECK: Do we need this if we are handle ListChanged metadata events?
protected HandleCurrencyManagerMetaDataChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void

HandleCurrencyManagerPositionChanged() защищенный Метод

Called by the CurrencyManager when the currently selected item changes. We update the ListView selection so that we stay in sync with any other controls bound to the same source.
protected HandleCurrencyManagerPositionChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void

HandleListChangedItemAdded() защищенный Метод

Handle an ItemAdded event.
protected HandleListChangedItemAdded ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
Результат void

HandleListChangedItemChanged() защищенный Метод

Handle ItemChanged event. This is triggered when a single item has changed, so just refresh that one item.
Even in this simple case, we should probably rebuild the list. For example, the change could put the item into its own new group.
protected HandleListChangedItemChanged ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
Результат void

HandleListChangedItemDeleted() защищенный Метод

Handle the ItemDeleted event
protected HandleListChangedItemDeleted ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
Результат void

HandleListChangedItemMoved() защищенный Метод

Handle ItemMoved event
protected HandleListChangedItemMoved ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
Результат void

HandleListChangedMetadataChanged() защищенный Метод

Handle PropertyDescriptor* events
protected HandleListChangedMetadataChanged ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
Результат void

HandleListChangedReset() защищенный Метод

Handle the Reset event
protected HandleListChangedReset ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
Результат void

HandleListViewBindingContextChanged() защищенный Метод

Handle a change to the BindingContext of our ListView.
protected HandleListViewBindingContextChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void

HandleListViewFreezing() защищенный Метод

Handle the frozenness of our ListView changing.
protected HandleListViewFreezing ( object sender, BrightIdeasSoftware.FreezeEventArgs e ) : void
sender object
e BrightIdeasSoftware.FreezeEventArgs
Результат void

HandleListViewSelectedIndexChanged() защищенный Метод

Handle the selection changing in our ListView. We need to tell our currency manager about the new position.
protected HandleListViewSelectedIndexChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void

InitializeDataSource() защищенный Метод

The data source for this control has changed. Reconfigure the control for the new source
protected InitializeDataSource ( ) : void
Результат void

RebindDataSource() защищенный Метод

Our data source has changed. Figure out how to handle the new source
protected RebindDataSource ( ) : void
Результат void

RebindDataSource() защищенный Метод

Our data source has changed. Figure out how to handle the new source
protected RebindDataSource ( bool forceDataInitialization ) : void
forceDataInitialization bool
Результат void

SetListContents() защищенный Метод

Take the contents of the currently bound list and put them into the control
protected SetListContents ( ) : void
Результат void

ShouldCreateColumn() защищенный Метод

Decide if a new column should be added to the control to display the given property
protected ShouldCreateColumn ( PropertyDescriptor property ) : bool
property System.ComponentModel.PropertyDescriptor
Результат bool

UnbindDataSource() защищенный Метод

protected UnbindDataSource ( ) : void
Результат void

UnbindListView() защищенный Метод

protected UnbindListView ( ObjectListView olv ) : void
olv ObjectListView
Результат void