Added client content
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
using ErgometerLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class ChartPanel : Panel
|
||||
{
|
||||
private Chart chart;
|
||||
private MetingType type;
|
||||
private ChartArea chartArea;
|
||||
private Series series;
|
||||
|
||||
public ChartPanel(MetingType type) : base()
|
||||
{
|
||||
this.type = type;
|
||||
|
||||
this.chart = new Chart();
|
||||
this.chartArea = new ChartArea();
|
||||
this.chart.Titles.Add(new Title(type.ToString()));
|
||||
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
|
||||
this.Size = new System.Drawing.Size(250, 200);
|
||||
this.Controls.Add(chart);
|
||||
|
||||
this.series = createSerie();
|
||||
this.chartArea.Name = "chartArea";
|
||||
|
||||
this.chart.Size = new System.Drawing.Size(250, 200);
|
||||
|
||||
this.chart.Dock = DockStyle.Fill;
|
||||
this.chart.Series.Add(series);
|
||||
this.chart.Text = "chart";
|
||||
|
||||
|
||||
this.chart.ChartAreas.Add(chartArea);
|
||||
|
||||
}
|
||||
|
||||
public void updateChart(List<Meting> metingen)
|
||||
{
|
||||
chart.Series[0] = createSerie();
|
||||
for (int i = 0; i < metingen.Count; i++)
|
||||
{
|
||||
chart.Series[0].Points.Add(getMetingType(metingen[i]));
|
||||
}
|
||||
chart.Update();
|
||||
}
|
||||
|
||||
public Series createSerie()
|
||||
{
|
||||
Series serie = new Series();
|
||||
serie.Name = "series";
|
||||
serie.ChartType = SeriesChartType.Line;
|
||||
serie.ChartArea = "chartArea";
|
||||
serie.BorderWidth = 3;
|
||||
return serie;
|
||||
}
|
||||
|
||||
public int getMetingType(Meting meting)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MetingType.HEARTBEAT:
|
||||
return meting.HeartBeat;
|
||||
case MetingType.RPM:
|
||||
return meting.RPM;
|
||||
case MetingType.SPEED:
|
||||
return (int)meting.Speed;
|
||||
case MetingType.DISTANCE:
|
||||
return (int)meting.Distance;
|
||||
case MetingType.POWER:
|
||||
return meting.Power;
|
||||
case MetingType.ENERGY:
|
||||
return meting.Energy;
|
||||
case MetingType.SECONDS:
|
||||
return meting.Seconds;
|
||||
case MetingType.ACTUALPOWER:
|
||||
return meting.ActualPower;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public enum MetingType
|
||||
{
|
||||
HEARTBEAT,
|
||||
RPM,
|
||||
SPEED,
|
||||
DISTANCE,
|
||||
POWER,
|
||||
ENERGY,
|
||||
SECONDS,
|
||||
ACTUALPOWER
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class ChatItem : Panel
|
||||
{
|
||||
private Label messageLabel, timeLabel;
|
||||
|
||||
public ChatItem(string message, string time, bool isDoctor) : base()
|
||||
{
|
||||
this.messageLabel = new Label();
|
||||
this.timeLabel = new Label();
|
||||
|
||||
this.AutoSize = true;
|
||||
this.setAppearance(isDoctor);
|
||||
this.Controls.Add(this.messageLabel);
|
||||
this.Controls.Add(this.timeLabel);
|
||||
this.MinimumSize = new System.Drawing.Size(100, 40);
|
||||
this.Name = "messageContainer";
|
||||
this.Padding = new System.Windows.Forms.Padding(6);
|
||||
|
||||
//
|
||||
// Message Label
|
||||
//
|
||||
this.messageLabel.AutoSize = true;
|
||||
this.messageLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.messageLabel.Font = new System.Drawing.Font("Segoe UI Semibold", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.messageLabel.Location = new System.Drawing.Point(6, 6);
|
||||
this.messageLabel.MaximumSize = new System.Drawing.Size(190, 0);
|
||||
this.messageLabel.Size = new System.Drawing.Size(121, 20);
|
||||
this.messageLabel.Text = message;
|
||||
//
|
||||
// Time Label
|
||||
//
|
||||
this.timeLabel.AutoSize = true;
|
||||
this.timeLabel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.timeLabel.Font = new System.Drawing.Font("Segoe UI Semilight", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.timeLabel.Location = new System.Drawing.Point(6, 26);
|
||||
this.timeLabel.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.timeLabel.Size = new System.Drawing.Size(32, 13);
|
||||
this.timeLabel.Text = "Time:" + time;
|
||||
}
|
||||
|
||||
private void setAppearance(bool isDoctor)
|
||||
{
|
||||
if (isDoctor)
|
||||
{
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.Dock = DockStyle.Right;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.Dock = DockStyle.Left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,9 @@ namespace ErgometerDoctorApplication
|
||||
|
||||
private SessionWindow window;
|
||||
|
||||
public List<Meting> Metingen { get; }
|
||||
public List<ChatMessage> Chat { get; }
|
||||
|
||||
public ClientThread(string name, int session)
|
||||
{
|
||||
Name = name;
|
||||
@@ -22,6 +25,9 @@ namespace ErgometerDoctorApplication
|
||||
|
||||
window = new SessionWindow(Name, true);
|
||||
window.FormClosed += Window_FormClosed;
|
||||
|
||||
Metingen = new List<Meting>();
|
||||
Chat = new List<ChatMessage>();
|
||||
}
|
||||
|
||||
private void Window_FormClosed(object sender, FormClosedEventArgs e)
|
||||
@@ -33,7 +39,13 @@ namespace ErgometerDoctorApplication
|
||||
{
|
||||
switch(command.Type)
|
||||
{
|
||||
|
||||
case NetCommand.CommandType.DATA:
|
||||
SaveMeting(command.Meting);
|
||||
break;
|
||||
case NetCommand.CommandType.CHAT:
|
||||
Chat.Add(new ChatMessage(Name, command.ChatMessage, false));
|
||||
window.panelClientChat.AddChatItem(command.ChatMessage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,5 +65,17 @@ namespace ErgometerDoctorApplication
|
||||
MainClient.SendNetCommand(command);
|
||||
}
|
||||
|
||||
public void SaveMeting(Meting m)
|
||||
{
|
||||
Metingen.Add(m);
|
||||
|
||||
window.heartBeat.updateValue(m.HeartBeat);
|
||||
window.RPM.updateValue(m.RPM);
|
||||
window.speed.updateValue(m.Speed);
|
||||
window.distance.updateValue(m.Distance);
|
||||
window.power.updateValue(m.Power);
|
||||
window.energy.updateValue(m.Energy);
|
||||
window.actualpower.updateValue(m.ActualPower);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,10 @@ namespace ErgometerDoctorApplication
|
||||
this.textBoxPassword.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.textBoxPassword.Location = new System.Drawing.Point(15, 70);
|
||||
this.textBoxPassword.Name = "textBoxPassword";
|
||||
this.textBoxPassword.PasswordChar = '*';
|
||||
this.textBoxPassword.Size = new System.Drawing.Size(150, 20);
|
||||
this.textBoxPassword.TabIndex = 0;
|
||||
this.textBoxPassword.KeyDown += TextBoxPassword_KeyDown;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
@@ -92,6 +94,14 @@ namespace ErgometerDoctorApplication
|
||||
|
||||
}
|
||||
|
||||
private void TextBoxPassword_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
buttonLogin_Click(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
mainWindow.validateLogin();
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms.DataVisualization" />
|
||||
<Reference Include="System.Windows.Forms.DataVisualization.Design" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -50,7 +52,22 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ChartPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ChatItem.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ClientThread.cs" />
|
||||
<Compile Include="PanelClientChat.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PanelClientData.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PanelGraphView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SessionWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ErgometerLibrary;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class PanelClientChat : Panel
|
||||
{
|
||||
|
||||
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.Label connectionLabel;
|
||||
|
||||
public PanelClientChat() : base()
|
||||
{
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.connectionLabel = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.AutoSize = true;
|
||||
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowOnly;
|
||||
this.flowLayoutPanel1.Controls.Add(this.panel2);
|
||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(390, 36);
|
||||
this.flowLayoutPanel1.TabIndex = 0;
|
||||
this.flowLayoutPanel1.WrapContents = false;
|
||||
this.flowLayoutPanel1.SizeChanged += new System.EventHandler(this.FlowLayoutPanel1_SizeChanged);
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.connectionLabel);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panel2.Location = new System.Drawing.Point(6, 6);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(385, 24);
|
||||
this.panel2.TabIndex = 0;
|
||||
//
|
||||
// connectionLabel
|
||||
//
|
||||
this.connectionLabel.AutoSize = true;
|
||||
this.connectionLabel.Font = new System.Drawing.Font("Segoe UI Semibold", 8F, System.Drawing.FontStyle.Bold);
|
||||
this.connectionLabel.Location = new System.Drawing.Point(4, 4);
|
||||
this.connectionLabel.Name = "connectionLabel";
|
||||
this.connectionLabel.Size = new System.Drawing.Size(112, 13);
|
||||
this.connectionLabel.TabIndex = 0;
|
||||
this.connectionLabel.Text = "Now connected with:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Location = new System.Drawing.Point(0, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(100, 23);
|
||||
this.label2.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(0, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(100, 23);
|
||||
this.label1.TabIndex = 0;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.panel1.Controls.Add(this.button1);
|
||||
this.panel1.Controls.Add(this.richTextBox1);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(400, 100);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.BackColor = System.Drawing.Color.White;
|
||||
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button1.Location = new System.Drawing.Point(310, 4);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(85, 90);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Text = "Verstuur";
|
||||
this.button1.UseVisualStyleBackColor = false;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
this.richTextBox1.BackColor = System.Drawing.Color.White;
|
||||
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.richTextBox1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.richTextBox1.Location = new System.Drawing.Point(4, 4);
|
||||
this.richTextBox1.MaxLength = 250;
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
|
||||
this.richTextBox1.Size = new System.Drawing.Size(300, 90);
|
||||
this.richTextBox1.TabIndex = 0;
|
||||
this.richTextBox1.Text = "";
|
||||
this.richTextBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBox_KeyDown);
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.AutoScroll = true;
|
||||
this.panel3.HorizontalScroll.Enabled = false;
|
||||
this.panel3.HorizontalScroll.Visible = false;
|
||||
this.panel3.BackColor = System.Drawing.Color.White;
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel3.Controls.Add(this.flowLayoutPanel1);
|
||||
this.panel3.Location = new System.Drawing.Point(0, 0);
|
||||
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.TabIndex = 1;
|
||||
//
|
||||
// container
|
||||
//
|
||||
this.Controls.Add(this.panel3);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
this.Name = "container";
|
||||
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel3_MouseWheel);
|
||||
|
||||
Form.CheckForIllegalCrossThreadCalls = false;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (richTextBox1.TextLength > 1)
|
||||
{
|
||||
AddChatItem(richTextBox1.Text, Helper.MillisecondsToTime(Helper.Now), true);
|
||||
MainClient.SendNetCommand(new NetCommand(richTextBox1.Text, MainClient.Session));
|
||||
richTextBox1.ResetText();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddChatItem(string text)
|
||||
{
|
||||
flowLayoutPanel1.Controls.Add(new ChatItem(text, Helper.MillisecondsToTime(Helper.Now), false));
|
||||
}
|
||||
|
||||
public void AddChatItem(string text, bool isDoctor)
|
||||
{
|
||||
flowLayoutPanel1.Controls.Add(new ChatItem(text, Helper.MillisecondsToTime(Helper.Now), isDoctor));
|
||||
}
|
||||
|
||||
public void AddChatItem(string text, string time, bool isDoctor)
|
||||
{
|
||||
flowLayoutPanel1.Controls.Add(new ChatItem(text, time, isDoctor));
|
||||
}
|
||||
|
||||
private void panel3_MouseWheel(object sender, MouseEventArgs e)
|
||||
{
|
||||
panel3.Focus();
|
||||
}
|
||||
|
||||
private void FlowLayoutPanel1_SizeChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
if (flowLayoutPanel1.Size.Height > panel3.Size.Height)
|
||||
{
|
||||
panel2.Width = 375;
|
||||
flowLayoutPanel1.Width = 380;
|
||||
panel3.VerticalScroll.Value = panel3.VerticalScroll.Maximum;
|
||||
}
|
||||
}
|
||||
|
||||
private bool textBoxIsEmpty()
|
||||
{
|
||||
string[] text = richTextBox1.Text.Split();
|
||||
foreach (string s in text)
|
||||
{
|
||||
if (s != " ")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void TextBox_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
button1_Click(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class PanelClientData : Panel
|
||||
{
|
||||
public Label labelMetingCurrentValue;
|
||||
public ProgressBar progressBarMeting;
|
||||
public Label metingName;
|
||||
|
||||
private int min;
|
||||
private int max;
|
||||
|
||||
public PanelClientData(string name, int min, int max) : base()
|
||||
{
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
|
||||
this.metingName = new System.Windows.Forms.Label();
|
||||
this.progressBarMeting = new System.Windows.Forms.ProgressBar();
|
||||
this.labelMetingCurrentValue = new System.Windows.Forms.Label();
|
||||
//
|
||||
// initialize panel
|
||||
//
|
||||
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.Controls.Add(this.labelMetingCurrentValue);
|
||||
this.Controls.Add(this.progressBarMeting);
|
||||
this.Controls.Add(this.metingName);
|
||||
this.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
this.Name = "panel1";
|
||||
this.Size = new System.Drawing.Size(284, 80);
|
||||
//
|
||||
// metingName
|
||||
//
|
||||
this.metingName.AutoSize = true;
|
||||
this.metingName.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.metingName.Location = new System.Drawing.Point(12, 9);
|
||||
this.metingName.Name = "metingName";
|
||||
this.metingName.Size = new System.Drawing.Size(105, 21);
|
||||
this.metingName.TabIndex = 0;
|
||||
this.metingName.Text = name;
|
||||
//
|
||||
// progressBarMeting
|
||||
//
|
||||
this.progressBarMeting.Location = new System.Drawing.Point(16, 39);
|
||||
this.progressBarMeting.Name = "progressBarMeting";
|
||||
this.progressBarMeting.Size = new System.Drawing.Size(183, 23);
|
||||
this.progressBarMeting.TabIndex = 1;
|
||||
this.progressBarMeting.Value = 0;
|
||||
//
|
||||
// labelMetingCurrentValue
|
||||
//
|
||||
this.labelMetingCurrentValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.labelMetingCurrentValue.AutoSize = true;
|
||||
this.labelMetingCurrentValue.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelMetingCurrentValue.Location = new System.Drawing.Point(215, 32);
|
||||
this.labelMetingCurrentValue.Name = "labelMetingCurrentValue";
|
||||
this.labelMetingCurrentValue.Size = new System.Drawing.Size(57, 32);
|
||||
this.labelMetingCurrentValue.TabIndex = 2;
|
||||
this.labelMetingCurrentValue.Text = "0";
|
||||
}
|
||||
|
||||
public void setText(string text)
|
||||
{
|
||||
this.metingName.Text = text;
|
||||
}
|
||||
|
||||
public void updateValue(int value)
|
||||
{
|
||||
this.labelMetingCurrentValue.Text = value.ToString();
|
||||
this.progressBarMeting.Value = ValueToPercentage(value);
|
||||
}
|
||||
|
||||
public void updateValue(double value)
|
||||
{
|
||||
this.labelMetingCurrentValue.Text = value.ToString();
|
||||
this.progressBarMeting.Value = ValueToPercentage((int)value);
|
||||
}
|
||||
|
||||
public void updateValue(decimal value)
|
||||
{
|
||||
this.labelMetingCurrentValue.Text = value.ToString();
|
||||
this.progressBarMeting.Value = ValueToPercentage((int)value);
|
||||
}
|
||||
|
||||
private int ValueToPercentage(int value)
|
||||
{
|
||||
if (value < min)
|
||||
return 0;
|
||||
|
||||
if (value > max)
|
||||
return 100;
|
||||
|
||||
return ((value - min) * 100) / (max - min);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using ErgometerLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class PanelGraphView : Panel
|
||||
{
|
||||
|
||||
private List<ChartPanel> charts;
|
||||
private FlowLayoutPanel flowlayout;
|
||||
|
||||
public PanelGraphView() : base()
|
||||
{
|
||||
createCharts();
|
||||
|
||||
flowlayout = new FlowLayoutPanel();
|
||||
|
||||
flowlayout.Dock = DockStyle.Fill;
|
||||
flowlayout.BackColor = System.Drawing.Color.DarkGray;
|
||||
flowlayout.Location = new System.Drawing.Point(0, 0);
|
||||
flowlayout.Name = "flowlayout";
|
||||
flowlayout.Padding = new Padding(15);
|
||||
flowlayout.AutoScroll = true;
|
||||
foreach (ChartPanel chart in charts)
|
||||
{
|
||||
flowlayout.Controls.Add(chart);
|
||||
}
|
||||
|
||||
List<Meting> metingen = new List<Meting>();
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
metingen.Add(new Meting(23, 25, 12, 46, 13, 25, 13, 1, 32));
|
||||
|
||||
updateAllCharts(metingen);
|
||||
//
|
||||
// panelGraphView
|
||||
//
|
||||
this.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.Controls.Add(flowlayout);
|
||||
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
this.Name = "panelGraphView";
|
||||
this.Size = new System.Drawing.Size(400, 600);
|
||||
this.TabIndex = 1;
|
||||
}
|
||||
|
||||
public void createCharts()
|
||||
{
|
||||
charts = new List<ChartPanel>();
|
||||
charts.Add(new ChartPanel(ChartPanel.MetingType.HEARTBEAT));
|
||||
charts.Add(new ChartPanel(ChartPanel.MetingType.RPM));
|
||||
charts.Add(new ChartPanel(ChartPanel.MetingType.SPEED));
|
||||
charts.Add(new ChartPanel(ChartPanel.MetingType.DISTANCE));
|
||||
charts.Add(new ChartPanel(ChartPanel.MetingType.ENERGY));
|
||||
charts.Add(new ChartPanel(ChartPanel.MetingType.SECONDS));
|
||||
charts.Add(new ChartPanel(ChartPanel.MetingType.POWER));
|
||||
charts.Add(new ChartPanel(ChartPanel.MetingType.ACTUALPOWER));
|
||||
}
|
||||
|
||||
public void updateAllCharts(List<Meting> metingen)
|
||||
{
|
||||
foreach (ChartPanel chart in charts)
|
||||
{
|
||||
chart.updateChart(metingen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+109
-2
@@ -31,19 +31,126 @@ namespace ErgometerDoctorApplication
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
|
||||
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.panelClientContainer = new System.Windows.Forms.Panel();
|
||||
this.panelDataViewLeft = new System.Windows.Forms.Panel();
|
||||
this.panelGraphView = new ErgometerDoctorApplication.PanelGraphView();
|
||||
this.panelClientChat = new ErgometerDoctorApplication.PanelClientChat();
|
||||
this.panelTopBar = new System.Windows.Forms.Panel();
|
||||
this.labelUsername = new System.Windows.Forms.Label();
|
||||
this.labelHallo = new System.Windows.Forms.Label();
|
||||
|
||||
this.heartBeat = new PanelClientData("Hartslag", 0, 250);
|
||||
this.RPM = new PanelClientData("RPM", 0, 100);
|
||||
this.speed = new PanelClientData("Snelheid", 0, 500);
|
||||
this.distance = new PanelClientData("Afstand (km)", 0, 1000);
|
||||
this.power = new PanelClientData("Weerstand", 25, 400);
|
||||
this.energy = new PanelClientData("Energie", 0, 200);
|
||||
this.actualpower = new PanelClientData("Absolute Weerstand", 0, 400);
|
||||
|
||||
this.panelClientContainer.SuspendLayout();
|
||||
this.panelTopBar.SuspendLayout();
|
||||
//
|
||||
// panelClientContainer
|
||||
//
|
||||
this.panelClientContainer.Controls.Add(this.panelGraphView);
|
||||
this.panelClientContainer.Controls.Add(this.panelDataViewLeft);
|
||||
|
||||
this.panelClientContainer.Controls.Add(this.panelClientChat);
|
||||
this.panelClientContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelClientContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelClientContainer.Name = "panelClientContainer";
|
||||
this.panelClientContainer.Size = new System.Drawing.Size(800, 600);
|
||||
this.panelClientContainer.TabIndex = 0;
|
||||
//
|
||||
// panelDataViewLeft
|
||||
//
|
||||
this.panelDataViewLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panelDataViewLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelDataViewLeft.Name = "panelDataViewLeft";
|
||||
this.panelDataViewLeft.Size = new System.Drawing.Size(18, 600);
|
||||
this.panelDataViewLeft.TabIndex = 3;
|
||||
this.panelDataViewLeft.BackColor = System.Drawing.Color.Gray;
|
||||
this.panelDataViewLeft.Controls.Add(heartBeat);
|
||||
this.panelDataViewLeft.Controls.Add(RPM);
|
||||
this.panelDataViewLeft.Controls.Add(speed);
|
||||
this.panelDataViewLeft.Controls.Add(distance);
|
||||
this.panelDataViewLeft.Controls.Add(power);
|
||||
this.panelDataViewLeft.Controls.Add(energy);
|
||||
this.panelDataViewLeft.Controls.Add(actualpower);
|
||||
|
||||
//
|
||||
// panelClientChat
|
||||
//
|
||||
this.panelClientChat.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.panelClientChat.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.panelClientChat.Location = new System.Drawing.Point(400, 0);
|
||||
this.panelClientChat.Name = "panelClientChat";
|
||||
this.panelClientChat.Size = new System.Drawing.Size(400, 600);
|
||||
this.panelClientChat.TabIndex = 2;
|
||||
//
|
||||
// panelTopBar
|
||||
//
|
||||
this.panelTopBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.panelTopBar.Controls.Add(this.labelUsername);
|
||||
this.panelTopBar.Controls.Add(this.labelHallo);
|
||||
this.panelTopBar.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panelTopBar.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelTopBar.Name = "panelTopBar";
|
||||
this.panelTopBar.Size = new System.Drawing.Size(800, 30);
|
||||
this.panelTopBar.TabIndex = 1;
|
||||
this.panelTopBar.Visible = false;
|
||||
//
|
||||
// labelUsername
|
||||
//
|
||||
this.labelUsername.AutoSize = true;
|
||||
this.labelUsername.Font = new System.Drawing.Font("Segoe UI Semilight", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelUsername.ForeColor = System.Drawing.Color.White;
|
||||
this.labelUsername.Location = new System.Drawing.Point(49, 3);
|
||||
this.labelUsername.Name = "labelUsername";
|
||||
this.labelUsername.Size = new System.Drawing.Size(144, 21);
|
||||
this.labelUsername.TabIndex = 0;
|
||||
this.labelUsername.Text = "<Gebruikersnaam>";
|
||||
//
|
||||
// labelHallo
|
||||
//
|
||||
this.labelHallo.AutoSize = true;
|
||||
this.labelHallo.Font = new System.Drawing.Font("Segoe UI Semilight", 12F);
|
||||
this.labelHallo.ForeColor = System.Drawing.Color.White;
|
||||
this.labelHallo.Location = new System.Drawing.Point(3, 3);
|
||||
this.labelHallo.Name = "labelHallo";
|
||||
this.labelHallo.Size = new System.Drawing.Size(54, 21);
|
||||
this.labelHallo.TabIndex = 0;
|
||||
this.labelHallo.Text = "Hallo, ";
|
||||
//
|
||||
// SessionWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(784, 561);
|
||||
this.ClientSize = new System.Drawing.Size(800, 600);
|
||||
this.Controls.Add(this.panelTopBar);
|
||||
this.Controls.Add(this.panelClientContainer);
|
||||
this.Name = "SessionWindow";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Resize += new System.EventHandler(this.ClientApplicatie_Resize);
|
||||
this.panelClientContainer.ResumeLayout(false);
|
||||
this.panelTopBar.ResumeLayout(false);
|
||||
this.panelTopBar.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Panel panelClientContainer;
|
||||
public PanelClientChat panelClientChat;
|
||||
private PanelGraphView panelGraphView;
|
||||
private System.Windows.Forms.Panel panelDataViewLeft;
|
||||
private System.Windows.Forms.Panel panelTopBar;
|
||||
private System.Windows.Forms.Label labelUsername;
|
||||
private System.Windows.Forms.Label labelHallo;
|
||||
public PanelClientData heartBeat, RPM, speed, distance, power, energy, seconds, actualpower;
|
||||
|
||||
private void createTitle()
|
||||
{
|
||||
@@ -57,4 +164,4 @@ namespace ErgometerDoctorApplication
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,32 @@ namespace ErgometerDoctorApplication
|
||||
this.ActiveSession = ActiveSession;
|
||||
this.ClientName = ClientName;
|
||||
InitializeComponent();
|
||||
|
||||
Form.CheckForIllegalCrossThreadCalls = false;
|
||||
}
|
||||
|
||||
public void ClientApplicatie_Resize(object sender, EventArgs e)
|
||||
{
|
||||
Control control = (Control)sender;
|
||||
if (control.Size.Width < 980)
|
||||
{
|
||||
panelGraphView.Visible = false;
|
||||
panelClientChat.Width = 400;
|
||||
panelDataViewLeft.Dock = DockStyle.Fill;
|
||||
}
|
||||
if (control.Size.Width >= 980 && control.Size.Width < 1368)
|
||||
{
|
||||
panelGraphView.Visible = true;
|
||||
panelDataViewLeft.Width = 250;
|
||||
panelClientChat.Width = 400;
|
||||
panelDataViewLeft.Dock = DockStyle.Left;
|
||||
}
|
||||
if (control.Size.Width >= 1368)
|
||||
{
|
||||
panelGraphView.Visible = true;
|
||||
panelDataViewLeft.Width = 400;
|
||||
panelDataViewLeft.Dock = DockStyle.Left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user