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

Does not run in PCL Library #2

Open
pboisso opened this issue May 30, 2017 · 9 comments
Open

Does not run in PCL Library #2

pboisso opened this issue May 30, 2017 · 9 comments

Comments

@pboisso
Copy link

pboisso commented May 30, 2017

Hi guys,

This set of collections seems awesome. Any chance you will build them so they work in PCL Libraries? Would love to give them a try in Xamarin.Forms.

Thanks and keep up the great work.

Patrice

@fjch1997
Copy link
Contributor

I have the same need here. Now that you mentioned it, ill look into this too

@stewienj
Copy link
Owner

The issue with the current version (lets call it version 2) is that it has a dependency on PresentationFramework. At this very minute I have access to an internet connected development machine and I'm isolating out code for the next version (version 3) that doesn't have this dependency, however version 3 doesn't directly replace the framework ConcurrentCollection<> directly. It requires adding a .CollectionView to the path of the ItemsSource items control Binding.

@stewienj
Copy link
Owner

I've added a new version 3 to the repo. I've looked at the dependencies and the roadblock for going to PCL is WindowsBase. This is only used by the VirtualizingCollection which I'm investigating the effects of changing the offending code.

@stewienj
Copy link
Owner

The old collections library had it's own implementation of ImmutableList, and there was the skeleton of the new V3 collections that had a dependency on Microsofts System.Collections.Immutable. The current iteration of V3 still has this dependency.

@fjch1997
Copy link
Contributor

Just got the ConcurrentObservableCollection to compile on PCL Profile7 almost no code change :D

@pboisso
Copy link
Author

pboisso commented May 31, 2017

Wow, you guys are fast ! 👍 I'm happy to do some testing as well when you think it is solid enough to test in a real-world scenario. Do you think v3 is at that point yet?

And I don't think this is a real issue to bind on CollectionView on our end. Can live with this restriction.

Thanks again, great work !

@fjch1997
Copy link
Contributor

I wasn't understanding the CollectionView mechanism. Looks like we are raising PropertyChanged and make it update the entire collection instead of Raising CollectionChanged event? Will it be slower? And why is CollectionChanged even implemented since we are not using it to update the binding?

This is really complicated and it took me a while (trying) to understand. Thanks for all the hard work!

Btw the new VirtualizingCollection looks pretty interesting. Will definitely give it a try next time I'm doing something similar

@stewienj
Copy link
Owner

stewienj commented Jun 1, 2017

I've been using V3 over 2 projects for the last 12 months, gradually improving it and adding required features. Seems solid enough. It should be used with a VirtualizingPanel, as it invalidates the whole CollectionView when it is updated and a VirtualizingPanel will just read out what it needs. V3 is much less hacky than V2. V2 had 2 collections, the 2nd one was updated on the dispatcher thread lazily from a queue of changes that happened to the primary collection. V3 is a wrapper around an ImmutableCollection, when the immutable collection is updated a property changed event is fired, and CollectionView gives you an immutable snapshot that you can enumerate over while the base collection is being changed. Much safer. The CollectionChanged event in V3 still allows you to serialize changes to a listener, but it is now fired on the thread that updated the collection, not the dispatcher, and so should not be used to update the view. I hope that isn't too hard to read and understand. I've done some performance testing and it worked out faster.

I just created an examples directory, and inside that I've put an example application that uses the VirtualizingCollections. It's a CSV text file viewer that can load text files with billions of lines. I've used it for viewing database dumps with too many rows for people to load into Excel witch has a limit of 1,000,000 rows.

@stewienj
Copy link
Owner

stewienj commented Jun 1, 2017

More changes. I've moved all examples and test apps to an ExamplesAndTests directory. To this I've added an app that I used to Validate the new CollectionsV3 classes, and do some performance tests. This is under ExamplesAndTests\Swordfish.NET.TestV3 and is now included in the Solution file. When you run this app you will see a "Run Scripts" button at the bottom of each tab page. When you click this it will run some lengthy tests against multiple collection types, compare their contents, and their performance, and write the results to a log that is displayed in the control and can be copied to the clipboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants