Mobile/CafeLib.Mobile/ViewModels/BaseViewModel.cs
/// <summary>
/// Subscribe an action to an event message.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="action"></param>
Subscribe an action to an event message.
Subscribe an action to an event message .
protected void SubscribeEvent<T>(Action<T> action) where T : IEventMessage
        {
            switch (Lifecycle)
            {
                case LifecycleState.Appearing:
                    _onAppearingSubscribers.Add(EventService.SubscribeOnMainThread(action));
                    break;
                case LifecycleState.Initiate: 
                case LifecycleState.Load:
                    _onInitSubscribers.Add(EventService.SubscribeOnMainThread(action));
                    break;
            }
        }
protected void SubscribeEvent < T > ( Action < T > action ) where T : IEventMessage { switch ( Lifecycle ) { case LifecycleState . Appearing : _onAppearingSubscribers . Add ( EventService . SubscribeOnMainThread ( action ) ) ; break ; case LifecycleState . Initiate : case LifecycleState . Load : _onInitSubscribers . Add ( EventService . SubscribeOnMainThread ( action ) ) ; break ; } }
Subscribe an action to an event message.
Subscribe an action to an event message .
// ReSharper disable once SwitchStatementMissingSomeCases
action
Action<T>
None
typeparam
None