Namespace: Semata.ControlsCLR
EditableDataManager manages the currently selected IEditableData object.
The object itself is accessed throught the property Data.
It allows: the object to be edited and deleted; a new object to be created; and a edits to be cancelled.
It provides commands that can be bound to to do this, or the methods themselves can be called.
It coordinates with the SelectorDetailSource to prevent the selected item being changed will edits are active.
public ref class EditableDataManager : public INotifyPropertyChanged, INotifyStateChanged
Implements: INotifyPropertyChanged , INotifyStateChanged
Constructors
Name | Description |
EditableDataManager(IEditableDataSource^, Func<IEditableData>^, Func<IEditableData, bool>, Func<IEditableData, bool>, EditingMode^) |
Construct a new instance of EditableDataManager. |
Events
Name | Description |
PropertyChanged |
Raised when object beging edited raises PropertyChanged |
StateChanged |
Raised when object beging edited raises StateChanged |
Properties
Name | Description |
CanCancelEdit |
Can CancelEditCommand be executed |
CanDeleteData |
Can DeleteCommand be executed |
CanEditData |
Can EditCommand be executed |
CanNewData |
Can NewCommand be executed |
CanSaveData |
Can SaveCommand be executed |
CancelCommand |
If the object has been changed, allows the edits to be cancelled by calling IEditableData.CancelEdit |
Creator |
Creator delegate |
Data |
Currently edited object |
DeleteCommand |
If there are no pending edits, deletes the object selected by the selector. |
EditCommand |
If there are no pending edits, sets the object beging edited to that selected by the selector. |
IsChanged |
True if there is a currently edited object, and it has been changed |
IsOkToCancel |
True if either the currently edited object has not been changed, or delegate passed tpo instructor returns true. |
Mode |
Editing Mode |
NewCommand |
If there are no pending edits, sets the object beging edited to the result of calling Creator() |
SaveCommand |
If the object has been changed, allows the object to be written by calling IEditableData.Write |
Methods
Name | Description |
CancelEdit(bool) |
If there are no changes or it is ok to cancel calls IEditableData.CancelEdit. If the editing mode is AutoNew, sets the object beging edited to the result of calling Creator(). If the editing mode is AutoEdit, sets the object beging edited to the object selected by the selector. Otherwise, sets the object beging edited to null. |
DeleteData(bool) |
If there are no changes or it is ok to cancel calls IEditableData.CancelEdit on the object selected by the selector. |
EditData() |
Sets the object beging edited to that selected by the selector. |
NewData() |
Sets the object beging edited to the result of calling Creator() |
SaveData() |
If there is a object beging edited calls IEditableData.Write, and then selects it in the Selector. If the editing mode is AutoNew, sets the object beging edited to the result of calling Creator(). If the editing mode is AutoEdit, the object beging edited is unchanged. Otherwise, sets the object beging edited to null. |
SetSelectedItem(IEditableData^) |
Used by the Selector to set the currently selected object |