Exemple #1
0
        void CheckYarpConnections(object source, ElapsedEventArgs e)
        {
            #region PortExists-> dataBaseStatus_OUT
            if (yarpPortStatusDB != null && yarpPortStatusDB.PortExists(dataBaseStatus_OUT))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (DBModStatus.Fill == System.Windows.Media.Brushes.Red)
                    {
                        DBModStatus.Fill = System.Windows.Media.Brushes.Green;
                        decodingThread   = new System.Threading.Thread(new ThreadStart(decodeLoop));

                        decodingThread.Start();
                    }
                }));
            }
            else if (yarpPortStatusDB != null && !yarpPortStatusDB.PortExists(dataBaseStatus_OUT))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (DBModStatus.Fill == System.Windows.Media.Brushes.Green)
                    {
                        DBModStatus.Fill = System.Windows.Media.Brushes.Red;
                        decodingThread.Abort();
                    }
                }));
            }
            #endregion


            #region NetworkExists
            if (yarpPortStatusDB != null && yarpPortStatusDB.NetworkExists())
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (YarpServerStatus.Fill == System.Windows.Media.Brushes.Red)
                    {
                        YarpServerStatus.Fill = System.Windows.Media.Brushes.Green;
                    }
                }));
            }
            else if (yarpPortStatusDB != null && !yarpPortStatusDB.NetworkExists())
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (YarpServerStatus.Fill == System.Windows.Media.Brushes.Green)
                    {
                        YarpServerStatus.Fill = System.Windows.Media.Brushes.Red;
                    }
                }));
            }
            #endregion
        }
        void CheckYarp(object source, ElapsedEventArgs e)
        {
            #region check yarp server
            if (yarpPortReceive != null && yarpPortReceive.NetworkExists())
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (YarpServerStatus.Fill == Brushes.Red)
                    {
                        YarpServerStatus.Fill = Brushes.Green;
                    }
                }));
            }
            else if (yarpPortReceive != null && !yarpPortReceive.NetworkExists())
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (YarpServerStatus.Fill == Brushes.Green)
                    {
                        YarpServerStatus.Fill = Brushes.Red;
                    }
                }));
            }
            #endregion

            #region check leap frame sender
            if (yarpPortReceive != null && yarpPortReceive.PortExists(ConfigurationManager.AppSettings["LeapSender"]))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (FrameSenderStatus.Fill == Brushes.Red)
                    {
                        FrameSenderStatus.Fill = Brushes.Green;
                    }
                }));
            }
            else if (yarpPortReceive != null && !yarpPortReceive.PortExists(ConfigurationManager.AppSettings["LeapSender"]))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (FrameSenderStatus.Fill == Brushes.Green)
                    {
                        FrameSenderStatus.Fill = Brushes.Red;
                    }
                }));
            }
            #endregion
        }
Exemple #3
0
        public SaliencyModule()
        {
            var dllDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + dllDirectory);


            InitializeComponent();

            kinect = new KinectOne();
            kinect.InitializeCamera();

            kinect.OnColorFrameArrived(OnColorFrameArrived);

            yarpPort = new YarpPort();
            yarpPort.openSender(portName);

            if (yarpPort != null && yarpPort.NetworkExists())
            {
                lblYarpServer.Text = "YarpServer: runnig...";
                lblYarpPort.Text   = "YarpPort : " + portName;
            }



            InitSaliency();



            lblStatus.Text = "running...";
        }
Exemple #4
0
        public ShoreModule()
        {
            var dllDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + dllDirectory);

            InitializeComponent();



            if (File.Exists(dllDirectory + "\\Shore140.dll"))
            {
                kinect = new KinectOne();
                kinect.InitializeCamera();

                kinect.OnColorFrameArrived(OnColorFrameArrived);

                yarpPort = new YarpPort();
                yarpPort.openSender(portName);

                if (yarpPort != null && yarpPort.NetworkExists())
                {
                    lblYarpServer.Text = "YarpServer: runnig...";
                    lblYarpPort.Text   = "YarPort: " + portName;
                }

                InitShoreEngine();
                lblStatus.Text = "running...";
            }
            else
            {
                lblStatus.Text     = "No Library SHORE";
                lblYarpServer.Text = "YarpServer:";
            }


            //senderYarp = new System.Threading.Thread(SendData);
            //senderYarp.Start();
        }
        void CheckYarpLeap(object source, ElapsedEventArgs e)
        {
            #region check yarp server
            if (yarpPort != null && yarpPort.NetworkExists())
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (YarpServerStatus.Fill == Brushes.Red)
                    {
                        YarpServerStatus.Fill = Brushes.Green;
                    }
                }));
            }
            else if (yarpPort != null && !yarpPort.NetworkExists())
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (YarpServerStatus.Fill == Brushes.Green)
                    {
                        YarpServerStatus.Fill = Brushes.Red;
                    }
                }));
            }
            #endregion

            #region check leap sensor
            if (controller != null && controller.IsConnected)
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (LeapSensorStatus.Fill == Brushes.Red)
                    {
                        LeapSensorStatus.Fill = Brushes.Green;
                    }
                }));
            }
            else if (controller != null && !controller.IsConnected)
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (LeapSensorStatus.Fill == Brushes.Green)
                    {
                        LeapSensorStatus.Fill = Brushes.Red;
                    }
                }));
            }
            #endregion

            #region check leap sensor focus
            if (controller != null && controller.HasFocus)
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (LeapFocusStatus.Fill == Brushes.Red)
                    {
                        LeapFocusStatus.Fill = Brushes.Green;
                    }
                }));
            }
            else if (controller != null && !controller.HasFocus)
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (LeapFocusStatus.Fill == Brushes.Green)
                    {
                        LeapFocusStatus.Fill = Brushes.Red;
                    }
                }));
            }
            #endregion
        }
        void CheckYarp(object source, ElapsedEventArgs e)
        {
            #region check yarp server
            if (yarpPortHands != null && yarpPortHands.NetworkExists())
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (YarpServerStatus.Fill == Brushes.Red)
                    {
                        YarpServerStatus.Fill = Brushes.Green;
                    }
                }));
            }
            else if (yarpPortHands != null && !yarpPortHands.NetworkExists())
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (YarpServerStatus.Fill == Brushes.Green)
                    {
                        YarpServerStatus.Fill = Brushes.Red;
                    }
                }));
            }
            #endregion

            #region check hands sender
            if (yarpPortHands != null && yarpPortHands.PortExists(ConfigurationManager.AppSettings["HandsSender"]))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (HandsStatus.Fill == Brushes.Red)
                    {
                        HandsStatus.Fill = Brushes.Green;
                    }
                }));
            }
            else if (yarpPortHands != null && !yarpPortHands.PortExists(ConfigurationManager.AppSettings["HandsSender"]))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (HandsStatus.Fill == Brushes.Green)
                    {
                        HandsStatus.Fill = Brushes.Red;
                    }
                }));
            }
            #endregion

            #region check posture
            if (yarpPortPosture != null && yarpPortPosture.PortExists(ConfigurationManager.AppSettings["PostureSender"]))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (PostureStatus.Fill == Brushes.Red)
                    {
                        PostureStatus.Fill = Brushes.Green;
                    }
                }));
            }
            else if (yarpPortPosture != null && !yarpPortPosture.PortExists(ConfigurationManager.AppSettings["PostureSender"]))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (PostureStatus.Fill == Brushes.Green)
                    {
                        PostureStatus.Fill = Brushes.Red;
                    }
                }));
            }
            #endregion

            #region check gesture
            if (yarpPortGesture != null && yarpPortGesture.PortExists(ConfigurationManager.AppSettings["GestureSender"]))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (GestureStatus.Fill == Brushes.Red)
                    {
                        GestureStatus.Fill = Brushes.Green;
                    }
                }));
            }
            else if (yarpPortGesture != null && !yarpPortGesture.PortExists(ConfigurationManager.AppSettings["GestureSender"]))
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new Action(delegate()
                {
                    if (GestureStatus.Fill == Brushes.Green)
                    {
                        GestureStatus.Fill = Brushes.Red;
                    }
                }));
            }
            #endregion
        }