Ejemplo n.º 1
0
        private void InfraredSourceWatcher_SourceRemoved(PerceptionInfraredFrameSourceWatcher sender, PerceptionInfraredFrameSourceRemovedEventArgs args)
        {
            int removeIndex = _infraredSourceList.IndexOf(args.FrameSource);

            lbl_IRImage.ForeColor = System.Drawing.Color.Red;
            lbl_IRImage.Text      = "Sensor {0} Unplugged. " + args.FrameSource.DisplayName;
            _infraredSourceList.RemoveAt(removeIndex);
        }
Ejemplo n.º 2
0
 private void DisableInfraredSourceChangedEvents()
 {
     if (_infraredSourceWatcher != null)
     {
         _infraredSourceWatcher.SourceAdded   -= InfraredSourceWatcher_SourceAdded;
         _infraredSourceWatcher.SourceRemoved -= InfraredSourceWatcher_SourceRemoved;
         if (_infraredSourceList.Count > 0)
         {
             _infraredSourceList.Clear();
         }
         _infraredSourceList = null;
         _infraredSourceWatcher.Stop();
         _infraredSourceWatcher = null;
     }
 }
Ejemplo n.º 3
0
        private void InfraredSourceWatcher_SourceAdded(PerceptionInfraredFrameSourceWatcher sender, PerceptionInfraredFrameSourceAddedEventArgs args)
        {
            _infraredSourceList.Add(args.FrameSource);

            if (_infraredSource == null)
            {
                if (OpenInfraredDevice(_infraredSourceList[0]))
                {
                    isCaptured = true;
                }
                else
                {
                    isCaptured = false;
                }
            }
        }
Ejemplo n.º 4
0
        private async void Initialize()
        {
            try
            {
                var infraredAccess = await PerceptionInfraredFrameSource.RequestAccessAsync();

                if (infraredAccess == PerceptionFrameSourceAccessStatus.Allowed)
                {
                    _infraredSourceWatcher = PerceptionInfraredFrameSource.CreateWatcher();
                    EnableInfraredSourceChangedEvents();
                    _infraredSourceWatcher.Start();
                }
            }
            catch (Exception e)
            {
                QuiteApp(false);
            }
        }
 public PerceptionInfraredFrameSourceWatcherEvents(PerceptionInfraredFrameSourceWatcher This)
 {
     this.This = This;
 }