Example #1
0
 private void toolStripMenuItem5_Click(object sender, EventArgs e)
 {
     if (AnswerCard.Card_Test() == 1)
     {
         loadNofityForm("\r亲爱的老师\r\n可以开始上课啦!", 0, 10);
     }
     else
     {
         loadNofityForm("\r\n请检查接收器是否插好?", 0, 10);
     }
 }
Example #2
0
        private void Thread_CheckDeviceStatus()
        {
            int lastCode = 0;
            int nOK      = 0;

            while (true)
            {
                bool     bOK_360 = false;
                bool     bOK_HD  = false;
                string   hdip    = Global.getHDIP();
                string   localip = GetInternalIPList();
                string[] szIP    = localip.Split(',');
                if (szIP.Length == 1)
                {
                    string ip = szIP[0];
                    Log.Debug("Thread_CheckDeviceStatus1 ip=" + ip);
                    //string ip_4 = ip.Substring(ip.LastIndexOf(".") + 1);
                    if (ip == "172.18.201.3")
                    {
                        bOK_360 = true;
                    }
                }
                else
                {
                    foreach (string ip in szIP)
                    {
                        //string ip_4 = ip.Substring(ip.LastIndexOf(".") + 1);
                        if (ip == "172.18.201.3")
                        {
                            bOK_360 = true;
                            break;
                        }
                    }
                }

                //check答题卡
                {
                    if (AnswerCard.Card_Test() == 1)
                    {
                        bOK_HD = true;
                        if (fNotify != null)
                        {
                            fNotify.showImg();
                            fNotify.setImgUrl(Global.startPath + "myCode.jpg");
                        }
                        else
                        {
                            fNotify = new FormNotify("", "", 10);
                        }
                    }
                    else
                    {
                        if (AnswerCard.Card_Test() == 1)
                        {
                            bOK_HD = true;
                            if (fNotify != null)
                            {
                                fNotify.showImg();
                            }
                            else
                            {
                                fNotify = new FormNotify("", "", 10);
                            }
                        }
                        else
                        {
                            if (fNotify != null)
                            {
                                fNotify.hideImg();
                            }
                            else
                            {
                                fNotify = new FormNotify("", "", 10);
                            }
                        }
                    }
                }
                int code = 0;

                int Sec = 3 * 1000;
                if (!bOK_360)
                {
                    if (bOK_HD)
                    {
                        code = -1;
                    }
                    else
                    {
                        code = -3;
                    }
                }
                else
                {
                    if (bOK_HD)
                    {
                        code = 0;
                    }
                    else
                    {
                        code = -2;
                    }
                }
                //Log.Debug("Thread_CheckDeviceStatus code=" + code);
                int bHide = 0;
                if (code != lastCode)
                {
                    bFormNotifyClosed = false;
                }

                if (code == 0 && lastCode == 0 && nOK >= 3)
                {
                    bHide = 1;
                }
                else
                {
                    bHide = 0;
                }

                if (!bFormNotifyClosed)
                {
                    if (code == -1)
                    {
                        loadNofityForm("\r亲爱的老师\r\n可以开始上课啦!", 0, 10);
                        nOK = 0;
                    }
                    else if (code == -2)
                    {
                        //应付演示
                        //("很抱歉, 连接采集器失败!\r\n请检查采集器的参数是否正常!\r\n接收机IP:" + Global.getHDIP() + "\r\n本机IP:" + GetLocalIP_1(), bHide, 1000);
                        loadNofityForm("\r\n请检查接收器是否插好?", 0, 10);
                        nOK = 0;
                    }
                    else if (code == -3)
                    {
                        //("很抱歉,本机IP地址配置错误!", bHide, 1000);//\r\n采集器参数或网络异常!
                        loadNofityForm("\r\n请检查接收器是否插好?", 0, 10);
                        nOK = 0;
                    }
                    else
                    {
                        loadNofityForm("\r亲爱的老师\r\n可以开始上课啦!", 0, 10);
                        nOK++;
                    }
                }
                lastCode = code;

                Thread.Sleep(Sec);
            }
        }