Ejemplo n.º 1
0
        private void lantern()
        {
            Object obj = new Object();

            lock (obj)
            {
                Random instance = Random.getInstance();
                instance.rannumber(studentnum);
                while (true)
                {
                    Thread.Sleep(100);
                    if (!start)
                    {
                        break;
                    }
                    ArrayList result = instance.get(4);
                    if (result.Contains(-1))
                    {
                        while (MessageBox.Show(this, "剩余学生不足!", "提示", MessageBoxButtons.OK) != DialogResult.OK)
                        {
                            ;
                        }
                        button1.PerformClick();
                        break;
                    }
                    long sn = namelist.Keys[(int)result[0]];
                    label1.Text = sn.ToString();
                    label2.Text = namelist[sn];
                    label9.Text = "缺勤" + cell.getabsencenum(sn) + "次";
                    pictureBox1.LoadAsync(Application.StartupPath + @"/photos/" + sn + @".jpg");
                    sn           = namelist.Keys[(int)result[1]];
                    label3.Text  = sn.ToString();
                    label4.Text  = namelist[sn];
                    label10.Text = "缺勤" + cell.getabsencenum(sn) + "次";
                    pictureBox2.LoadAsync(Application.StartupPath + @"/photos/" + sn + @".jpg");
                    sn           = namelist.Keys[(int)result[2]];
                    label5.Text  = sn.ToString();
                    label6.Text  = namelist[sn];
                    label11.Text = "缺勤" + cell.getabsencenum(sn) + "次";
                    pictureBox3.LoadAsync(Application.StartupPath + @"/photos/" + sn + @".jpg");
                    sn           = namelist.Keys[(int)result[3]];
                    label7.Text  = sn.ToString();
                    label8.Text  = namelist[sn];
                    label12.Text = "缺勤" + cell.getabsencenum(sn) + "次";
                    pictureBox4.LoadAsync(Application.StartupPath + @"/photos/" + sn + @".jpg");
                }
            }
        }
Ejemplo n.º 2
0
        private void absence_Load(object sender, EventArgs e)
        {
            groupBox1.Visible = false;
            groupBox2.Visible = false;
            groupBox3.Visible = false;
            button1.Enabled   = false;
            button2.Enabled   = false;
            excelio cell = excelio.getInstance();

            if (filePath != null)
            {
                cell.openfile(filePath);
                if (absence != null)
                {
                    button2.Enabled = true;
                    foreach (long sn in absence)
                    {
                        absinfo.Add(new info(cell.getstudentname(sn), sn, cell.getabsencenum(sn)));
                    }
                    if (absinfo.Count >= 3)
                    {
                        if (absinfo.Count == 3)
                        {
                            button2.Enabled = false;
                        }
                        for (i = 0; i < 3; i++)
                        {
                            info student = (info)absinfo[i];
                            fresh(student, i);
                        }
                    }
                    else
                    {
                        button2.Enabled = false;
                        for (i = 0; i < absinfo.Count; i++)
                        {
                            info student = (info)absinfo[i];
                            fresh(student, i);
                        }
                    }
                }
            }
        }