public override void StateVariableChanged(UPnPService pus, string pcwszStateVarName, object vaValue)
        {
            try
            {
                IUPnPServiceCallback callback = (IUPnPServiceCallback)connection.Target;
                if (callback == null)
                {
                    return;
                }

                XPathDocument  doc = new XPathDocument(new StringReader((string)vaValue));
                XPathNavigator nav = doc.CreateNavigator();

                foreach (XPathNavigator node in nav.Select(XPath.Expressions.EventElements))
                {
                    XPathNavigator val = node.SelectSingleNode(XPath.Expressions.ValueAttributes);

                    if (String.CompareOrdinal(val.Value, "NOT_IMPLEMENTED") != 0)
                    {
                        callback.StateVariableChanged(pus, node.LocalName, val.Value);
                    }
                }
            }
            finally
            {
                Marshal.ReleaseComObject(pus);
            }
        }
Exemple #2
0
 private void OnTimerFired(object state)
 {
     if (this.TransportState == TransportState.PLAYING)
     {
         IUPnPServiceCallback x = this;
         x.StateVariableChanged(_service, "RelTime", _timeSpanBase.Add(DateTime.Now - _baseTime));
     }
 }
Exemple #3
0
        public virtual void StateVariableChanged(UPnPService pus, string pcwszStateVarName, object vaValue)
        {
            try
            {
                IUPnPServiceCallback callback = (IUPnPServiceCallback)connection.Target;
                if (callback == null)
                {
                    return;
                }

                callback.StateVariableChanged(pus, pcwszStateVarName, vaValue);
            }
            finally
            {
                Marshal.ReleaseComObject(pus);
            }
        }
Exemple #4
0
        void IUPnPServiceCallback.ServiceInstanceDied(UPnPService pus)
        {
            try
            {
                IUPnPServiceCallback callback = (IUPnPServiceCallback)connection.Target;
                if (callback == null)
                {
                    return;
                }

                callback.ServiceInstanceDied(pus);
            }
            finally
            {
                Marshal.ReleaseComObject(pus);
            }
        }
Exemple #5
0
        void AVTransport_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName != "LastChange")
            {
                return;
            }

            PositionInfo         pi = GetPositionInfo();
            IUPnPServiceCallback x  = this;

            if (pi.TrackDuration.HasValue)
            {
                x.StateVariableChanged(_service, "TrackDuration", pi.TrackDuration.Value);
            }
            if (pi.RelTime.HasValue)
            {
                x.StateVariableChanged(_service, "RelTime", (_timeSpanBase = pi.RelTime.Value));
            }
            _baseTime = DateTime.Now;
        }
 public ServiceCallback(IUPnPServiceCallback outer)
 {
     connection = new WeakReference(outer);
 }
 public AVTransportCallback(IUPnPServiceCallback outer)
     : base(outer)
 {
 }
Exemple #8
0
 public ServiceCallback(IUPnPServiceCallback outer)
 {
     connection = new WeakReference(outer);
 }
 public AVTransportCallback(IUPnPServiceCallback outer) : base(outer)
 {
 }