コード例 #1
0
        private void Theout(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (Interlocked.Exchange(ref inTimer, 1) == 0)
            {
                string data = Common.GetHandon();
                if (data != null && data.Length > 0 && t.Enabled)
                {
                    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  = 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);
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
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);
            }
        }