Пример #1
0
        private void Theout(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (Interlocked.Exchange(ref inTimer, 1) == 0)
            {
                //string data = Common.GetXitiResult();//FormPPTPractise
                string data = Global.AnswerStu;
                if (data.Length > 0)
                {
                    Log.Info("xiti.get=" + data);
                    DateTime tm_now         = DateTime.Now;
                    TimeSpan createtimespan = new TimeSpan(tm_create.Ticks);
                    TimeSpan nowtimespan    = new TimeSpan(tm_now.Ticks);
                    TimeSpan timespan       = nowtimespan.Subtract(createtimespan).Duration();
                    int      timeDiff       = timespan.Minutes * 60 + timespan.Seconds;

                    for (int i = 0; i < data.Split('|').Length; i++)
                    {
                        string temp = data.Split('|')[i].Split(':')[0].ToString().Replace("-", "");
                        int    num  = Convert.ToInt16(Global.getSeatByCardid(temp));
                        //int num = Convert.ToInt16(data.Split('|')[i].Split(':')[0].ToString().Replace("-", ""));
                        string answer  = data.Split('|')[i].Split(':')[1];
                        string context = num + ":" + answer + ":" + timeDiff;
                        Log.Info("vote.item=" + context);
                        if (answer.Length > 1)
                        {
                            answer = answer.Substring(answer.Length - 1);
                        }
                        statisticABCD(num, answer);
                        VoteColumnEvent(answer, pictureBox_A);
                    }
                    Httpd.NotifyVoteEvent();
                }
                Interlocked.Exchange(ref inTimer, 0);
            }
        }
Пример #2
0
        private void Theout(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (Interlocked.Exchange(ref inTimer, 1) == 0)
            {
                string data = Common.GetXitiResult();//FormPPTPractise  data--"2:cd"
                data = Global.AnswerStu;
                //Global.AnswerStu = "";

                if (data.Length > 0)
                {
                    Log.Info("xiti.get=" + data);
                    DateTime tm_now         = DateTime.Now;
                    TimeSpan createtimespan = new TimeSpan(tm_create.Ticks);
                    TimeSpan nowtimespan    = new TimeSpan(tm_now.Ticks);
                    TimeSpan timespan       = nowtimespan.Subtract(createtimespan).Duration();
                    int      timeDiff       = timespan.Minutes * 60 + timespan.Seconds;

                    for (int i = 0; i < data.Split('|').Length; i++)
                    {
                        string temp   = data.Split('|')[i].Split(':')[0].ToString().Replace("-", "");
                        string strNum = Global.getSeatByCardid(temp);
                        if (strNum == "")
                        {
                            continue;
                        }
                        int num = Convert.ToInt16(strNum);
                        // int num = Convert.ToInt16(data.Split('|')[i].Split(':')[0].ToString().Replace("-", ""));
                        string answer  = data.Split('|')[i].Split(':')[1];
                        string context = num + ":" + answer + ":" + timeDiff;
                        if (m_hashtable.Contains(num))
                        {
                            m_hashtable.Remove(num);
                        }
                        m_hashtable.Add(num, answer + ":" + timeDiff);
                        statisticABCD();
                        Log.Info("xiti.item=" + context);

                        for (int j = 0; j < al.Count; j++)
                        {
                            PictureBox lb   = (PictureBox)al[j];
                            PictureBox text = (PictureBox)alText[j];
                            if ((num - 1) == j && (int)clickstate[j] == 0)
                            {
                                Log.Info("xiti.changeState " + j);
                                LabelStateEvent(context, lb, text, j + 1);
                                clickstate[j] = 1;
                            }
                        }
                    }
                }
                Interlocked.Exchange(ref inTimer, 0);
            }
        }
Пример #3
0
        private void Theout(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (Interlocked.Exchange(ref inTimer, 1) == 0)
            {
                string data = Common.GetHandon();
                data            = Global.RaiseStu;
                Global.RaiseStu = "";
                if (data.Length > 0)
                {
                    Log.Info("xiti.get=" + data);
                    DateTime tm_now         = DateTime.Now;
                    TimeSpan createtimespan = new TimeSpan(tm_create.Ticks);
                    TimeSpan nowtimespan    = new TimeSpan(tm_now.Ticks);
                    TimeSpan timespan       = nowtimespan.Subtract(createtimespan).Duration();
                    int      timeDiff       = timespan.Minutes * 60 + timespan.Seconds;

                    for (int i = 0; i < data.Split('|').Length; i++)
                    {
                        // int num = Util.toInt(data.Split('|')[i]);
                        int    num     = Util.toInt(Global.getSeatByCardid(data.Split('|')[i]));
                        string context = num + ":" + timeDiff;
                        Log.Info("QiangDa.item=" + context);
                        string      name   = "";
                        string      imgurl = "";
                        StudentInfo si     = Global.getUserInfoBySeat(num);
                        if (si != null && i == 0)     ///添加i==0条件,解决抢答前后端显示不一样问题;
                        {
                            name   = si.Name;
                            imgurl = si.imageurl;
                        }
                        else
                        {
                            continue;
                        }
                        Log.Info("HandonEvent. id=" + num + ", imgurl=" + imgurl);

                        HandonEvent(num, name, imgurl, pictureBox_headImage);
                        StopT();
                    }
                    //Httpd.NotifyVoteEvent();
                }
                Interlocked.Exchange(ref inTimer, 0);
            }
        }
Пример #4
0
        private void Theout(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (Interlocked.Exchange(ref inTimer, 1) == 0)
            {
                //string data = Common.GetHandon();
                string data = Global.RaiseStu;
                // Global.RaiseStu = "";
                if (data != null && data.Length > 0 && t.Enabled)
                {
                    //Console.WriteLine(data);   //data:2|3
                    DateTime tm_now         = DateTime.Now;
                    TimeSpan createtimespan = new TimeSpan(tm_create.Ticks);
                    TimeSpan nowtimespan    = new TimeSpan(tm_now.Ticks);
                    TimeSpan timespan       = nowtimespan.Subtract(createtimespan).Duration();
                    int      timeDiff       = timespan.Minutes * 60 + timespan.Seconds;
                    Log.Info("Theout. handon=" + data + ", timediff=" + timeDiff);

                    //0-3:56AAA549,H|0-4:56AAA54A,H|
                    string   context = "";
                    string[] szItem  = data.Split('|');
                    for (int i = 0; i < szItem.Length; i++)
                    {
                        string item = szItem[i];
                        item = Global.getSeatByCardid(item);
                        int num = Util.toInt(item);
                        context = num + ":H:" + timeDiff;
                        //updateTop3(num);

                        int _count = 1;
                        if (stuPushCount.Contains(num))
                        {
                            _count = (int)stuPushCount[num] + 1;
                            stuPushCount.Remove(num);
                        }
                        else
                        {
                            IntelligentRecommend.addHandon(num);
                        }
                        stuPushCount.Add(num, _count);
                        Log.Info("Theout. num=" + num + ", count=" + _count);
                        for (int j = 0; j < al.Count; j++)
                        {
                            PictureBox lb   = (PictureBox)al[j];
                            PictureBox text = (PictureBox)alText[j];
                            if ((num - 1) == j) //&& (int)clickstate[j] == 0
                            {
                                LabelStateEvent(context, lb, text, j + 1);
                                clickstate[j] = 1;
                                Log.Info("Theout.LabelStateEvent id=" + num + ", al.Count=" + al.Count + ", ok.");
                            }
                        }
                    }
                }
                else
                {
                    _querytimes++;
                    if (_querytimes > 10 * 3)
                    {
                        HideEvent(true);
                    }
                }
                Interlocked.Exchange(ref inTimer, 0);
            }
        }