コード例 #1
0
        private void Theout(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (Interlocked.Exchange(ref inTimer, 1) == 0)
            {
                string data = Common.GetXitiResult();//FormPPTPractise
                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     = 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.GetXitiResult();//Form2
                if (data != null && data.Length > 0)
                {
                    Log.Info("Form2_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     = 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);
                        //Httpd.setPracticeResult(context);//同步给httpd
                        statisticABCD();

                        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("Form2_xiti. LabelStateEvent index=" + (j + 1));
                                LabelStateEvent(context, lb, text, j + 1);
                                clickstate[j] = 1;
                            }
                        }
                    }
                }
                Interlocked.Exchange(ref inTimer, 0);
            }
        }
コード例 #4
0
        private void Theout(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (Interlocked.Exchange(ref inTimer, 1) == 0)
            {
                string json = "";
                if (mode == 1)
                {
                    json = Common.GetHandon();
                }
                else
                {
                    json = Common.GetXitiResult();
                }

                Log.Debug("Theout.  " + json);

                string data = json;

                if (data.Length > 0)
                {
                    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];
                        int    num    = Convert.ToInt16(item.Split(':')[0].ToString());
                        string answer = "";
                        if (mode == 1)
                        {
                            answer = "H";
                        }
                        else
                        {
                            answer = item.Split(':')[1];
                        }
                        string groupname = getGroup(num);
                        context = groupname + ":" + answer + ":" + timeDiff;

                        Httpd.setGroupResult(context);

                        int _count = 1;
                        if (stuPushCount.Contains(num))
                        {
                            _count = (int)stuPushCount[num] + 1;
                            stuPushCount.Remove(num);
                        }
                        stuPushCount.Add(num, _count);

                        if (_resutlSet.Contains(num))
                        {
                            ;//重复按
                        }
                        else
                        {
                            //_resutlSet.Add(num);//20160520 不缓存,因为经常导致不通知PAD。
                            Log.Debug("LabelStateEvent id=" + num + ",group=" + groupname + ", al.Count=" + al.Count);

                            if (Global.m_grouplist != null)
                            {
                                int     groupsize = Global.m_grouplist.grouplist.Length;
                                Group[] szGroup   = Global.m_grouplist.grouplist;
                                for (int j = 0; j < groupsize; j++)
                                {
                                    PictureBox lb   = (PictureBox)al[j];
                                    PictureBox text = (PictureBox)alText[j];

                                    if (szGroup[j].name == groupname && (int)clickstate[j] == 0)
                                    {
                                        LabelStateEvent(context, lb, text, j + 1);
                                        clickstate[j] = 1;
                                        Log.Debug("LabelStateEvent id=" + num + ",group=" + groupname + ", al.Count=" + al.Count + ", ok.");
                                    }
                                }
                            }
                        }
                    }
                }
                Interlocked.Exchange(ref inTimer, 0);
            }
        }