Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: ObservableListBind/Property - Add a user definable exception handling routine that is called if an exception occurs when synchronizing. #7

Open
gsonnenf opened this issue Feb 23, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@gsonnenf
Copy link
Owner

gsonnenf commented Feb 23, 2023

In IObservableListBind{TItemA,TItemB}, IObservablePropertyBinder add a user definable exception handling routine that is called if an exception occurs when synchronizing and a dirty flag for when a synchronization did not complete successfully.

This would replace the need for the following if exceptions are expected during synchronization:

try { //need for every Add
listA.Add(item);
catch Exception() {
 if (listA.Count != listB.Count) listA.List.Remove(item);
}

with something like this:

obvListBind.SyncExceptionHandler += (sourceList, targetList, eventArgs) => { //Only defined once
if (!obvListBind.IsDirty) return;
if (eventArgs.Action == NotifyCollectionChangedAction.Add)  sourceList.List.RemoveAt(eventArgs.NewStartingIndex);
// ... other events
@gsonnenf gsonnenf added the enhancement New feature or request label Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant