示例#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
        }
        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
        }