The Railroad To Properties

Below you will find a railroad diagram depicting the language of property pattern composition provided by Property Framework 3.0.

Any description made in this language starts with Reloadable<T>.On() where T is the type of the described property. Then you can use other words to complete the description. Most words are in fact function calls so we present them with parantheses and we give them numbers so you can easily find a detailed description for every word you choose.

Reading the diagram:
  • Start on the left edge and follow the tracks.
  • The ovals you encounter contain words (numbering is for reference only).
  • Replace '..' by the relevant parameters.
  • Whatever sequence of words you can make by following the tracks is supported.
Word descriptions contain parameter types, explanations, and the following marks:

 
- Supported in .Net Framwork 3.5 version of PF.

 
- Supported in .Net Framwork 4 version of PF.

 
- Supported in .Net Framwork 4.5 version of PF.

 
- Supported in Windows Phone 8 version of PF.

 
- Requires Reactive Extensions.

 
- Has a bool testMode parameter which if true disables the word.



1 .Reactive()



Specify that new property values will be supplied in the form of an observable sequence.

.Reactive(Func<Func<T>,IObservable<T>>)

You can specify your own way of producing such sequences from generating functions.

2 .Async()



Specify that the sequence of values should be subscribed on a new thread and observed on the Dispatcher thread.

The bool parameter allows to disable the function (may be helpful in test mode). True - the function is disabled, false or nothing - it is enabled.

.Async(Control)

A Windows Forms variant of the above function. The control parameter is used to extract the UI thread info.

3 .Modify(Func<IObsrvable<T>,IObservable<T>>)



Specify how the loading sequence should be modified.

4 .Worker()



Specify that values should be loaded using BackgroundWorker.

5 .Catch(Action<Exception>)



Specify how loading-time exceptions should be handled.

6 .Retry(int)



Specify that the loading can be attempted again if it fails. You can provide the maximum number or tries.

7 .Timeout(TimeSpan)



Specify the maximum period of time the loading process can take. If loading a value takes more than the specified amount of time, an exception is thrown.

8 .First()



Specify that the process will run only the first time it is triggered.

9 .Odd()



Specify that the process will run each odd time it is triggered.

10 .Delayed(TimeSpan)



Specify that the process will run each time the specified period of time passes since the last time it is triggered.

11 .Throttle(TimeSpan)



Specify that the process will run each time the specified period of time passes since the last time it is triggered.

.Throttle(TimeSpan, Control)

A Windows Forms variant of the above function. The control parameter is used to extract the UI thread info.

12 .Conditional(Func<bool>)



Specify a condition to decide if the loading process should be triggered.

.Conditional<T,TState>(Func<TState, TState>, Func<TState, bool>)

You can base the loading condition on the state specifically stored inside the property. You will have to define how a new condition state should be produced from the previous one and how it should be used to decide if the loading process should be triggered.

13 .Filtered(Func<IObservable<object>, IObservable<object>>)



Specify that triggering signals of the loading process presented as an observable sequence should pass the specified filter.

.Filtered<T,TState>(Func<TState, TState>, Func<IObservable<TState>, IObservable<TState>>)

You can base the filter condition on the state specifically stored inside the property. You will have to define how a new condition state should be produced from the previous one and how the sequence of such values representing the sequence of the triggering signals should be filtered.

14 .Get(Func<T, T>)



Specify that the loading process should be triggered when the getter of the property's Value is accessed. You have to specify how a new property's value should be produced from the previous one.

15 .Call(Func<T, T>)



Specify that the loading process should be triggered when the property's Go() method is called.
You have to specify how a new property's value should be produced from the previous one.

16 .CallGet(Func<T, T>)



Specify that the loading process should be triggered when the property's Go() method is called or the getter of the property's Value is accessed.
You have to specify how a new property's value should be produced from the previous one.

17 .Input()



Specify that the loading process should be triggered when the property's Input is set.

18 .CheckInput(Func<T, string>)



Specify that the loading process should be triggered when the property's Input is set.
The property's Value will be validated using IDataErrorInfo interface. You have to specify a function that will relate each property value to a respective error string.

19 .ValidationInput(Func<T, IEnumerable<string>>)



Specify that the loading process should be triggered when the property's Input is set.
The property's Value will be validated using NotifyIDataErrorInfo interface. You have to specify a function that will relate each property value to a respective sequence of error strings.


Connecting Properties


Properties change their values. The events related to this change can act as triggers for various actions. Some properties provide means to control them. For these properties we can specify sources of control.

Property Framework provides extension methods that allow us to use the above facts to our advantage. Below is the list of such methods.

IDisposable OnChanging<T>(this IProperty<T>, Action)



Assembly : Property.Chains

Create a subscription that will run the specified action everytime a new value is about to be set for the property.

IDisposable OnChanging<T>(this IProperty<T>, params Func<ICallDriven>[])

You can specify which objects you want to call when the event fires.

IDisposable OnChanging<T>(this IProperty<T>, Func<ICallDriven>)

Special variant for one target object.

IDisposable OnChanged<T>(this IProperty<T>, Action)



Assembly : Property.Chains

Create a subscription that will run the specified action everytime the value of the specified property is set.

IDisposable OnChanged<T>(this IProperty<T>, params Func<ICallDriven>[])

You can specify which objects you want to call when the event fires.

IDisposable OnChanged<T>(this IProperty<T>, Func<ICallDriven>)

Special variant for one target object.

IDisposable FromObservable<T>(this ICallDriven, IObservable<T>)



Assembly : Property.Reactive

Create a subscription that will use the specified observable sequence as a sequence of calls to the object.

IDisposable FromObservable<T>(this IInput<T>, IObservable<T>)



Assembly : Property.Reactive

Create a subscription that will use the specified observable sequence as an input for the object.

IObservable<T> ToObservable<T>(this IProperty<T>)



Assembly : Property.Reactive

Unfold the value of the property into an observable sequence.



Last edited Oct 3, 2013 at 10:21 PM by Vitaly_Kamiansky, version 30

Comments

No comments yet.