예제 #1
0
        /// <summary>
        ///  The "entry point" of the reducer. The store will call here when it has a
        ///  new action to be processed.1
        /// </summary>
        public static SampleState Root(SampleState state, Object action)
        {
            var name   = Reducers.Name(state.Name, action);
            var number = Reducers.Number(state.Number, action);
            var items  = Reducers.Items(state.Items, action);

            return(new SampleState(name, number, items));
        }
예제 #2
0
 /// <summary>
 ///  Retrieve the number.
 /// </summary>
 public static Int32 Number(SampleState state)
 {
     return(state.Number);
 }
예제 #3
0
 /// <summary>
 ///  Retrieve the item at the specified index of the item collection.
 /// </summary>
 /// <returns>
 ///  The item at the specified index if one is available, or <c>null</c>.
 /// </returns>
 public static String Item(SampleState state, Int32 index)
 {
     return((index >= 0 && index < state.Items.Count)
                         ? state.Items[index]
                         : null);
 }
예제 #4
0
 /// <summary>
 ///  Retrieve the name.
 /// </summary>
 public static String Name(SampleState state)
 {
     return(state.Name);
 }