public void NotifyBackground(BackgroundNotificationType type, object value = null, bool ping = false)
        {
            //Debug.WriteLine("MediaPlayerHandle.NotifyBackground() " + _id + ": " + type);

            if (!_subscriptionHandle.IsSubscribed)
            {
                return;
            }

            var key = type.ToString();

            try
            {
                var message = new ValueSet();

                if (null != key)
                {
                    message.Add(key, value);
                }

                if (ping)
                {
                    message.Add("ping", null);
                }

                _notifier.Notify(message);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("MediaPlayerHandle.NotifyBackground() failed: " + ex.ExtendedMessage());
                Close();
            }
        }
        public static void Notify(this IBackgroundMediaNotifier notifier, BackgroundNotificationType type, object value = null)
        {
            //Debug.WriteLine("NotifierExtensions.Notify() " + _id);

            var valueSet = new ValueSet {
                { type.ToString(), value }
            };

            notifier.Notify(valueSet);
        }
        public static void Notify(this IBackgroundMediaNotifier notifier, BackgroundNotificationType type, object value = null)
        {
            //Debug.WriteLine("NotifierExtensions.Notify() " + _id);

            var valueSet = new ValueSet { { type.ToString(), value } };

            notifier.Notify(valueSet);
        }
 public static bool TryGetValue(this ValueSet valueSet, BackgroundNotificationType type, out object value)
 {
     return valueSet.TryGetValue(type.ToString(), out value);
 }
 public static void Add(this ValueSet valueSet, BackgroundNotificationType type, object value = null)
 {
     valueSet.Add(type.ToString(), value);
 }
 public static bool TryGetValue(this ValueSet valueSet, BackgroundNotificationType type, out object value)
 {
     return(valueSet.TryGetValue(type.ToString(), out value));
 }
 public static void Add(this ValueSet valueSet, BackgroundNotificationType type, object value = null)
 {
     valueSet.Add(type.ToString(), value);
 }
Exemple #8
0
        public void NotifyBackground(BackgroundNotificationType type, object value = null, bool ping = false)
        {
            //Debug.WriteLine("MediaPlayerHandle.NotifyBackground() " + _id + ": " + type);

            if (!_subscriptionHandle.IsSubscribed)
                return;

            var key = type.ToString();

            try
            {
                var message = new ValueSet();

                if (null != key)
                    message.Add(key, value);

                if (ping)
                    message.Add("ping", null);

                _notifier.Notify(message);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("MediaPlayerHandle.NotifyBackground() failed: " + ex.ExtendedMessage());
                Close();
            }
        }