Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        public FormTimer(string numberstr)
        {
            Log.Info("FormHandon.create,  numberstr=" + numberstr);
            al         = new ArrayList();
            alText     = new ArrayList();
            clickstate = new ArrayList();
            _classid   = Global.getClassID() + "";
            _lessonid  = Global.getLessonID() + "";
            Log.Info("debug. FormHandon._classid=" + _classid + ", _lessonid=" + _lessonid);

            _xitiId = Global.getSchoolID() + "-" + _classid + "-" + DateTime.Now.ToString("yyyyMMddHHmmss");

            //TODO: 截屏上传
            if ((EService.myppt != null && EService.myppt.isOpen()) || EService.bShowPicture)
            {
                _xitiId = "H_" + _xitiId;

                Image  img     = ScreenCapture.captureScreen(0, 0);
                string imgName = _xitiId + ".jpg";
                string imgDir  = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd");
                if (!Directory.Exists(imgDir))
                {
                    Directory.CreateDirectory(imgDir);
                }

                string imgPath = imgDir + "\\" + imgName;
                img.Save(imgPath);

                Common.uploadPicture(imgPath);
            }

            InitializeComponent();
            this.Text = "提问[" + _xitiId + "]";

            this.Height = screenHeight;
            this.Width  = screenWidth;

            StartPosition = FormStartPosition.Manual;
            SetDesktopLocation(0, screenHeight - this.Height);

            this.TopMost = true;
#if DEBUG
            this.TopMost = false;//PPTPractise
#endif
            //this.WindowState = FormWindowState.Maximized;
            this.Hide();
            this.Show();
            this.BringToFront();

            Log.Info("FormHandon Timer_start(Theout) now...");

            //t = new System.Timers.Timer(200);
            //t.Elapsed += new System.Timers.ElapsedEventHandler(Theout);
            //t.Enabled = true;
            //t.AutoReset = true;

            IntelligentRecommend.InitQuestion();
        }
Exemplo n.º 3
0
        public void AppendCallname(int uid)
        {
            IntelligentRecommend.addCallname(uid);

            if (_callnamsStr.IndexOf(uid + ":") >= 0)
            {
                return;
            }

            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;

            string pair = uid + ":" + timeDiff;

            if (_callnamsStr.Length > 0)
            {
                _callnamsStr += ",";
            }
            _callnamsStr += pair;
        }
Exemplo n.º 4
0
        public bool restart()
        {
            Log.Info("FormHandon.clear");
            RESULT = "";
            for (int i = 0; i < clickstate.Count; i++)
            {
                PictureBox lb   = (PictureBox)al[i];
                PictureBox text = (PictureBox)alText[i];

                LabelStateEventClear(lb, text, i + 1);
                clickstate[i] = 0;
            }


            stuPushCount.Clear();
            _callnamsStr  = "";
            _rewardStr    = "";
            _criticizeStr = "";
            _querytimes   = 0;
            tm_create     = DateTime.Now;

            _xitiId = Global.getSchoolID() + "-" + _classid + "-" + DateTime.Now.ToString("yyyyMMddHHmmss");

            //TODO: 截屏上传
            if ((EService.myppt != null && EService.myppt.isOpen()) || EService.bShowPicture)
            {
                _xitiId = "H_" + _xitiId;

                Image  img     = ScreenCapture.captureScreen(0, 0);
                string imgName = _xitiId + ".jpg";
                string imgDir  = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd");
                if (!Directory.Exists(imgDir))
                {
                    Directory.CreateDirectory(imgDir);
                }

                string imgPath = imgDir + "\\" + imgName;
                img.Save(imgPath);

                Common.uploadPicture(imgPath);
            }

            Log.Info("FormHandon _xitiId=" + _xitiId + ", SetPanel now...");

            pictureBox2.Visible = false;
            pictureBox3.Visible = false;
            pictureBox4.Visible = false;


            StartPosition = FormStartPosition.Manual;
            SetDesktopLocation(0, screenHeight - this.Height);

            try
            {
                this.TopMost = true;
                this.Show();
                Global.panelshow = 1;
                this.BringToFront();
            }
            catch (Exception e)
            {
                Log.Error("Handon.clear exception.");
                return(false);
            }

            IntelligentRecommend.InitQuestion();

            //Common.ClearHandon();
            t           = new System.Timers.Timer(100);
            t.Elapsed  += new System.Timers.ElapsedEventHandler(Theout);
            t.Enabled   = true;
            t.AutoReset = true;
            return(true);
        }