コード例 #1
0
 /// <summary>
 /// Observe changes to the AppState of a class derived from ISuspensionHost.
 /// </summary>
 /// <typeparam name="T">The observable type.</typeparam>
 /// <param name="item">The suspension host.</param>
 /// <returns>An observable of the app state.</returns>
 public static IObservable <T> ObserveAppState <T>(this ISuspensionHost item)
     where T : class
 {
     return(item.WhenAny(suspensionHost => suspensionHost.AppState, observedChange => observedChange.Value)
            .Where(x => x != null)
            .Cast <T>());
 }
コード例 #2
0
        /// <summary>
        /// Observe changes to the AppState of a class derived from ISuspensionHost.
        /// </summary>
        /// <typeparam name="T">The observable type.</typeparam>
        /// <param name="item">The suspension host.</param>
        /// <returns>An observable of the app state.</returns>
        public static IObservable <T> ObserveAppState <T>(this ISuspensionHost item)
            where T : class
        {
            if (item is null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            return(item.WhenAny(suspensionHost => suspensionHost.AppState, observedChange => observedChange.Value)
                   .WhereNotNull()
                   .Cast <T>());
        }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="This"></param>
 /// <returns></returns>
 public static IObservable <T> ObserveAppState <T>(this ISuspensionHost This)
 {
     return(This.WhenAny(x => x.AppState, x => (T)x.Value)
            .Where(x => x != null));
 }
コード例 #4
0
 /// <summary>
 /// Observe changes to the AppState of a class derived from ISuspensionHost.
 /// </summary>
 /// <typeparam name="T">The observable type.</typeparam>
 /// <param name="item">The suspension host.</param>
 /// <returns>An observable of the app state.</returns>
 public static IObservable <T> ObserveAppState <T>(this ISuspensionHost item)
     where T : class
 {
     return(item.WhenAny(x => x.AppState, x => (T)x.Value)
            .Where(x => x != null));
 }