Skip to content
This repository was archived by the owner on Sep 22, 2019. It is now read-only.

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

StatefulModel

these classes are frequent use of stateful Models for M-V-Whatever. PCL(Portable Class Library) & MIT License.

supported

  • .NET Framework 4.5
  • Windows 8
  • Windows Phone Silverlight 8
  • Xamarin.Android
  • Xamarin.iOS
  • Xamarin.iOS(Classic)

License

MIT License.

NotifyCollections

the classes that implement ISynchronizableNotifyChangedCollection < T > have ToSyncedXXX Methods (XXX ... any ISynchronizableNotifyChangedCollection < T >).

ToSyncedXXX Methods is creating one-way synchronized collection with source collection.

imageimage

###Simple Usage

//thread-safe collectionvarsource=newObservableSynchronizedCollection<int>(Enumerable.Range(1,3));// sorted collectionvarsortedSource=newSortedObservableCollection<int,int>(Enumerable.Range(1,4),i =>i);//UI threadvarcontext=newDispatcherSynchronizationContext(Dispatcher.CurrentDispatcher);//SynchronizationContext(send) bouded collection.vardispatcherSource=newSynchronizationContextCollection<int>(Enumerable.Range(1,5),context);

Sync Collections

While creating one-way synchronized collection, this method lock source collection, so no leak items. image

Detach

ISynchronizableNotifyChangedCollection < T > is IDisposable. When Dispose() called , all EventHandler from source collection will be detached. image

EventListeners

PropertyChangedEventListener/CollectionChangedEventListener

//use collection initializervarlistener=newPropertyChangedEventListener(NotifyObject){{"Property1",(sender,e)=>Hoge()},{"Property2",(semder,e)=>Huge()}};listener.RegisterHandler((sender,e)=>Hage());listerer.RegisterHandler("Property3",(semder,e)=>Fuga());//when dispose() called, detach all handlerlisterner.Dispose();

WeakEventListeners

  • PropertyChangedWeakEventListener (PropertyChangedEventListener by weak event)
  • CollectionChangedWeakEventListener (CollectionChangedWeakEventListener by weak event)
  • WeakEventListener (all‐purpose weak event listener)
varbutton=newButton(){Width=100,Height=100};varweakListener=newWeakEventListener<RoutedEventHandler,RoutedEventArgs>(
h =>newRoutedEventHandler(h),
h =>button.Click+=h,
h =>button.Click-=h,(sender,e)=>button.Content="Clicked!!");

Anonymouses

  • AnonymousComparer < T >
  • AnonymousDisposable
  • AnonymousSynchronizationContext etc

Other Classes

  • CompositeDiposable - Rx like CompositeDisposable etc

About

Frequent use of stateful Models for M-V-Whatever. example,synced - ObservableCollection etc.

Resources

Stars

23 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages