Example #1
0
 public void RemoveListener(IPortraitHandler l)
 {
     lock (this.locker)
     {
         this.listeners.Remove(l);
         System.Diagnostics.Debug.WriteLine("listener: " + l.Name + " removed");
     }
 }
 public void RemoveListener(IPortraitHandler l)
 {
     lock (this.locker)
     {
         this.listeners.Remove(l);
         System.Diagnostics.Debug.WriteLine("listener: " + l.Name + " removed");
     }
 }
Example #3
0
        void l_Stopped(object sender, MiscUtil.EventArgs <Exception> e)
        {
            IPortraitHandler handler = sender as IPortraitHandler;

            this.RemoveListener(handler);

            if (e.Value != null)
            {
                System.Diagnostics.Debug.WriteLine(handler.Name + " Exception:" + e.Value.Message);
            }
        }
        public void AddListener(IPortraitHandler l)
        {
            if (l == null)
                throw new ArgumentNullException("l", "l is null.");

            lock (this.locker)
            {
                this.listeners.Add(l);
                System.Diagnostics.Debug.WriteLine("listener: " + l.Name + " added");
            }
        }
Example #5
0
        public void AddListener(IPortraitHandler l)
        {
            if (l == null)
            {
                throw new ArgumentNullException("l", "l is null.");
            }

            lock (this.locker)
            {
                this.listeners.Add(l);
            }
        }
        public void AddListener(IPortraitHandler l)
        {
            if (l == null)
            {
                throw new ArgumentNullException("l", "l is null.");
            }

            lock (this.locker)
            {
                this.listeners.Add(l);
                System.Diagnostics.Debug.WriteLine("listener: " + l.Name + " added");
            }
        }
Example #7
0
        private static void NotifyAListenerWithCopy(
            IEnumerable <Frame> motionFrames,
            IEnumerable <Portrait> portraitList,
            IPortraitHandler listener)
        {
            var frameCpy    = listener.WantFrame ? motionFrames.ToList().ConvertAll(m => m.Clone()) : null;
            var portraitCpy = portraitList.ToList().ConvertAll(p => p.Clone());

            try
            {
                listener.HandlePortraits(frameCpy, portraitCpy);
            }
            catch (System.Exception ex)
            {
                frameCpy.ToList().ForEach(f => f.Dispose());
                portraitCpy.ToList().ForEach(p => p.Dispose());
                throw;
            }
        }
Example #8
0
 public void UnRegisterPortraitHandler(IPortraitHandler handler)
 {
     this.PortraitFinder.RemoveListener(handler);
 }
Example #9
0
 public void RegisterPortraitHandler(IPortraitHandler handler)
 {
     this.PortraitFinder.AddListener(handler);
 }
        private static void NotifyAListenerWithCopy(
            IList<Frame> motionFrames,
            IList<Portrait> portraitList,
            IPortraitHandler listener)
        {
            var frameCpy = listener.WantFrame ? motionFrames.ToList().ConvertAll(m => m.Clone()) : null;
            var portraitCpy = portraitList.ToList().ConvertAll(p => p.Clone());

            try
            {
                listener.HandlePortraits(frameCpy, portraitCpy);
            }
            catch (System.Exception ex)
            {
                frameCpy.ToList().ForEach(f => f.Dispose());
                portraitCpy.ToList().ForEach(p => p.Dispose());
                throw;
            }
        }
 public void UnRegisterPortraitHandler(IPortraitHandler handler)
 {
     this.PortraitFinder.RemoveListener(handler);
 }
 public void RegisterPortraitHandler( IPortraitHandler handler  )
 {
     this.PortraitFinder.AddListener(handler);
 }