diff --git a/ErgometerDoctorApplication/ConSessionHistory.cs b/ErgometerDoctorApplication/ConSessionHistory.cs index 593226f..1f860fe 100644 --- a/ErgometerDoctorApplication/ConSessionHistory.cs +++ b/ErgometerDoctorApplication/ConSessionHistory.cs @@ -58,7 +58,7 @@ namespace ErgometerDoctorApplication foreach (Tuple sessiondata in historys) { - flowlayout.Controls.Add(new SessionPanel(sessiondata.Item3, sessiondata.Item1, false)); + flowlayout.Controls.Add(new SessionPanel(sessiondata.Item3, sessiondata.Item1, false,sessiondata.Item2)); } } } diff --git a/ErgometerDoctorApplication/SessionPanel.cs b/ErgometerDoctorApplication/SessionPanel.cs index d72a373..77ce793 100644 --- a/ErgometerDoctorApplication/SessionPanel.cs +++ b/ErgometerDoctorApplication/SessionPanel.cs @@ -7,23 +7,25 @@ namespace ErgometerDoctorApplication private int Session; private string Name; private bool IsNew; + private double timestamp; - public SessionPanel(int session, string name, bool isNew) : base() + public SessionPanel(int session, string name, bool isNew,double timestamp) : base() { - + this.timestamp = timestamp; Session = session; Name = name; IsNew = isNew; this.Location = new System.Drawing.Point(0, 0); this.Size = new System.Drawing.Size(180, 100); - this.BackColor = System.Drawing.Color.White; + this.BackColor = System.Drawing.Color.DarkGray; this.Click += SessionPanel_Click; this.MouseEnter += SessionPanel_MouseEnter; this.MouseLeave += SessionPanel_MouseLeave; this.Cursor = Cursors.Hand; + this.labelTimestamp = new Label(); this.labelName = new System.Windows.Forms.Label(); // @@ -33,7 +35,7 @@ namespace ErgometerDoctorApplication this.labelName.AutoSize = true; this.labelName.Font = new System.Drawing.Font("Segoe UI Semibold", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelName.Location = new System.Drawing.Point(10, 10); - this.labelName.ForeColor = System.Drawing.Color.Gray; + this.labelName.ForeColor = System.Drawing.Color.White; this.labelName.Name = "labelActiveSessions"; this.labelName.Size = new System.Drawing.Size(103, 21); this.labelName.TabIndex = 3; @@ -43,19 +45,36 @@ namespace ErgometerDoctorApplication this.labelName.MouseLeave += SessionPanel_MouseLeave; this.labelName.Cursor = Cursors.Hand; + this.labelTimestamp.Name = "labelTimeStamp"; + this.labelTimestamp.Anchor = AnchorStyles.None; + this.labelTimestamp.Text = ErgometerLibrary.Helper.MillisecondsToTime(timestamp); + this.labelTimestamp.Location = new System.Drawing.Point(10, 40); + this.labelTimestamp.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelTimestamp.ForeColor = System.Drawing.Color.White; + this.labelTimestamp.Size = new System.Drawing.Size(103, 21); + this.labelTimestamp.Click += SessionPanel_Click; + this.labelTimestamp.MouseEnter += SessionPanel_MouseEnter; + this.labelTimestamp.MouseLeave += SessionPanel_MouseLeave; + + if (isNew) + labelTimestamp.Visible = false; + this.Controls.Add(labelName); + this.Controls.Add(labelTimestamp); } private void SessionPanel_MouseEnter(object sender, System.EventArgs e) { - this.BackColor = System.Drawing.Color.LightGray; - this.labelName.ForeColor = System.Drawing.Color.DarkGray; + this.BackColor = System.Drawing.Color.Gray; + this.labelName.ForeColor = System.Drawing.Color.WhiteSmoke; + labelTimestamp.ForeColor = System.Drawing.Color.WhiteSmoke; } private void SessionPanel_MouseLeave(object sender, System.EventArgs e) { - this.BackColor = System.Drawing.Color.White; - this.labelName.ForeColor = System.Drawing.Color.Gray; + this.BackColor = System.Drawing.Color.DarkGray; + this.labelName.ForeColor = System.Drawing.Color.White; + this.labelTimestamp.ForeColor = System.Drawing.Color.White; } private void SessionPanel_Click(object sender, System.EventArgs e) @@ -67,5 +86,6 @@ namespace ErgometerDoctorApplication } public System.Windows.Forms.Label labelName; + public Label labelTimestamp; } } \ No newline at end of file