private void _quitButton_Click(object sender, EventArgs e) { DialogResult dialog = dialog = MessageBox.Show("Are you sure you want to quit the training?", "Alert", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { _inTraining = false; this.Dispose(); GraphResultUI resultUI = new GraphResultUI(_controller.GetList()); resultUI.Show(); } }
private void _quitButton_Click(object sender, EventArgs e) { //this.Hide(); //_controller.UpdatedList -= updateGUI; if (_controller != null) _controller.Stop(); if (isSpecialist) { TCPController.Send(new NotifyPacket(NotifyPacket.Subject.StopTraining, client.NonNullId.ToString(), Settings.GetInstance().authToken)); this.Hide(); DBConnect db = new DBConnect(); int id; if (isSpecialist) id = client.NonNullId; else { id = Settings.GetInstance().CurrentUser.NonNullId; } GraphResultUI g = new GraphResultUI(db.getMeasurementsOfUser(id.ToString(), currentTraingId.ToString())); g.Show(); } _inTraining = false; }
private void handleIncomingPackets(Packet p) { if (InvokeRequired) { Invoke(new Action(() => handleIncomingPackets(p))); return; } // Tuple<userId, SessionId, DateOfSession>() if (p is PullResponsePacket<SessionData>) { var response = p as PullResponsePacket<SessionData>; if (response.DataType == "user_sessions") { Console.WriteLine("Sessions loaded"); sessions = response.List; usersCombobox_SelectedIndexChanged(this, EventArgs.Empty); } } else if (p is PullUsersResponsePacket) { var response = p as PullUsersResponsePacket; users = response.List.Where(x => x.IsClient).ToList(); BindingSource bs = new BindingSource(); bs.DataSource = users; usersCombobox.DataSource = bs; usersCombobox.DisplayMember = "Fullname"; usersCombobox.ValueMember = "Id"; } else if (p is PullResponsePacket<Measurement>) { TCPController.OnPacketReceived -= handleIncomingPackets; this.Close(); GraphResultUI ui = new GraphResultUI(((PullResponsePacket<Measurement>)p).List); ui.Show(); } }