private void frmLogin2_Load(object sender, EventArgs e) { PanelTransition.Hide(panelProcess); PanelTransition.ShowSync(panelProcess); this.Width = 310; btnClose.Location = new Point(135, 4); }
private void btnMenu_Click(object sender, EventArgs e) { if (slider.Width == 39) { slider.Visible = false; slider.Width = 189; PanelTransition.ShowSync(slider); } else { slider.Visible = false; slider.Width = 39; PanelTransition.ShowSync(slider); } }
private void btnMenu_Click(object sender, EventArgs e) { if (panelLeft.Width == 50) { panelLeft.Visible = true; panelLeft.Width = 250; LogoTransition.ShowSync(pictrueBoxLogo); } else { LogoTransition.Hide(pictrueBoxLogo); panelLeft.Visible = false; panelLeft.Width = 50; PanelTransition.ShowSync(panelLeft); } }
private void btnMenu_Click(object sender, EventArgs e) { if (panel1.Width == 50) { //Expand the panel , width = 250 //Show logo panel1.Visible = false; panel1.Width = 260; PanelTransition.ShowSync(panel1); Logo1Transition.ShowSync(logo); } else { PanelTransition.Hide(logo); panel1.Visible = false; panel1.Width = 50; PanelTransition.ShowSync(panel1); } }
private void btnConnect_Click(object sender, EventArgs e) { if (checkConnect) { return; } if (validate()) { int size; sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { sck.Connect(IPAddress.Parse(txtIpServer.Text), Convert.ToInt32(txtPort.Text)); } catch (SocketException ex) { MessageBox.Show(ex.ToString(), "Có lỗi xảy ra", MessageBoxButtons.OK, MessageBoxIcon.Error); sck.Close(); return; } this.Width = 620; btnClose.Location = new Point(290, 4); PanelTransition.ShowSync(panelProcess); checkConnect = true; try { data = new byte[1024]; size = sck.Receive(data);//size server transfer processBar.MaxValue = Convert.ToInt32(Encoding.ASCII.GetString(data, 0, size)); sendDone(); data = new byte[1024]; size = sck.Receive(data);//object para Controller.ParaObject para = new Controller.ParaObject(data); Controller.Constant.time = para.Time * 60; processBar.Value += size; processBar.Update(); sendDone(); if (para.GetDB > 0) { for (int i = 0; i < para.GetDB; i++) { data = new byte[1024]; size = sck.Receive(data); Model.Question ques = new Model.Question(data); lsquesDB.Add(ques); processBar.Value += size; processBar.Update(); sendDone(); } size = sck.Receive(data); int countAns = Convert.ToInt32(Encoding.ASCII.GetString(data, 0, size)); sendDone(); for (int i = 0; i < countAns; i++) { data = new byte[1024]; size = sck.Receive(data); Model.Answer ans = new Model.Answer(data); lsansDB.Add(ans); processBar.Value += size; processBar.Update(); sendDone(); } } if (para.GetFile > 0) { for (int i = 0; i < para.GetFile; i++) { data = new byte[1024]; size = sck.Receive(data); Model.Question ques = new Model.Question(data); lsquesFile.Add(ques); processBar.Value += size; processBar.Update(); sendDone(); } size = sck.Receive(data); int countAns = Convert.ToInt32(Encoding.ASCII.GetString(data, 0, size)); sendDone(); for (int i = 0; i < countAns; i++) { data = new byte[1024]; size = sck.Receive(data); Model.Answer ans = new Model.Answer(data); lsansFile.Add(ans); processBar.Value += size; processBar.Update(); sendDone(); } } } catch (SocketException ex) { MessageBox.Show(ex.ToString(), "Có lỗi xảy ra", MessageBoxButtons.OK, MessageBoxIcon.Error); sck.Close(); return; } var ls = joinList(); this.quesList = ls.Item1; this.ansList = ls.Item2; btnStartQuiz.Visible = true; listen = new Thread(new ThreadStart(threadListen)); listen.IsBackground = true; listen.Start(); } else { MessageBox.Show("Bạn phải điền đủ thông tin!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }