private void Movechallenge_Load(object sender, EventArgs e) { viewarray = new List <ViewList>(); for (int i = 0; i < studentname.Length; i++) { ViewList viewList = new ViewList(); viewList.Settext((i + 1).ToString(), studentname[i]); if (i == 0) // 첫 줄은 타이틀 { ViewList title = new ViewList(); title.Settitle(); result.Add(title.GetList()); viewarray.Add(title); } viewarray.Add(viewList); } viewarray.ForEach(x => x.Dock = DockStyle.Top); viewarray.Reverse <ViewList>().ToList().ForEach(x => panel1.Controls.Add(x)); // 역순 추가해야 마지막이 최상단에 위치 buzzer.SetMsgNo(Handle); if (!buzzer.SetConnection()) { MessageBox.Show("수신기 연결 오류"); } Receiver303.StartVote(buzzer.ComNo); checkbuzzer = new bool[bps]; rank = new Dictionary <string, string>(studentname.Length); panel1.Visible = true; }
private void Pacer_Load(object sender, EventArgs e) { rank = new Dictionary <string, string>(studentname.Length); buzzer.SetMsgNo(Handle); if (!buzzer.SetConnection()) { MessageBox.Show("수신기 연결 오류"); } Receiver303.StartVote(buzzer.ComNo); Game.recordhistory = game.Recordhistory().OrderByDescending(x => x[1]).ToList();; // 역대 recordhistory 가져오기 Ranking(); }
private void gamestart_Click(object sender, EventArgs e) // 게임 시작 { gamename = ((Button)sender).Text; if (MessageBox.Show("게임을 생성하시겠습니까?", "확인", MessageBoxButtons.YesNo) == DialogResult.Yes) { Receiver303 connectioncheck = new Receiver303(); connectioncheck.SetMsgNo(Handle); if (!connectioncheck.SetConnection()) { MessageBox.Show("수신기 연결 오류로 게임생성 불가"); return; } gamepanel.Controls.Clear(); Parent.Width = this.Width += 160; db.InsertGame(gamename); int[] stunum = new int[students]; // 학생 고유 번호 int unum = 1; // unknown 번호 for (int i = 0; i < students; i++) { try { stunum[i] = Convert.ToInt32(texts[i].Text.Split('/')[0]); } catch { studentname[i] = studentname[i] == null ? "unknown" + unum++ : studentname[i]; } } db.InsertParticipate(stunum); // 참가인원 등록 switch (gamename) { case "movechallenge": Movechallenge movechallenge = new Movechallenge(studentname); movechallenge.Dock = DockStyle.Fill; gamepanel.Controls.Add(movechallenge); break; case "pacer": Pacer pacer = new Pacer(studentname); pacer.Dock = DockStyle.Fill; gamepanel.Controls.Add(pacer); break; } } }
private void connect_Click(object sender, EventArgs e) // connection 설정 { string msg = buzzer.SetConnection() ? "연결됨" : "연결 오류"; MessageBox.Show(msg); }