public AVRendererDiscovery(DiscoveryHandler OnRendererCallback)
        {
            PollTimer.Interval   = 500;
            PollTimer.OnElapsed += new SafeTimer.TimeElapsedHandler(PollSink);

            _New     = new AVTargetDiscovery.ManagerHandler(AddSink);
            _Removed = new AVTargetDiscovery.ManagerHandler(RemovedSink);

            OnRenderer += OnRendererCallback;
            lock (this)
            {
                if (disco == null)
                {
                    disco = new AVTargetDiscovery();
                }
                if (OnRenderer != null)
                {
                    foreach (AVRenderer r in disco.GetRenderers())
                    {
                        OnRenderer(this, r);
                    }
                }
                disco.AddWeakEvent_OnRenderer(_New);
                disco.AddWeakEvent_RemovedRenderer(_Removed);
            }
            if (AVRendererDiscovery.PollPositionEnabled)
            {
                PollTimer.Start();
            }
        }
コード例 #2
0
ファイル: AVRendererDiscovery.cs プロジェクト: Scannow/SWYH
		public AVRendererDiscovery(DiscoveryHandler OnRendererCallback)
		{
			PollTimer.Interval = 500;
			PollTimer.OnElapsed += new SafeTimer.TimeElapsedHandler(PollSink);

			_New = new AVTargetDiscovery.ManagerHandler(AddSink);
			_Removed = new AVTargetDiscovery.ManagerHandler(RemovedSink);

			OnRenderer += OnRendererCallback;
			lock(this)
			{
				if(disco==null)
				{
					disco = new AVTargetDiscovery();
				}
				if(OnRenderer!=null)
				{
					foreach(AVRenderer r in disco.GetRenderers())
					{
						OnRenderer(this,r);
					}
				}
				disco.AddWeakEvent_OnRenderer(_New);
				disco.AddWeakEvent_RemovedRenderer(_Removed);
			}
			if(AVRendererDiscovery.PollPositionEnabled)
			{
				PollTimer.Start();
			}
		}