Added new ugly table

This commit is contained in:
Aareschluchtje
2015-10-19 22:21:16 +02:00
parent 3ccf78b3ff
commit 3d52e6d36a
2 changed files with 31 additions and 23 deletions
+28 -22
View File
@@ -10,31 +10,39 @@ namespace ErgometerDoctorApplication
{
public class ConActiveSessions : Panel
{
public DataGridView data;
public ConActiveSessions() : base()
{
this.data = new DataGridView();
this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.sessionId = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.data)).BeginInit();
this.labelActiveSessions = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// SongsTableView
//
this.data.AllowUserToAddRows = false;
this.data.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.name, this.sessionId});
this.data.AllowUserToDeleteRows = false;
this.data.AllowUserToResizeRows = false;
this.data.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.data.Location = new System.Drawing.Point(0, 0);
this.data.MultiSelect = false;
this.data.Name = "Active Sessions";
this.data.ReadOnly = true;
this.data.RowHeadersVisible = false;
this.data.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.data.Size = new System.Drawing.Size(760, 172);
this.data.TabIndex = 0;
this.data.CellContentClick += new DataGridViewCellEventHandler(this.data_CellContentClick);
//
// name
//
this.name.HeaderText = "Name";
this.name.Name = "Name";
//
// sessionId
//
this.sessionId.HeaderText = "Session ID";
this.sessionId.Name = "Session ID";
//
// ConActiveSessions
//
@@ -43,21 +51,19 @@ namespace ErgometerDoctorApplication
this.Name = "ConActiveSessions";
this.Size = new System.Drawing.Size(584, 459);
this.TabIndex = 0;
//
// labelActiveSessions
//
this.labelActiveSessions.Anchor = System.Windows.Forms.AnchorStyles.None;
this.labelActiveSessions.AutoSize = true;
this.labelActiveSessions.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelActiveSessions.Location = new System.Drawing.Point(0, 0);
this.labelActiveSessions.Name = "labelActiveSessions";
this.labelActiveSessions.Size = new System.Drawing.Size(103, 21);
this.labelActiveSessions.TabIndex = 3;
this.labelActiveSessions.Text = "Geen actieve sessies.";
this.Controls.Add(labelActiveSessions);
this.Controls.Add(data);
}
public System.Windows.Forms.Label labelActiveSessions;
private void data_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (data.Rows[e.RowIndex].Cells[1].Value != null)
{
MainClient.StartNewCLient(data.Rows[e.RowIndex].Cells[0].Value + "", int.Parse(data.Rows[e.RowIndex].Cells[1].Value + ""));
}
}
public System.Windows.Forms.DataGridViewTextBoxColumn name;
public System.Windows.Forms.DataGridViewTextBoxColumn sessionId;
public System.Windows.Forms.DataGridView data;
}
}
+3 -1
View File
@@ -24,14 +24,16 @@ namespace ErgometerDoctorApplication
{
this.HeaderLabel.Text = "Actieve Sessies";
conActiveSessions.BringToFront();
conActiveSessions.data.Rows.Clear();
string str = "";
foreach(KeyValuePair<int, string> client in MainClient.activesessions)
{
str += client.Value + ", ";
MainClient.StartNewCLient(client.Value, client.Key);
conActiveSessions.data.Rows.Add(client.Value, client.Key);
}
conActiveSessions.labelActiveSessions.Text = str;
//conActiveSessions.labelActiveSessions.Text = str;
Console.WriteLine(str);
}