59 Commits
Author SHA1 Message Date
kennyboy55 60e96d5d62 bugfix 2015-11-03 17:56:04 +01:00
kennyboy55 d48471ea34 Actually reduced cpu usage by 30% 2015-11-01 20:49:25 +01:00
kennyboy55 9fa1512efd Reduced CPU usage by roughly 30% 2015-11-01 20:35:07 +01:00
kennyboy55 b4fc8c2dfa Added time panel 2015-10-21 16:50:09 +02:00
kennyboy55 7f32a5edf3 Changed min/max values 2015-10-20 23:51:31 +02:00
kennyboy55 cdcf002b50 Bugfixes 2015-10-20 23:26:44 +02:00
kennyboy55 28a410dac8 Attempt fix server disconnect 2015-10-20 23:11:38 +02:00
kennyboy55 cd8b2bc634 Handle Ergometer disconnect 2015-10-20 22:40:44 +02:00
kennyboy55 30c9b7c6e3 Added broadcast 2015-10-20 19:40:34 +02:00
kennyboy55 87ef3a7b39 Fixed comport interaction with ergometer 2015-10-20 17:06:27 +02:00
kennyboy55 592be09b12 Changed error 2015-10-20 16:02:53 +02:00
kennyboy55 e615496c81 Changed size 2015-10-20 13:43:42 +02:00
kennyboy55 274281649c Changed chatmessage 2015-10-20 12:56:09 +02:00
kennyboy55 672427c13f Fixed login verification and gui 2015-10-20 11:19:54 +02:00
kennyboy55 0522d43a19 Changed connect order 2015-10-20 00:27:21 +02:00
kennyboy55 f0578091d8 Rebuild connecting, bugfixes 2015-10-19 22:25:23 +02:00
kennyboy55 f03ccad863 Move ChatItem to library. Fix bugs with connecting. 2015-10-19 18:52:09 +02:00
kennyboy55 14c332bd16 Fixed chat 2015-10-19 17:31:17 +02:00
kennyboy55 42e9b18ab5 Added chat functionality (broken) 2015-10-17 21:47:04 +02:00
Aareschluchtje 09a23d48f3 "fixed something" 2015-10-17 10:44:33 +02:00
Jannick van Ballegooijen 3edb47769b Merge branch 'develop' of https://github.com/KettlerX7AvansA5/ErgometerApplication into develop 2015-10-16 22:06:17 +02:00
Jannick van Ballegooijen 511766c6e9 Added Charts 2015-10-16 22:05:21 +02:00
Aareschluchtje 4c78826a2a Sends messages to server, but can't display them. 2015-10-16 13:15:16 +02:00
Aareschluchtje c73352bf8b Fixed a little problem 2015-10-16 11:55:37 +02:00
Jannick van Ballegooijen ae803e7f6c fixed chat gui 2015-10-16 10:26:37 +02:00
Jannick van Ballegooijen c54a9f5d6f added chat 2015-10-14 09:41:21 +02:00
kennyboy55 65444382be Bugfix 2015-10-13 22:03:42 +02:00
kennyboy55 23eda18369 Bugfix 2015-10-09 20:49:33 +02:00
kennyboy55 2f5b35bcaa Parse ValueSet 2015-10-09 11:16:10 +02:00
kennyboy55 272bd07ca5 New Library 2015-10-09 10:06:56 +02:00
kennyboy55 a46f7bee93 Added login, connecting and showing data 2015-10-08 22:40:53 +02:00
kennyboy55 3d1bc8ebb9 Bugfixes 2015-10-08 18:30:12 +02:00
kennyboy55 f5dd70db71 Rebuilt core client code 2015-10-08 17:05:35 +02:00
kennyboy55 799dc88f92 Changed names and started net implementation 2015-10-05 12:52:02 +02:00
Jannick van Ballegooijen 751063f834 added datapanels 2015-10-05 11:35:45 +02:00
Jannick van Ballegooijen 69324dff58 Added responsiveness 2015-10-05 09:54:20 +02:00
Jannick van Ballegooijen f0500509b8 Added base functionality for login screen 2015-10-04 21:25:36 +02:00
Jannick van Ballegooijen 0f87314642 Setup base form 2015-10-04 13:56:48 +02:00
kennyboy55 3da8a0cbf2 Updated 2015-10-02 13:40:22 +02:00
kennyboy55 7518dad22a Fixed server communication 2015-10-02 13:39:32 +02:00
kennyboy55 c7318ae844 Merge remote-tracking branch 'origin/develop' into develop 2015-10-02 10:13:24 +02:00
kennyboy55 467b8a9959 Added gitignore 2015-10-02 10:12:32 +02:00
Aareschluchtje 795315507c Bugfix 2015-09-30 12:58:15 +02:00
Aareschluchtje b7e957f9a3 And another commit with bugfixes... 2015-09-28 18:51:52 +02:00
Aareschluchtje 5ee3b5236e Shit is hopelijk gefixt nu 2015-09-28 12:58:02 +02:00
Aareschluchtje 2607230395 Another commit with bugfixes. 2015-09-28 10:38:43 +02:00
Aareschluchtje 9ea907ab99 Changed server setup 2015-09-28 10:09:00 +02:00
Aareschluchtje 60b80fba15 Added missing .gitignore file. 2015-09-27 15:27:30 +02:00
Aareschluchtje 483ebbc46e Fixed some errors in ErgometerApplication 2015-09-25 13:56:01 +02:00
sandriek d34af65274 naar server schrijven en readen als goed is 2015-09-25 12:21:11 +02:00
sandriek e7f277038a gedeeltelijke server connectie 2015-09-25 10:47:14 +02:00
sandriek 34f51dd3e8 save and read in apparte klasse 2015-09-25 09:06:48 +02:00
kennyboy55 ab360cb44d Changed something 2015-09-21 12:58:43 +02:00
kennyboy55 350a28cd83 Change structure, bugfixes, change file saving. 2015-09-17 16:34:34 +02:00
sandriek 81252a2d0c Merge remote-tracking branch 'origin/develop' into develop
Conflicts:
	ErgometerApplication/.vs/ErgometerApplication/v14/.suo
	ErgometerApplication/ErgometerApplication/Ergometer.cs

	ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerApplication.exe

	ErgometerApplication/ErgometerApplication/bin/Debug/ErgometerApplication.pdb

	ErgometerApplication/ErgometerApplication/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

	ErgometerApplication/ErgometerApplication/obj/Debug/ErgometerApplication.csproj.FileListAbsolute.txt

	ErgometerApplication/ErgometerApplication/obj/Debug/ErgometerApplication.csproj.GenerateResource.Cache

	ErgometerApplication/ErgometerApplication/obj/Debug/ErgometerApplication.csprojResolveAssemblyReference.cache

	ErgometerApplication/ErgometerApplication/obj/Debug/ErgometerApplication.exe

	ErgometerApplication/ErgometerApplication/obj/Debug/ErgometerApplication.pdb
2015-09-17 15:18:48 +02:00
sandriek 8e6e091390 opslaan en ophalen
het ophalen werkt en is met een file opener.
het opslaan is met een timer op het moment.
er zit een file bij die data van het opslaan bevat.
2015-09-17 15:14:14 +02:00
Aareschluchtje 84cded4d6b Bug fixes 2015-09-14 12:05:27 +02:00
sandriek 17f72ca63a opslaan
opslaan
2015-09-14 11:40:32 +02:00
Aareschluchtje 54dfa7131b Copied files from ErgometerUitlezer 2015-09-14 11:23:46 +02:00
50 changed files with 63059 additions and 105 deletions
+212
View File
@@ -0,0 +1,212 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 14
VisualStudioVersion = 14.0.23107.0 VisualStudioVersion = 14.0.22823.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ErgometerApplication", "ErgometerApplication\ErgometerApplication.csproj", "{1191E100-AA1B-4F41-85E2-EC2BE8ED39FD}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ErgometerApplication", "ErgometerApplication\ErgometerApplication.csproj", "{1191E100-AA1B-4F41-85E2-EC2BE8ED39FD}"
EndProject EndProject
@@ -0,0 +1,105 @@
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 ChartPanel : Panel
{
private Chart chart;
private MetingType type;
private ChartArea chartArea;
private Series series;
private SeriesChartType ChartType;
public ChartPanel(MetingType type, SeriesChartType charttype) : base()
{
this.type = type;
this.ChartType = charttype;
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(400, 250);
this.Controls.Add(chart);
this.series = createSerie();
this.chartArea.Name = "chartArea";
this.chart.Size = new System.Drawing.Size(400, 250);
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 = ChartType;
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,187 @@
using System.IO.Ports;
using System.Windows.Forms;
namespace ErgometerApplication
{
partial class ClientApplicatie
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.updateTimer = new System.Windows.Forms.Timer(this.components);
this.panelClientContainer = new System.Windows.Forms.Panel();
this.panelDataViewLeft = new System.Windows.Forms.Panel();
this.panelGraphView = new ErgometerApplication.PanelGraphView();
this.panelClientChat = new ErgometerApplication.PanelClientChat();
this.panelLogin = new ErgometerApplication.PanelLogin(this);
this.panelTopBar = new System.Windows.Forms.Panel();
this.buttonLogOff = new System.Windows.Forms.Button();
this.labelUsername = new System.Windows.Forms.Label();
this.labelHallo = new System.Windows.Forms.Label();
this.heartBeat = new PanelClientData("Hartslag", 50, 220);
this.RPM = new PanelClientData("RPM", 0, 120);
this.speed = new PanelClientData("Snelheid", 0, 50);
this.distance = new PanelClientData("Afstand (km)", 0, 100);
this.power = new PanelClientData("Weerstand", 25, 400);
this.energy = new PanelClientData("Energie", 0, 200);
this.actualpower = new PanelClientData("Absolute Weerstand", 0, 400);
this.time = new PanelClientData("Tijd", 0, 400);
this.panelClientContainer.SuspendLayout();
this.panelTopBar.SuspendLayout();
this.SuspendLayout();
//
// updateTimer
//
this.updateTimer.Interval = 600;
this.updateTimer.Tick += new System.EventHandler(this.updateTimer_Tick);
//
// 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);
this.panelDataViewLeft.Controls.Add(time);
//
// 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.buttonLogOff);
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;
//
// buttonLogOff
//
this.buttonLogOff.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLogOff.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.buttonLogOff.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonLogOff.Font = new System.Drawing.Font("Segoe UI Light", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonLogOff.Location = new System.Drawing.Point(722, 3);
this.buttonLogOff.Name = "buttonLogOff";
this.buttonLogOff.Size = new System.Drawing.Size(75, 23);
this.buttonLogOff.TabIndex = 1;
this.buttonLogOff.Text = "Afmelden";
this.buttonLogOff.UseVisualStyleBackColor = false;
this.buttonLogOff.Click += new System.EventHandler(this.buttonLogOff_Click);
//
// 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, ";
//
// ClientApplicatie
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(700, 500);
this.MinimumSize = new System.Drawing.Size(550, 550);
this.Controls.Add(this.panelTopBar);
this.Controls.Add(this.panelLogin);
this.Controls.Add(this.panelClientContainer);
this.Name = "ClientApplicatie";
this.Text = "Client Applicatie";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
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.Timer updateTimer;
private System.Windows.Forms.Panel panelClientContainer;
private PanelClientChat panelClientChat;
private PanelGraphView panelGraphView;
private PanelLogin panelLogin;
private System.Windows.Forms.Panel panelDataViewLeft;
private System.Windows.Forms.Panel panelTopBar;
private System.Windows.Forms.Button buttonLogOff;
private System.Windows.Forms.Label labelUsername;
private System.Windows.Forms.Label labelHallo;
public PanelClientData heartBeat, RPM, speed, distance, power, energy, seconds, actualpower, time;
}
}
@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
using System.IO;
using System.Net.Sockets;
using System.Net;
using System.Timers;
using ErgometerLibrary;
namespace ErgometerApplication
{
public partial class ClientApplicatie : Form
{
public PanelClientChat chat;
private int count;
public ClientApplicatie()
{
InitializeComponent();
MainClient.Init(this);
count = 0;
}
private void updateTimer_Tick(object sender, EventArgs e)
{
if(MainClient.Doctor.Connected)
{
MainClient.ComPort.Write("ST");
string response = MainClient.ComPort.Read();
if (response != "err")
{
Meting m = MainClient.SaveMeting(response);
heartBeat.updateValue(m.HeartBeat);
RPM.updateValue(m.RPM);
speed.updateValue(m.Speed);
distance.updateValue(m.Distance);
power.updateValue(m.Power);
energy.updateValue(m.Energy);
actualpower.updateValue(m.ActualPower);
time.updateValue(m.Seconds);
if (count >= 10)
{
count = 0;
panelGraphView.updateAllCharts(MainClient.Metingen);
}
count++;
}
else
{
logout("De Ergometer is niet meer verbonden.", Color.Red);
}
}
}
public void validateLogin(string username, string password)
{
if (username.Length > 0)
{
if (password.Length == 0)
{
panelLogin.lblVerification.Text = "Vul een wachtwoord in.";
panelLogin.lblVerification.ForeColor = Color.Red;
panelLogin.lblVerification.Visible = true;
}
if (password.Length > 0)
{
string error = "";
bool connect = MainClient.Connect(SerialPort.GetPortNames()[0], username, password, out error);
if (connect)
{
panelClientContainer.BringToFront();
chat = panelClientChat;
this.labelUsername.Text = panelLogin.textBoxUsername.Text;
panelTopBar.Visible = true;
updateTimer.Start();
}
else
{
panelLogin.lblVerification.Text = error;
panelLogin.lblVerification.ForeColor = Color.Red;
panelLogin.lblVerification.Visible = true;
}
}
}
else
{
panelLogin.lblVerification.Text = "Vul een gebruikersnaam in.";
panelLogin.lblVerification.ForeColor = Color.Red;
panelLogin.lblVerification.Visible = true;
}
}
private void ClientApplicatie_Resize(object sender, System.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;
}
}
private void buttonLogOff_Click(object sender, EventArgs e)
{
logout("U bent uitgelogd.", Color.Blue);
}
private void logout(string message, System.Drawing.Color cl)
{
panelLogin.BringToFront();
panelTopBar.Visible = false;
panelLogin.lblVerification.Text = message;
panelLogin.lblVerification.ForeColor = cl;
panelLogin.lblVerification.Visible = true;
panelLogin.textBoxUsername.Text = "";
panelLogin.textBoxPassword.Text = "";
MainClient.Disconnect();
updateTimer.Stop();
}
}
}
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="updateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>
@@ -33,8 +33,18 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ErgometerLibrary, Version=1.0.0.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\ErgometerLibrary\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <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.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@@ -46,14 +56,36 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Form1.cs"> <Compile Include="ChartPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MainClient.cs" />
<Compile Include="PanelClientData.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="PanelClientChat.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="PanelClientContainer.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="PanelClientDataView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="PanelLogin.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ClientApplicatie.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Form1.Designer.cs"> <Compile Include="ClientApplicatie.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>ClientApplicatie.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="ClientApplicatie.resx">
<DependentUpon>ClientApplicatie.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -62,7 +94,9 @@
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile> </Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -76,6 +110,12 @@
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\flatbike.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
@@ -1,39 +0,0 @@
namespace ErgometerApplication
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "Form1";
}
#endregion
}
}
@@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ErgometerApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,284 @@
using ErgometerLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ErgometerApplication
{
class MainClient
{
public static ComPort ComPort { get; }
public static TcpClient Doctor { get; set; }
public static List<Meting> Metingen { get; }
public static List<ChatMessage> Chat { get; }
public static string Name;
public static int Session;
public static bool Loggedin;
private static Thread t;
private static bool running;
public static string HOST = "127.0.0.1";
public static int PORT = 8888;
public static ClientApplicatie Client;
static MainClient()
{
ComPort = new ComPort();
Doctor = new TcpClient();
Metingen = new List<Meting>();
Chat = new List<ChatMessage>();
Name = "Unknown";
Session = 0;
Loggedin = false;
}
public static void Init(ClientApplicatie client)
{
Client = client;
}
public static bool Connect(string comport, string name, string password, out string error)
{
error = "Succes";
if (!ComPort.IsOpen())
{
if (ComPort.Connect(comport))
{
ComPort.Write("RS");
string temp = ComPort.Read();
if (temp == "err")
{
ComPort.Disconnect();
error = "De Ergometer is niet verbonden";
return false;
}
Thread.Sleep(200);
ComPort.Write("CM");
ComPort.Read();
Thread.Sleep(200);
ComPort.Write("ST");
string response = ComPort.Read();
SaveMeting(response);
}
else
{
error = "De ergometer is niet verbonden";
return false;
}
}
if (Doctor == null || !Doctor.Connected)
{
if (Doctor == null)
Doctor = new TcpClient();
try
{
Doctor.Connect(HOST, PORT);
}
catch (Exception e)
{
error = "Server is niet online.";
return false;
}
Name = name;
NetCommand net = NetHelper.ReadNetCommand(Doctor);
if (net.Type == NetCommand.CommandType.SESSION)
Session = net.Session;
else
throw new Exception("Session not assigned");
running = true;
t = new Thread(run);
t.IsBackground = true;
t.Start();
}
if(! Loggedin)
{
NetCommand command = new NetCommand(name, false, password, Session);
NetHelper.SendNetCommand(Doctor, command);
NetCommand response = NetHelper.ReadNetCommand(Doctor);
if (response.Type == NetCommand.CommandType.RESPONSE && response.Response == NetCommand.ResponseType.LOGINWRONG)
{
Loggedin = false;
error = "De inloggegevens zijn onjuist.";
return false;
}
Loggedin = true;
}
return true;
}
public static void Disconnect()
{
if (ComPort.IsOpen())
{
if (ComPort.Disconnect())
{
}
else
throw new Exception("Comport was unable to disconnect");
}
if (Doctor != null && Doctor.Connected)
{
NetHelper.SendNetCommand(Doctor, new NetCommand(NetCommand.CommandType.LOGOUT, Session));
Loggedin = false;
running = false;
Doctor.Close();
Doctor = null;
}
}
public static Meting SaveMeting(string meting)
{
Meting m = null;
try
{
m = Meting.Parse(meting);
}
catch(Exception e)
{
return new Meting(0, 0, 0, 0, 0, 0, 0, 0, 0);
}
Metingen.Add(m);
if (Doctor != null && Doctor.Connected)
{
NetHelper.SendNetCommand(Doctor, new NetCommand(m, Session));
}
return m;
}
public static void run()
{
while(running)
{
if(Doctor.Connected)
{
NetCommand command = NetHelper.ReadNetCommand(Doctor);
ParseCommand(command);
}
}
if(Doctor != null)
Doctor.Close();
}
private static void ParseCommand(NetCommand command)
{
switch(command.Type)
{
case NetCommand.CommandType.VALUESET:
ParseValueSet(command);
break;
case NetCommand.CommandType.CHAT:
ChatMessage chat = new ChatMessage(command.DisplayName, command.ChatMessage, true);
Chat.Add(chat);
Client.chat.Invoke(Client.chat.passChatMessage, new Object[] { chat });
break;
case NetCommand.CommandType.RESPONSE:
Console.WriteLine(command.Response.ToString());
break;
case NetCommand.CommandType.SESSION:
Session = command.Session;
break;
case NetCommand.CommandType.ERROR:
Console.WriteLine("An error occured, ignoring");
break;
default:
throw new FormatException("Error in Netcommand: Received command not recognized");
}
}
public static void SendNetCommand(NetCommand command)
{
if(! NetHelper.SendNetCommand(Doctor, command))
{
Disconnect();
}
}
private static void ParseValueSet(NetCommand command)
{
switch(command.Value)
{
case NetCommand.ValueType.DISTANCE:
ComPort.Write("RS");
ComPort.Read();
Thread.Sleep(200);
ComPort.Write("CM");
ComPort.Read();
Thread.Sleep(700);
ComPort.Write("PD " + command.SetValue.ToString());
ComPort.Read();
break;
case NetCommand.ValueType.ENERGY:
ComPort.Write("RS");
ComPort.Read();
Thread.Sleep(200);
ComPort.Write("CM");
ComPort.Read();
Thread.Sleep(700);
ComPort.Write("PE " + command.SetValue.ToString());
ComPort.Read();
break;
case NetCommand.ValueType.POWER:
ComPort.Write("CM");
ComPort.Read();
Thread.Sleep(200);
ComPort.Write("PW " + command.SetValue.ToString());
ComPort.Read();
break;
case NetCommand.ValueType.TIME:
ComPort.Write("RS");
ComPort.Read();
Thread.Sleep(200);
ComPort.Write("CM");
ComPort.Read();
Thread.Sleep(700);
string temp = (command.SetValue / 60) + "";
if(temp.Length < 2)
{
temp = "0" + temp;
}
string temp2 = (command.SetValue % 60) + "";
if (temp2.Length < 2)
{
temp2 = "0" + temp2;
}
string time = temp + temp2;
ComPort.Write("PT " + time);
ComPort.Read();
break;
default:
throw new FormatException("Error in NetCommand: ValueSet is not recognized");
}
}
}
}
@@ -0,0 +1,202 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ErgometerLibrary;
using ErgometerLibrary.Chat;
namespace ErgometerApplication
{
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: Doctor";
//
// 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 = "Send";
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);
passChatMessage = new ChatDelegate(this.AddChatItem);
}
private void button1_Click(object sender, EventArgs e)
{
if (richTextBox1.TextLength > 1)
{
AddChatItem(new ChatMessage("Anon", richTextBox1.Text, false));
MainClient.SendNetCommand(new NetCommand(richTextBox1.Text, false, MainClient.Session));
richTextBox1.ResetText();
}
}
public void AddChatItem(ChatMessage chat)
{
flowLayoutPanel1.Controls.Add(new ChatItem(chat));
}
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());
e.Handled = true;
}
}
public delegate void ChatDelegate(ChatMessage chat);
public ChatDelegate passChatMessage;
}
}
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ErgometerApplication
{
public class PanelClientContainer:Panel
{
public PanelClientChat panelClientChat;
public PanelGraphView panelGraphView;
public PanelClientContainer() : base()
{
this.panelClientChat = new PanelClientChat();
this.panelGraphView = new PanelGraphView();
//
// panelClientContainer
//
this.Controls.Add(this.panelGraphView);
this.Controls.Add(this.panelClientChat);
this.Dock = System.Windows.Forms.DockStyle.Fill;
this.Location = new System.Drawing.Point(0, 0);
this.Name = "panelClientContainer";
this.Size = new System.Drawing.Size(800, 600);
this.TabIndex = 0;
}
}
}
@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ErgometerApplication
{
public class PanelClientData : Panel
{
public Label labelMetingCurrentValue;
public ProgressBar progressBarMeting;
public Label metingName;
private int min;
private int max;
private string name;
public PanelClientData(string name, int min, int max) : base()
{
this.min = min;
this.max = max;
this.name = name;
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);
if(name != "Tijd")
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)
{
if (name == "Tijd")
{
this.labelMetingCurrentValue.Text = (value / 60) + ":" + (value % 60);
}
else
{
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,71 @@
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,158 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ErgometerApplication
{
public class PanelLogin:Panel
{
private System.Windows.Forms.Label lblUsername;
private System.Windows.Forms.Label lblPassword;
public System.Windows.Forms.Label lblVerification;
public System.Windows.Forms.TextBox textBoxPassword;
public System.Windows.Forms.TextBox textBoxUsername;
public System.Windows.Forms.Button buttonLogin;
private System.Windows.Forms.Label lblLoginTitle;
private System.Windows.Forms.PictureBox pictureBoxBike;
private ClientApplicatie app;
public PanelLogin(ClientApplicatie app):base()
{
this.app = app;
this.pictureBoxBike = new System.Windows.Forms.PictureBox();
this.buttonLogin = new System.Windows.Forms.Button();
this.textBoxPassword = new System.Windows.Forms.TextBox();
this.textBoxUsername = new System.Windows.Forms.TextBox();
this.lblLoginTitle = new System.Windows.Forms.Label();
this.lblUsername = new System.Windows.Forms.Label();
this.lblPassword = new System.Windows.Forms.Label();
this.lblVerification = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBike)).BeginInit();
//
// panelLogin
//
this.Controls.Add(this.pictureBoxBike);
this.Controls.Add(this.buttonLogin);
this.Controls.Add(this.textBoxUsername);
this.Controls.Add(this.textBoxPassword);
this.Controls.Add(this.lblLoginTitle);
this.Controls.Add(this.lblUsername);
this.Controls.Add(this.lblPassword);
this.Controls.Add(this.lblVerification);
this.Dock = System.Windows.Forms.DockStyle.Fill;
this.Location = new System.Drawing.Point(0, 0);
this.Name = "panelLogin";
this.Size = new System.Drawing.Size(800, 600);
this.TabIndex = 0;
//
// pictureBoxBike
//
this.pictureBoxBike.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pictureBoxBike.Image = global::ErgometerApplication.Properties.Resources.flatbike;
this.pictureBoxBike.Location = new System.Drawing.Point(137, 131);
this.pictureBoxBike.Name = "pictureBoxBike";
this.pictureBoxBike.Size = new System.Drawing.Size(250, 250);
this.pictureBoxBike.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxBike.TabIndex = 4;
this.pictureBoxBike.TabStop = false;
//
// buttonLogin
//
this.buttonLogin.Anchor = System.Windows.Forms.AnchorStyles.None;
this.buttonLogin.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonLogin.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonLogin.Location = new System.Drawing.Point(468, 338);
this.buttonLogin.Name = "buttonLogin";
this.buttonLogin.Size = new System.Drawing.Size(168, 31);
this.buttonLogin.TabIndex = 3;
this.buttonLogin.Text = "Aanmelden";
this.buttonLogin.UseVisualStyleBackColor = true;
this.buttonLogin.Click += new System.EventHandler(this.buttonLogin_Click);
//
// textBoxPassword
//
this.textBoxPassword.Anchor = System.Windows.Forms.AnchorStyles.None;
this.textBoxPassword.Location = new System.Drawing.Point(467, 287);
this.textBoxPassword.MaxLength = 16;
this.textBoxPassword.Name = "textBoxPassword";
this.textBoxPassword.PasswordChar = '*';
this.textBoxPassword.Size = new System.Drawing.Size(167, 20);
this.textBoxPassword.TabIndex = 2;
this.textBoxPassword.KeyDown += TextBoxPassword_KeyDown;
//
// textBoxUsername
//
this.textBoxUsername.Anchor = System.Windows.Forms.AnchorStyles.None;
this.textBoxUsername.Location = new System.Drawing.Point(468, 231);
this.textBoxUsername.MaxLength = 16;
this.textBoxUsername.Name = "textBoxUsername";
this.textBoxUsername.Size = new System.Drawing.Size(167, 20);
this.textBoxUsername.TabIndex = 2;
this.textBoxUsername.KeyDown += TextBoxPassword_KeyDown;
//
// lblLoginTitle
//
this.lblLoginTitle.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lblLoginTitle.AutoSize = true;
this.lblLoginTitle.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLoginTitle.Location = new System.Drawing.Point(461, 141);
this.lblLoginTitle.Name = "lblLoginTitle";
this.lblLoginTitle.Size = new System.Drawing.Size(87, 32);
this.lblLoginTitle.TabIndex = 1;
this.lblLoginTitle.Text = "Log In";
//
// lblVerification
//
this.lblVerification.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lblVerification.AutoSize = true;
this.lblVerification.Font = new System.Drawing.Font("Segoe UI Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblVerification.Location = new System.Drawing.Point(140, 415);
this.lblVerification.Name = "lvlVerification";
this.lblVerification.Size = new System.Drawing.Size(200, 21);
this.lblVerification.TabIndex = 1;
this.lblVerification.Text = "Verification label";
this.lblVerification.Visible = false;
//
// lblUsername
//
this.lblUsername.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lblUsername.AutoSize = true;
this.lblUsername.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblUsername.Location = new System.Drawing.Point(464, 207);
this.lblUsername.Name = "lblUsername";
this.lblUsername.Size = new System.Drawing.Size(128, 21);
this.lblUsername.TabIndex = 1;
this.lblUsername.Text = "Gebruikersnaam";
//
// lblPassword
//
this.lblPassword.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lblPassword.AutoSize = true;
this.lblPassword.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold);
this.lblPassword.Location = new System.Drawing.Point(464, 263);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(103, 21);
this.lblPassword.TabIndex = 0;
this.lblPassword.Text = "Wachtwoord";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBike)).EndInit();
}
private void TextBoxPassword_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
buttonLogin_Click(this, new EventArgs());
}
}
public void buttonLogin_Click(object sender, EventArgs e)
{
string username = textBoxUsername.Text;
string password = textBoxPassword.Text;
this.app.validateLogin(username,password);
}
}
}
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO.Ports;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@@ -16,7 +17,7 @@ namespace ErgometerApplication
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); Application.Run(new ClientApplicatie());
} }
} }
} }
@@ -8,8 +8,8 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace ErgometerApplication.Properties namespace ErgometerApplication.Properties {
{ using System;
/// <summary> /// <summary>
@@ -22,28 +22,23 @@ namespace ErgometerApplication.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources internal class Resources {
{
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() internal Resources() {
{
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager internal static global::System.Resources.ResourceManager ResourceManager {
{ get {
get if (object.ReferenceEquals(resourceMan, null)) {
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ErgometerApplication.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ErgometerApplication.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
@@ -56,16 +51,23 @@ namespace ErgometerApplication.Properties
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture internal static global::System.Globalization.CultureInfo Culture {
{ get {
get
{
return resourceCulture; return resourceCulture;
} }
set set {
{
resourceCulture = value; resourceCulture = value;
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap flatbike {
get {
object obj = ResourceManager.GetObject("flatbike", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
} }
} }
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
@@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
@@ -109,9 +112,13 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="flatbike" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\flatbike.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
File diff suppressed because it is too large Load Diff
@@ -1 +1,43 @@
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.exe.config C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.exe.config
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.exe.config
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.exe
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.pdb
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csprojResolveAssemblyReference.cache
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.Properties.Resources.resources
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csproj.GenerateResource.Cache
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.exe
C:\Users\Remco\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.pdb
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.exe
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.pdb
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.exe
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.pdb
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\Newtonsoft.Json.dll
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\Newtonsoft.Json.xml
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csprojResolveAssemblyReference.cache
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.Ergometer.resources
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.Properties.Resources.resources
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csproj.GenerateResource.Cache
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerLibrary.dll
C:\Users\sander\Documents\GitHub\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerLibrary.pdb
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.exe.config
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.exe
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.pdb
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\Newtonsoft.Json.dll
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\Newtonsoft.Json.xml
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csprojResolveAssemblyReference.cache
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.Properties.Resources.resources
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csproj.GenerateResource.Cache
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.exe
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.pdb
C:\Users\startklaar\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.ClientApplicatie.resources
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.exe.config
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.exe
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.pdb
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.exe
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\ErgometerApplication.pdb
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\Newtonsoft.Json.dll
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\bin\Debug\Newtonsoft.Json.xml
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csprojResolveAssemblyReference.cache
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.ClientApplicatie.resources
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.Properties.Resources.resources
D:\Source\Repos\ErgometerApplication\ErgometerApplication\ErgometerApplication\obj\Debug\ErgometerApplication.csproj.GenerateResource.Cache
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
</packages>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,112 @@
param($installPath, $toolsPath, $package, $project)
# open json.net splash page on package install
# don't open if json.net is installed as a dependency
try
{
$url = "http://www.newtonsoft.com/json/install?version=" + $package.Version
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWindow.Caption -eq "Package Manager Console")
{
# user is installing from VS NuGet console
# get reference to the window, the console host and the input history
# show webpage if "install-package newtonsoft.json" was last input
$consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow])
$props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
$prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1
if ($prop -eq $null) { return }
$hostInfo = $prop.GetValue($consoleWindow)
if ($hostInfo -eq $null) { return }
$history = $hostInfo.WpfConsole.InputHistory.History
$lastCommand = $history | select -last 1
if ($lastCommand)
{
$lastCommand = $lastCommand.Trim().ToLower()
if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json"))
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
}
else
{
# user is installing from VS NuGet dialog
# get reference to the window, then smart output console provider
# show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation
$instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor `
[System.Reflection.BindingFlags]::NonPublic)
$consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
if ($instanceField -eq $null -or $consoleField -eq $null) { return }
$instance = $instanceField.GetValue($null)
if ($instance -eq $null) { return }
$consoleProvider = $consoleField.GetValue($instance)
if ($consoleProvider -eq $null) { return }
$console = $consoleProvider.CreateOutputConsole($false)
$messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
if ($messagesField -eq $null) { return }
$messages = $messagesField.GetValue($console)
if ($messages -eq $null) { return }
$operations = $messages -split "=============================="
$lastOperation = $operations | select -last 1
if ($lastOperation)
{
$lastOperation = $lastOperation.ToLower()
$lines = $lastOperation -split "`r`n"
$installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json ") } | select -first 1
if ($installMatch)
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
}
}
catch
{
try
{
$pmPane = $dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Package Manager")
$selection = $pmPane.TextDocument.Selection
$selection.StartOfDocument($false)
$selection.EndOfDocument($true)
if ($selection.Text.StartsWith("Attempting to gather dependencies information for package 'Newtonsoft.Json." + $package.Version + "'"))
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
catch
{
# stop potential errors from bubbling up
# worst case the splash page won't open
}
}
# still yolo
+2
View File
@@ -0,0 +1,2 @@
[{"HeartBeat":0,"RPM":0,"Speed":0.0,"Distance":0.0,"Power":0,"Energy":0,"Seconds":4,"ActualPower":0},
{"HeartBeat":10,"RPM":64,"Speed":99.0,"Distance":20.0,"Power":30,"Energy":89,"Seconds":4,"ActualPower":30}]