Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 private void OnTimerFired(object state)
 {
     if (this.TransportState == TransportState.PLAYING)
     {
         IUPnPServiceCallback x = this;
         x.StateVariableChanged(_service, "RelTime", _timeSpanBase.Add(DateTime.Now - _baseTime));
     }
 }
Esempio n. 3
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;
        }
Esempio n. 4
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);
            }
        }