Added uitleg text and changed some other things

This commit is contained in:
2015-11-01 15:59:46 +01:00
parent c5399bf5dd
commit c16485d7a8
6 changed files with 73 additions and 115 deletions
@@ -35,7 +35,6 @@ namespace ErgometerApplication
this.updateTimer = new System.Windows.Forms.Timer(this.components); this.updateTimer = new System.Windows.Forms.Timer(this.components);
this.panelClientContainer = new System.Windows.Forms.Panel(); this.panelClientContainer = new System.Windows.Forms.Panel();
this.panelDataViewLeft = new System.Windows.Forms.Panel(); this.panelDataViewLeft = new System.Windows.Forms.Panel();
this.panelGraphView = new ErgometerApplication.PanelGraphView();
this.panelClientChat = new ErgometerApplication.PanelClientChat(); this.panelClientChat = new ErgometerApplication.PanelClientChat();
this.panelLogin = new ErgometerApplication.PanelLogin(this); this.panelLogin = new ErgometerApplication.PanelLogin(this);
this.panelTopBar = new System.Windows.Forms.Panel(); this.panelTopBar = new System.Windows.Forms.Panel();
@@ -51,6 +50,7 @@ namespace ErgometerApplication
this.energy = new PanelClientData("Energie", 0, 200); this.energy = new PanelClientData("Energie", 0, 200);
this.actualpower = new PanelClientData("Absolute Weerstand", 0, 400); this.actualpower = new PanelClientData("Absolute Weerstand", 0, 400);
this.time = new PanelClientData("Tijd", 0, 400); this.time = new PanelClientData("Tijd", 0, 400);
this.steps = new PanelClientSteps();
this.panelClientContainer.SuspendLayout(); this.panelClientContainer.SuspendLayout();
this.panelTopBar.SuspendLayout(); this.panelTopBar.SuspendLayout();
@@ -58,12 +58,11 @@ namespace ErgometerApplication
// //
// updateTimer // updateTimer
// //
this.updateTimer.Interval = 600; this.updateTimer.Interval = 500;
this.updateTimer.Tick += new System.EventHandler(this.updateTimer_Tick); this.updateTimer.Tick += new System.EventHandler(this.updateTimer_Tick);
// //
// panelClientContainer // panelClientContainer
// //
this.panelClientContainer.Controls.Add(this.panelGraphView);
this.panelClientContainer.Controls.Add(this.panelDataViewLeft); this.panelClientContainer.Controls.Add(this.panelDataViewLeft);
this.panelClientContainer.Controls.Add(this.panelClientChat); this.panelClientContainer.Controls.Add(this.panelClientChat);
@@ -75,7 +74,7 @@ namespace ErgometerApplication
// //
// panelDataViewLeft // panelDataViewLeft
// //
this.panelDataViewLeft.Dock = System.Windows.Forms.DockStyle.Left; this.panelDataViewLeft.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelDataViewLeft.Location = new System.Drawing.Point(0, 0); this.panelDataViewLeft.Location = new System.Drawing.Point(0, 0);
this.panelDataViewLeft.Name = "panelDataViewLeft"; this.panelDataViewLeft.Name = "panelDataViewLeft";
this.panelDataViewLeft.Size = new System.Drawing.Size(18, 600); this.panelDataViewLeft.Size = new System.Drawing.Size(18, 600);
@@ -88,6 +87,7 @@ namespace ErgometerApplication
this.panelDataViewLeft.Controls.Add(power); this.panelDataViewLeft.Controls.Add(power);
this.panelDataViewLeft.Controls.Add(energy); this.panelDataViewLeft.Controls.Add(energy);
this.panelDataViewLeft.Controls.Add(actualpower); this.panelDataViewLeft.Controls.Add(actualpower);
this.panelDataViewLeft.Controls.Add(steps);
this.panelDataViewLeft.Controls.Add(time); this.panelDataViewLeft.Controls.Add(time);
// //
@@ -161,7 +161,6 @@ namespace ErgometerApplication
this.Name = "ClientApplicatie"; this.Name = "ClientApplicatie";
this.Text = "Client Applicatie"; this.Text = "Client Applicatie";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Resize += new System.EventHandler(this.ClientApplicatie_Resize);
this.panelClientContainer.ResumeLayout(false); this.panelClientContainer.ResumeLayout(false);
this.panelTopBar.ResumeLayout(false); this.panelTopBar.ResumeLayout(false);
this.panelTopBar.PerformLayout(); this.panelTopBar.PerformLayout();
@@ -173,7 +172,6 @@ namespace ErgometerApplication
private System.Windows.Forms.Timer updateTimer; private System.Windows.Forms.Timer updateTimer;
private System.Windows.Forms.Panel panelClientContainer; private System.Windows.Forms.Panel panelClientContainer;
private PanelClientChat panelClientChat; private PanelClientChat panelClientChat;
private PanelGraphView panelGraphView;
private PanelLogin panelLogin; private PanelLogin panelLogin;
private System.Windows.Forms.Panel panelDataViewLeft; private System.Windows.Forms.Panel panelDataViewLeft;
private System.Windows.Forms.Panel panelTopBar; private System.Windows.Forms.Panel panelTopBar;
@@ -181,6 +179,7 @@ namespace ErgometerApplication
private System.Windows.Forms.Label labelUsername; private System.Windows.Forms.Label labelUsername;
private System.Windows.Forms.Label labelHallo; private System.Windows.Forms.Label labelHallo;
public PanelClientData heartBeat, RPM, speed, distance, power, energy, seconds, actualpower, time; public PanelClientData heartBeat, RPM, speed, distance, power, energy, seconds, actualpower, time;
public PanelClientSteps steps;
} }
@@ -21,17 +21,17 @@ namespace ErgometerApplication
public partial class ClientApplicatie : Form public partial class ClientApplicatie : Form
{ {
public PanelClientChat chat; public PanelClientChat chat;
private int count;
public ClientApplicatie() public ClientApplicatie()
{ {
InitializeComponent(); InitializeComponent();
MainClient.Init(this); MainClient.Init(this);
count = 0;
} }
private void updateTimer_Tick(object sender, EventArgs e) private void updateTimer_Tick(object sender, EventArgs e)
{ {
updateStepsText("Yeah: " + Helper.Now);
if(MainClient.Doctor.Connected) if(MainClient.Doctor.Connected)
{ {
MainClient.ComPort.Write("ST"); MainClient.ComPort.Write("ST");
@@ -48,14 +48,6 @@ namespace ErgometerApplication
energy.updateValue(m.Energy); energy.updateValue(m.Energy);
actualpower.updateValue(m.ActualPower); actualpower.updateValue(m.ActualPower);
time.updateValue(m.Seconds); time.updateValue(m.Seconds);
if (count >= 10)
{
count = 0;
panelGraphView.updateAllCharts(MainClient.Metingen);
}
count++;
} }
else else
{ {
@@ -104,29 +96,9 @@ namespace ErgometerApplication
} }
} }
private void ClientApplicatie_Resize(object sender, System.EventArgs e) public void updateStepsText(string text)
{ {
Control control = (Control)sender; steps.setText(text);
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;
}
} }
private void buttonLogOff_Click(object sender, EventArgs e) private void buttonLogOff_Click(object sender, EventArgs e)
@@ -60,6 +60,9 @@
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="MainClient.cs" /> <Compile Include="MainClient.cs" />
<Compile Include="PanelClientSteps.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="PanelClientData.cs"> <Compile Include="PanelClientData.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
@@ -69,9 +72,6 @@
<Compile Include="PanelClientContainer.cs"> <Compile Include="PanelClientContainer.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="PanelClientDataView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="PanelLogin.cs"> <Compile Include="PanelLogin.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
@@ -11,17 +11,14 @@ namespace ErgometerApplication
{ {
public PanelClientChat panelClientChat; public PanelClientChat panelClientChat;
public PanelGraphView panelGraphView;
public PanelClientContainer() : base() public PanelClientContainer() : base()
{ {
this.panelClientChat = new PanelClientChat(); this.panelClientChat = new PanelClientChat();
this.panelGraphView = new PanelGraphView();
// //
// panelClientContainer // panelClientContainer
// //
this.Controls.Add(this.panelGraphView);
this.Controls.Add(this.panelClientChat); this.Controls.Add(this.panelClientChat);
this.Dock = System.Windows.Forms.DockStyle.Fill; this.Dock = System.Windows.Forms.DockStyle.Fill;
this.Location = new System.Drawing.Point(0, 0); this.Location = new System.Drawing.Point(0, 0);
@@ -1,71 +0,0 @@
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 ErgometerApplication
{
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(0, 0, 0, 0, 0, 0, 0, 0, 0));
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, SeriesChartType.Line));
charts.Add(new ChartPanel(ChartPanel.MetingType.RPM, SeriesChartType.Line));
charts.Add(new ChartPanel(ChartPanel.MetingType.SPEED, SeriesChartType.Line));
charts.Add(new ChartPanel(ChartPanel.MetingType.DISTANCE, SeriesChartType.Line));
charts.Add(new ChartPanel(ChartPanel.MetingType.ENERGY, SeriesChartType.Line));
charts.Add(new ChartPanel(ChartPanel.MetingType.POWER, SeriesChartType.Line));
charts.Add(new ChartPanel(ChartPanel.MetingType.ACTUALPOWER, SeriesChartType.Line));
}
public void updateAllCharts(List<Meting> metingen)
{
foreach (ChartPanel chart in charts)
{
chart.updateChart(metingen);
}
}
}
}
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ErgometerApplication
{
public class PanelClientSteps : Panel
{
public Label UitlegText;
public Label HeaderLabel;
private string text;
public PanelClientSteps() : base()
{
this.HeaderLabel = new System.Windows.Forms.Label();
this.UitlegText = new System.Windows.Forms.Label();
//
// initialize panel
//
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Controls.Add(this.UitlegText);
this.Controls.Add(this.HeaderLabel);
this.Dock = System.Windows.Forms.DockStyle.Top;
this.Location = new System.Drawing.Point(0, 0);
this.Name = "PanelClientSteps";
this.Size = new System.Drawing.Size(284, 150);
//
// HeaderLabel
//
this.HeaderLabel.AutoSize = true;
this.HeaderLabel.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.HeaderLabel.Location = new System.Drawing.Point(12, 9);
this.HeaderLabel.Name = "HeaderLabel";
this.HeaderLabel.Size = new System.Drawing.Size(105, 21);
this.HeaderLabel.TabIndex = 0;
this.HeaderLabel.Text = "Uitleg";
//
// UitlegText
//
this.UitlegText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
this.UitlegText.AutoSize = true;
this.UitlegText.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.UitlegText.Location = new System.Drawing.Point(12, 35);
this.UitlegText.Name = "UitlegText";
this.UitlegText.Size = new System.Drawing.Size(800, 32);
this.UitlegText.TabIndex = 2;
this.UitlegText.Text = text;
}
public void setText(string text)
{
this.UitlegText.Text = text;
}
}
}