Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e78a50bc15 | ||
|
|
1264d2d6c9 | ||
|
|
2de542f664 | ||
|
|
b99449a4cf | ||
|
|
e94a6d331a | ||
|
|
5b85db9ab8 | ||
|
|
0eb23e0dc4 | ||
|
|
ba88fcb47f | ||
|
|
0f2618a1e9 | ||
|
|
4638ce8cae | ||
|
|
f41047300f | ||
|
|
d01ad475a1 | ||
|
|
29051fdaff | ||
|
|
1d968bc263 | ||
|
|
1c149736ba | ||
|
|
d67221d19f | ||
|
|
9f992bb38b | ||
|
|
9c499b241d | ||
|
|
52c9ef0155 | ||
|
|
679d3ad4ef | ||
|
|
33a5ffe7af | ||
|
|
1c0028be4f | ||
|
|
c043b92e31 | ||
|
|
5af966a6d9 | ||
|
|
b1b47acec9 | ||
|
|
0894ea7231 | ||
|
|
ea6a2316a8 | ||
|
|
88b32e83f2 | ||
|
|
a0e71b562b | ||
|
|
38f5ee9ee4 | ||
|
|
91a659b6fb | ||
|
|
dfc4ab9b42 | ||
|
|
48b9e1365e | ||
|
|
af684d2986 | ||
|
|
90c4072bb1 | ||
|
|
1e1cc54371 | ||
|
|
689897626b | ||
|
|
3d52e6d36a | ||
|
|
3ccf78b3ff | ||
|
|
3e854214dd | ||
|
|
96b15eb85a | ||
|
|
a977b90d80 | ||
|
|
10f7c0ecfc | ||
|
|
e65d80edc2 | ||
|
|
520a6f61ff | ||
|
|
670adcaf11 | ||
|
|
a401fdc4c5 | ||
|
|
a645f2fe05 | ||
|
|
5839452e20 | ||
|
|
1e97975bad | ||
|
|
22e773d25a | ||
|
|
32cef0289d | ||
|
|
586493739e | ||
|
|
b8e37fdbcf | ||
|
|
84acd482d7 | ||
|
|
c3844d6299 | ||
|
|
0877f3e607 |
@@ -0,0 +1,63 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
@@ -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 ErgometerDoctorApplication
|
||||
{
|
||||
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,81 @@
|
||||
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 ClientThread
|
||||
{
|
||||
public int Session { get; }
|
||||
public string Name { get; }
|
||||
|
||||
public bool IsOldData { get; }
|
||||
|
||||
private SessionWindow window;
|
||||
|
||||
public List<Meting> Metingen { get; set; }
|
||||
public List<ChatMessage> Chat { get; }
|
||||
|
||||
public ClientThread(string name, int session, bool old)
|
||||
{
|
||||
Name = name;
|
||||
Session = session;
|
||||
IsOldData = old;
|
||||
|
||||
window = new SessionWindow(Name, old, Session, this);
|
||||
window.FormClosed += Window_FormClosed;
|
||||
|
||||
Metingen = new List<Meting>();
|
||||
Chat = new List<ChatMessage>();
|
||||
}
|
||||
|
||||
private void Window_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
MainClient.RemoveActiveClient(this);
|
||||
}
|
||||
|
||||
public void HandleCommand(NetCommand command)
|
||||
{
|
||||
switch (command.Type)
|
||||
{
|
||||
case NetCommand.CommandType.DATA:
|
||||
if (command != null && command.Meting != null)
|
||||
{
|
||||
lock (Metingen)
|
||||
{
|
||||
Metingen.Add(command.Meting);
|
||||
}
|
||||
window.Invoke(window.updateMetingen, new Object[] { command.Meting });
|
||||
}
|
||||
break;
|
||||
case NetCommand.CommandType.CHAT:
|
||||
ChatMessage chat = new ChatMessage(command.DisplayName, command.ChatMessage, command.IsDoctor);
|
||||
Chat.Add(chat);
|
||||
window.panelClientChat.Invoke(window.panelClientChat.passChatMessage, new Object[] { chat });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
Application.Run(window);
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
window.Close();
|
||||
MainClient.RemoveActiveClient(this);
|
||||
}
|
||||
|
||||
private void sendCommand(NetCommand command)
|
||||
{
|
||||
if(! IsOldData)
|
||||
MainClient.SendNetCommand(command);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
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 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;
|
||||
public System.Windows.Forms.Button button1;
|
||||
public System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.Label connectionLabel;
|
||||
|
||||
private int Session { get; }
|
||||
|
||||
public PanelClientChat(int session, string name) : 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();
|
||||
|
||||
Session = session;
|
||||
|
||||
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: " + name;
|
||||
//
|
||||
// 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("Doctor", richTextBox1.Text, true));
|
||||
MainClient.SendNetCommand(new NetCommand(richTextBox1.Text, true, 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,115 @@
|
||||
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;
|
||||
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,287 @@
|
||||
using ErgometerLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication.Client
|
||||
{
|
||||
public class PanelClientSetData : Panel
|
||||
{
|
||||
|
||||
private Panel panel6;
|
||||
private Label label3;
|
||||
private Panel panel5;
|
||||
private Label label4;
|
||||
private Panel panel3;
|
||||
private Label label2;
|
||||
private Panel panel2;
|
||||
private Label label1;
|
||||
private Button buttonTrapsnelheid;
|
||||
private TrackBar trackBar1;
|
||||
private Label label6;
|
||||
private Button buttonAfstand;
|
||||
private TextBox textBox2;
|
||||
private Label label5;
|
||||
private Button buttonTijd;
|
||||
private MaskedTextBox textBox1;
|
||||
|
||||
private int Session;
|
||||
|
||||
public PanelClientSetData(int session) : base()
|
||||
{
|
||||
Session = session;
|
||||
this.panel6 = new System.Windows.Forms.Panel();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.panel5 = new System.Windows.Forms.Panel();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.MaskedTextBox();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.trackBar1 = new System.Windows.Forms.TrackBar();
|
||||
this.buttonTijd = new System.Windows.Forms.Button();
|
||||
this.buttonAfstand = new System.Windows.Forms.Button();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.buttonTrapsnelheid = new System.Windows.Forms.Button();
|
||||
this.panel6.SuspendLayout();
|
||||
this.panel5.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
|
||||
//
|
||||
// panel6
|
||||
//
|
||||
this.panel6.BackColor = System.Drawing.Color.White;
|
||||
this.panel6.Controls.Add(this.buttonTrapsnelheid);
|
||||
this.panel6.Controls.Add(this.trackBar1);
|
||||
this.panel6.Controls.Add(this.label3);
|
||||
this.panel6.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel6.Location = new System.Drawing.Point(0, 199);
|
||||
this.panel6.Name = "panel6";
|
||||
this.panel6.Size = new System.Drawing.Size(370, 112);
|
||||
this.panel6.TabIndex = 4;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Font = new System.Drawing.Font("Segoe UI Semibold", 10F, System.Drawing.FontStyle.Bold);
|
||||
this.label3.Location = new System.Drawing.Point(4, 5);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(146, 19);
|
||||
this.label3.TabIndex = 0;
|
||||
this.label3.Text = "Trapsterkte aanpassen";
|
||||
//
|
||||
// panel5
|
||||
//
|
||||
this.panel5.BackColor = System.Drawing.Color.White;
|
||||
this.panel5.Controls.Add(this.label6);
|
||||
this.panel5.Controls.Add(this.buttonAfstand);
|
||||
this.panel5.Controls.Add(this.textBox2);
|
||||
this.panel5.Controls.Add(this.label4);
|
||||
this.panel5.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel5.Location = new System.Drawing.Point(0, 124);
|
||||
this.panel5.Name = "panel5";
|
||||
this.panel5.Size = new System.Drawing.Size(370, 75);
|
||||
this.panel5.TabIndex = 3;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Font = new System.Drawing.Font("Segoe UI Semibold", 10F, System.Drawing.FontStyle.Bold);
|
||||
this.label4.Location = new System.Drawing.Point(4, 26);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(114, 19);
|
||||
this.label4.TabIndex = 0;
|
||||
this.label4.Text = "Afstand instellen";
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.BackColor = System.Drawing.Color.White;
|
||||
this.panel3.Controls.Add(this.label5);
|
||||
this.panel3.Controls.Add(this.buttonTijd);
|
||||
this.panel3.Controls.Add(this.textBox1);
|
||||
this.panel3.Controls.Add(this.label2);
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel3.Font = new System.Drawing.Font("Tunga", 8.25F);
|
||||
this.panel3.Location = new System.Drawing.Point(0, 52);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(370, 72);
|
||||
this.panel3.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Segoe UI Semibold", 10F, System.Drawing.FontStyle.Bold);
|
||||
this.label2.Location = new System.Drawing.Point(3, 23);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(101, 19);
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Tijd aanpassen";
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.panel2.Controls.Add(this.label1);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(500, 52);
|
||||
this.panel2.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.ForeColor = System.Drawing.Color.White;
|
||||
this.label1.Location = new System.Drawing.Point(3, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(247, 21);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Eigenschappen fiets aanpassen";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox1.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.textBox1.Location = new System.Drawing.Point(123, 21);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(77, 25);
|
||||
this.textBox1.TabIndex = 1;
|
||||
this.textBox1.Mask = "00:00";
|
||||
this.textBox1.KeyDown += TextBox1_KeyDown;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox2.Font = new System.Drawing.Font("Segoe UI", 9.75F);
|
||||
this.textBox2.Location = new System.Drawing.Point(124, 24);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(77, 25);
|
||||
this.textBox2.TabIndex = 1;
|
||||
this.textBox2.KeyDown += TextBox2_KeyDown;
|
||||
//
|
||||
// trackBar1
|
||||
//
|
||||
this.trackBar1.Location = new System.Drawing.Point(29, 42);
|
||||
this.trackBar1.Maximum = 400;
|
||||
this.trackBar1.Minimum = 25;
|
||||
this.trackBar1.Name = "trackBar1";
|
||||
this.trackBar1.Size = new System.Drawing.Size(221, 45);
|
||||
this.trackBar1.TabIndex = 1;
|
||||
this.trackBar1.Value = 25;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.buttonTijd.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.buttonTijd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonTijd.Font = new System.Drawing.Font("Segoe UI", 9.75F);
|
||||
this.buttonTijd.Location = new System.Drawing.Point(282, 19);
|
||||
this.buttonTijd.Name = "button1";
|
||||
this.buttonTijd.Size = new System.Drawing.Size(75, 25);
|
||||
this.buttonTijd.TabIndex = 2;
|
||||
this.buttonTijd.Text = "Set";
|
||||
this.buttonTijd.UseVisualStyleBackColor = false;
|
||||
this.buttonTijd.Click += new System.EventHandler(this.buttonTijd_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.buttonAfstand.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.buttonAfstand.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonAfstand.Font = new System.Drawing.Font("Segoe UI", 9.75F);
|
||||
this.buttonAfstand.Location = new System.Drawing.Point(283, 24);
|
||||
this.buttonAfstand.Name = "button2";
|
||||
this.buttonAfstand.Size = new System.Drawing.Size(75, 25);
|
||||
this.buttonAfstand.TabIndex = 2;
|
||||
this.buttonAfstand.Text = "Set";
|
||||
this.buttonAfstand.UseVisualStyleBackColor = false;
|
||||
this.buttonAfstand.Click += new System.EventHandler(this.buttonAfstand_Click);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label5.Location = new System.Drawing.Point(207, 26);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(23, 13);
|
||||
this.label5.TabIndex = 3;
|
||||
this.label5.Text = "sec";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(208, 30);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(15, 13);
|
||||
this.label6.TabIndex = 3;
|
||||
this.label6.Text = "m";
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.buttonTrapsnelheid.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.buttonTrapsnelheid.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonTrapsnelheid.Location = new System.Drawing.Point(283, 42);
|
||||
this.buttonTrapsnelheid.Name = "button3";
|
||||
this.buttonTrapsnelheid.Size = new System.Drawing.Size(75, 25);
|
||||
this.buttonTrapsnelheid.TabIndex = 2;
|
||||
this.buttonTrapsnelheid.Text = "Set";
|
||||
this.buttonTrapsnelheid.UseVisualStyleBackColor = false;
|
||||
this.buttonTrapsnelheid.Click += new System.EventHandler(this.buttonTrapsnelheid_Click);
|
||||
|
||||
Controls.Add(this.panel6);
|
||||
Controls.Add(this.panel5);
|
||||
Controls.Add(this.panel3);
|
||||
Controls.Add(this.panel2);
|
||||
Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
Location = new System.Drawing.Point(0, 0);
|
||||
BackColor = System.Drawing.Color.White;
|
||||
Name = "panel1";
|
||||
Size = new System.Drawing.Size(370, 400);
|
||||
|
||||
}
|
||||
|
||||
private void TextBox2_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.KeyCode == Keys.Enter)
|
||||
{
|
||||
buttonAfstand_Click(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBox1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
buttonTijd_Click(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonTrapsnelheid_Click(object sender, EventArgs e)
|
||||
{
|
||||
MainClient.SendNetCommand(new NetCommand(NetCommand.ValueType.POWER, trackBar1.Value, Session));
|
||||
}
|
||||
|
||||
private void buttonAfstand_Click(object sender, EventArgs e)
|
||||
{
|
||||
MainClient.SendNetCommand(new NetCommand(NetCommand.ValueType.DISTANCE, int.Parse(textBox2.Text), Session));
|
||||
textBox2.Text = "";
|
||||
}
|
||||
|
||||
private void buttonTijd_Click(object sender, EventArgs e)
|
||||
{
|
||||
int seconds = (int.Parse(textBox1.Text.Split(':')[0]) * 60) + int.Parse(textBox1.Text.Split(':')[1]);
|
||||
MainClient.SendNetCommand(new NetCommand(NetCommand.ValueType.TIME, seconds, Session));
|
||||
textBox1.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 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(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,175 @@
|
||||
using ErgometerDoctorApplication.Client;
|
||||
using System;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
partial class SessionWindow
|
||||
{
|
||||
/// <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.SuspendLayout();
|
||||
|
||||
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.panelClientContainer = new System.Windows.Forms.Panel();
|
||||
this.panelDataViewLeft = new System.Windows.Forms.Panel();
|
||||
this.panelClientSetData = new PanelClientSetData(Session);
|
||||
this.panelGraphView = new ErgometerDoctorApplication.PanelGraphView();
|
||||
this.panelClientChat = new ErgometerDoctorApplication.PanelClientChat(Session, ClientName);
|
||||
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", 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();
|
||||
//
|
||||
// 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(panelClientSetData);
|
||||
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.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(800, 600);
|
||||
this.Controls.Add(this.panelTopBar);
|
||||
this.Controls.Add(this.panelClientContainer);
|
||||
this.Name = "SessionWindow";
|
||||
this.Text = "Sessie: " + ClientName;
|
||||
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;
|
||||
public 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, time;
|
||||
public PanelClientSetData panelClientSetData;
|
||||
|
||||
private void createTitle()
|
||||
{
|
||||
if (ActiveSession)
|
||||
{
|
||||
this.Text = "Actieve Sessie: " + ClientName;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Text = "Afgelopen Sessie: " + ClientName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
using ErgometerLibrary;
|
||||
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 ErgometerDoctorApplication
|
||||
{
|
||||
public partial class SessionWindow : Form
|
||||
{
|
||||
|
||||
private bool ActiveSession { get; }
|
||||
private string ClientName { get; set; }
|
||||
public int Session { get; }
|
||||
|
||||
private ClientThread client;
|
||||
|
||||
private int count;
|
||||
|
||||
public delegate void UpdateMetingen(Meting m);
|
||||
public UpdateMetingen updateMetingen;
|
||||
|
||||
public delegate void UpdateGraph();
|
||||
public UpdateGraph updateGraph;
|
||||
|
||||
public SessionWindow(string ClientName, bool old, int session, ClientThread parentthread)
|
||||
{
|
||||
this.ActiveSession = !old;
|
||||
this.ClientName = ClientName;
|
||||
this.client = parentthread;
|
||||
Session = session;
|
||||
|
||||
count = 0;
|
||||
|
||||
updateMetingen = new UpdateMetingen(this.SaveMeting);
|
||||
updateGraph = new UpdateGraph(this.LoadGraph);
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
if(! ActiveSession)
|
||||
{
|
||||
panelClientChat.richTextBox1.Enabled = false;
|
||||
panelClientChat.button1.Enabled = false;
|
||||
panelDataViewLeft.Visible = 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;
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveMeting(Meting m)
|
||||
{
|
||||
|
||||
heartBeat.updateValue(m.HeartBeat);
|
||||
RPM.updateValue(m.RPM);
|
||||
speed.updateValue(m.Speed*100);
|
||||
distance.updateValue(m.Distance*100);
|
||||
power.updateValue(m.Power);
|
||||
energy.updateValue(m.Energy);
|
||||
actualpower.updateValue(m.ActualPower);
|
||||
time.updateValue(m.Seconds);
|
||||
|
||||
if (count >= 10)
|
||||
{
|
||||
count = 0;
|
||||
panelGraphView.updateAllCharts(client.Metingen);
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
public void LoadGraph()
|
||||
{
|
||||
panelGraphView.updateAllCharts(client.Metingen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?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>
|
||||
</root>
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class ConActiveSessions : Panel
|
||||
{
|
||||
|
||||
private FlowLayoutPanel flowlayout;
|
||||
|
||||
public ConActiveSessions() : base()
|
||||
{
|
||||
labelActiveSessions = new Label();
|
||||
//
|
||||
// ConActiveSessions
|
||||
//
|
||||
this.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
this.Name = "ConActiveSessions";
|
||||
this.Size = new System.Drawing.Size(584, 459);
|
||||
this.TabIndex = 0;
|
||||
//
|
||||
// labelActiveSessions
|
||||
//
|
||||
this.labelActiveSessions.Anchor = System.Windows.Forms.AnchorStyles.Top | AnchorStyles.Left;
|
||||
this.labelActiveSessions.AutoSize = true;
|
||||
this.labelActiveSessions.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelActiveSessions.Location = new System.Drawing.Point(20, 20);
|
||||
this.labelActiveSessions.Name = "labelActiveSessions";
|
||||
this.labelActiveSessions.Size = new System.Drawing.Size(103, 21);
|
||||
this.labelActiveSessions.TabIndex = 3;
|
||||
this.labelActiveSessions.Text = "Er zijn geen actieve sessies.";
|
||||
|
||||
flowlayout = new FlowLayoutPanel();
|
||||
|
||||
flowlayout.Dock = DockStyle.Fill;
|
||||
flowlayout.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
flowlayout.Location = new System.Drawing.Point(0, 0);
|
||||
flowlayout.Name = "flowlayout";
|
||||
flowlayout.Padding = new Padding(15);
|
||||
flowlayout.AutoScroll = true;
|
||||
|
||||
this.Controls.Add(labelActiveSessions);
|
||||
this.Controls.Add(flowlayout);
|
||||
|
||||
//this.Controls.Add(data);
|
||||
|
||||
updateActiveSessions(MainClient.activesessions);
|
||||
|
||||
}
|
||||
|
||||
public System.Windows.Forms.Label labelActiveSessions;
|
||||
|
||||
public void updateActiveSessions(Dictionary<int, string> actives)
|
||||
{
|
||||
flowlayout.Controls.Clear();
|
||||
|
||||
foreach (KeyValuePair<int, string> pair in actives)
|
||||
{
|
||||
|
||||
flowlayout.Controls.Add(new SessionPanel(pair.Key, pair.Value, true,0));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private void data_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (data.Rows[e.RowIndex].Cells[1].Value != null)
|
||||
{
|
||||
MainClient.StartNewCLient(data.Rows[e.RowIndex].Cells[0].Value + "", int.Parse(data.Rows[e.RowIndex].Cells[1].Value + ""));
|
||||
}
|
||||
}
|
||||
|
||||
public System.Windows.Forms.DataGridViewTextBoxColumn name;
|
||||
public System.Windows.Forms.DataGridViewTextBoxColumn sessionId;
|
||||
public System.Windows.Forms.DataGridView data;
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class ConClientBroadcast : Panel
|
||||
{
|
||||
|
||||
public ConClientBroadcast() : base()
|
||||
{
|
||||
|
||||
this.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
this.Name = "ConClientBroadcast";
|
||||
this.Size = new System.Drawing.Size(584, 459);
|
||||
this.TabIndex = 0;
|
||||
|
||||
buttonBroadcast = new Button();
|
||||
textBoxBroadcast = new TextBox();
|
||||
|
||||
//
|
||||
// buttonLogin
|
||||
//
|
||||
this.buttonBroadcast.Anchor = AnchorStyles.Left | AnchorStyles.Top;
|
||||
this.buttonBroadcast.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonBroadcast.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.buttonBroadcast.Location = new System.Drawing.Point(200, 20);
|
||||
this.buttonBroadcast.Name = "buttonCreate";
|
||||
this.buttonBroadcast.Size = new System.Drawing.Size(168, 31);
|
||||
this.buttonBroadcast.TabIndex = 3;
|
||||
this.buttonBroadcast.Text = "Broadcast";
|
||||
this.buttonBroadcast.UseVisualStyleBackColor = true;
|
||||
this.buttonBroadcast.Click += new System.EventHandler(this.buttonBroadcast_Click);
|
||||
//
|
||||
// textBoxPassword
|
||||
//
|
||||
this.textBoxBroadcast.Anchor = AnchorStyles.Left | AnchorStyles.Top;
|
||||
this.textBoxBroadcast.Location = new System.Drawing.Point(20, 20);
|
||||
this.textBoxBroadcast.MaxLength = 16;
|
||||
this.textBoxBroadcast.Name = "textBoxPassword";
|
||||
this.textBoxBroadcast.Size = new System.Drawing.Size(167, 20);
|
||||
this.textBoxBroadcast.TabIndex = 2;
|
||||
this.textBoxBroadcast.KeyDown += TextBoxBroadcast_KeyDown;
|
||||
|
||||
this.Controls.Add(textBoxBroadcast);
|
||||
this.Controls.Add(buttonBroadcast);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void TextBoxBroadcast_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
buttonBroadcast_Click(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonBroadcast_Click(object sender, EventArgs e)
|
||||
{
|
||||
MainClient.SendNetCommand(new ErgometerLibrary.NetCommand(textBoxBroadcast.Text, MainClient.Session));
|
||||
textBoxBroadcast.Text = "";
|
||||
}
|
||||
|
||||
public System.Windows.Forms.TextBox textBoxBroadcast;
|
||||
public System.Windows.Forms.Button buttonBroadcast;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
using ErgometerLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class ConClientData : Panel
|
||||
{
|
||||
public System.Windows.Forms.TextBox textBoxPassword;
|
||||
public System.Windows.Forms.TextBox textBoxUsername;
|
||||
public System.Windows.Forms.Button buttonCreate;
|
||||
public System.Windows.Forms.ListBox listUsers;
|
||||
public System.Windows.Forms.Label newUsername;
|
||||
public System.Windows.Forms.Label newPassword;
|
||||
|
||||
public ConClientData() : base()
|
||||
{
|
||||
this.buttonCreate = new System.Windows.Forms.Button();
|
||||
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
||||
this.textBoxUsername = new System.Windows.Forms.TextBox();
|
||||
this.listUsers = new System.Windows.Forms.ListBox();
|
||||
this.newUsername = new System.Windows.Forms.Label();
|
||||
this.newPassword = new System.Windows.Forms.Label();
|
||||
|
||||
//
|
||||
// buttonLogin
|
||||
//
|
||||
this.buttonCreate.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.buttonCreate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonCreate.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.buttonCreate.Location = new System.Drawing.Point(20, 215);
|
||||
this.buttonCreate.Name = "buttonCreate";
|
||||
this.buttonCreate.Size = new System.Drawing.Size(168, 31);
|
||||
this.buttonCreate.TabIndex = 3;
|
||||
this.buttonCreate.Text = "Aanmaken";
|
||||
this.buttonCreate.BackColor = Color.LightGray;
|
||||
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
|
||||
//
|
||||
// textBoxPassword
|
||||
//
|
||||
this.textBoxPassword.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.textBoxPassword.Location = new System.Drawing.Point(170, 180);
|
||||
this.textBoxPassword.MaxLength = 16;
|
||||
this.textBoxPassword.Name = "textBoxPassword";
|
||||
this.textBoxPassword.Size = new System.Drawing.Size(167, 60);
|
||||
this.textBoxPassword.TabIndex = 2;
|
||||
this.textBoxPassword.KeyDown += TextBoxEnterPress;
|
||||
//
|
||||
// textBoxUsername
|
||||
//
|
||||
this.textBoxUsername.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.textBoxUsername.Location = new System.Drawing.Point(170, 150);
|
||||
this.textBoxUsername.MaxLength = 16;
|
||||
this.textBoxUsername.Name = "textBoxUsername";
|
||||
this.textBoxUsername.Size = new System.Drawing.Size(167, 20);
|
||||
this.textBoxUsername.TabIndex = 2;
|
||||
this.textBoxUsername.KeyDown += TextBoxEnterPress;
|
||||
//
|
||||
// listUsers
|
||||
//
|
||||
this.listUsers.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.listUsers.Location = new System.Drawing.Point(20, -150);
|
||||
this.listUsers.Name = "listUsers";
|
||||
this.listUsers.Size = new System.Drawing.Size(200, 280);
|
||||
this.listUsers.Items.Add("Geen gebruikers");
|
||||
//
|
||||
// newPassword
|
||||
//
|
||||
this.newPassword.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.newPassword.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.newPassword.ForeColor = Color.Black;
|
||||
this.newPassword.Location = new System.Drawing.Point(20, 182);
|
||||
this.newPassword.Name = "newPassword";
|
||||
this.newPassword.Size = new System.Drawing.Size(167, 20);
|
||||
this.newPassword.TabIndex = 3;
|
||||
this.newPassword.Text = "Nieuw wachtwoord";
|
||||
//
|
||||
// newUsername
|
||||
//
|
||||
this.newUsername.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.newUsername.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.newUsername.Location = new System.Drawing.Point(20, 152);
|
||||
this.newUsername.Name = "newUsername";
|
||||
this.newUsername.Size = new System.Drawing.Size(167, 20);
|
||||
this.newUsername.TabIndex = 3;
|
||||
this.newUsername.Text = "Nieuwe gebruikersnaam";
|
||||
|
||||
this.Controls.Add(this.listUsers);
|
||||
this.Controls.Add(this.buttonCreate);
|
||||
this.Controls.Add(this.textBoxUsername);
|
||||
this.Controls.Add(this.textBoxPassword);
|
||||
this.Controls.Add(this.newUsername);
|
||||
this.Controls.Add(this.newPassword);
|
||||
//
|
||||
// ConClientData
|
||||
//
|
||||
this.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.Location = new System.Drawing.Point(20, 0);
|
||||
this.Name = "ConClientData";
|
||||
this.Size = new System.Drawing.Size(584, 459);
|
||||
this.TabIndex = 0;
|
||||
|
||||
|
||||
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
}
|
||||
|
||||
private void TextBoxEnterPress(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
buttonCreate_Click(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
internal void updateUsers(Dictionary<string, string> users)
|
||||
{
|
||||
this.listUsers.Items.Clear();
|
||||
|
||||
foreach(KeyValuePair<string, string> user in users)
|
||||
{
|
||||
this.listUsers.Items.Add(user.Key + ": " + user.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MainClient.users.ContainsKey(textBoxUsername.Text))
|
||||
{
|
||||
MainClient.SendNetCommand(new NetCommand(textBoxUsername.Text, textBoxPassword.Text, MainClient.Session));
|
||||
MainClient.SendNetCommand(new NetCommand(NetCommand.RequestType.USERS, MainClient.Session));
|
||||
|
||||
textBoxUsername.Text = "";
|
||||
|
||||
Thread.Sleep(250);
|
||||
updateUsers(MainClient.users);
|
||||
}
|
||||
|
||||
|
||||
textBoxPassword.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class ConPanelLogin:Panel
|
||||
{
|
||||
|
||||
MainWindow mainWindow;
|
||||
|
||||
public ConPanelLogin(Form mainWindow) : base()
|
||||
{
|
||||
this.mainWindow = (MainWindow)mainWindow;
|
||||
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.buttonLogin = new System.Windows.Forms.Button();
|
||||
this.labelPassword = new System.Windows.Forms.Label();
|
||||
this.labelLoginInfo = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
//
|
||||
// Container
|
||||
//
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.labelLoginInfo);
|
||||
this.Controls.Add(this.labelPassword);
|
||||
this.Controls.Add(this.buttonLogin);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.textBoxPassword);
|
||||
this.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
//
|
||||
// textBoxPassword
|
||||
//
|
||||
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
|
||||
//
|
||||
this.pictureBox1.Image = ((System.Drawing.Image)Properties.Resources.imageDoctor);
|
||||
this.pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(0, -150);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(175, 175);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
|
||||
//
|
||||
// buttonLogin
|
||||
//
|
||||
this.buttonLogin.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.buttonLogin.BackColor = System.Drawing.SystemColors.Highlight;
|
||||
this.buttonLogin.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonLogin.Font = new System.Drawing.Font("Segoe UI Semibold", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.buttonLogin.ForeColor = System.Drawing.Color.White;
|
||||
this.buttonLogin.Location = new System.Drawing.Point(15, 105);
|
||||
this.buttonLogin.Name = "buttonLogin";
|
||||
this.buttonLogin.Size = new System.Drawing.Size(150, 30);
|
||||
this.buttonLogin.TabIndex = 2;
|
||||
this.buttonLogin.Text = "Log In";
|
||||
this.buttonLogin.UseVisualStyleBackColor = false;
|
||||
this.buttonLogin.Click += new System.EventHandler(this.buttonLogin_Click);
|
||||
//
|
||||
// labelPassword
|
||||
//
|
||||
this.labelPassword.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.labelPassword.AutoSize = true;
|
||||
this.labelPassword.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelPassword.Location = new System.Drawing.Point(11, 40);
|
||||
this.labelPassword.Name = "labelPassword";
|
||||
this.labelPassword.Size = new System.Drawing.Size(103, 21);
|
||||
this.labelPassword.TabIndex = 3;
|
||||
this.labelPassword.Text = "Wachtwoord";
|
||||
//
|
||||
// labelLoginInfo
|
||||
//
|
||||
this.labelLoginInfo.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.labelLoginInfo.AutoSize = true;
|
||||
this.labelLoginInfo.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelLoginInfo.ForeColor = System.Drawing.Color.Red;
|
||||
this.labelLoginInfo.Location = new System.Drawing.Point(11, 140);
|
||||
this.labelLoginInfo.Name = "labelLoginInfo";
|
||||
this.labelLoginInfo.Size = new System.Drawing.Size(103, 21);
|
||||
this.labelLoginInfo.TabIndex = 4;
|
||||
this.labelLoginInfo.Text = "";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
public System.Windows.Forms.TextBox textBoxPassword;
|
||||
private PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Button buttonLogin;
|
||||
private System.Windows.Forms.Label labelPassword;
|
||||
public System.Windows.Forms.Label labelLoginInfo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class ConSessionHistory : Panel
|
||||
{
|
||||
private FlowLayoutPanel flowlayout;
|
||||
|
||||
public ConSessionHistory() : base()
|
||||
{
|
||||
labelSessionHistory = new Label();
|
||||
|
||||
this.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
this.Name = "ConSessionHistory";
|
||||
this.Size = new System.Drawing.Size(584, 459);
|
||||
this.TabIndex = 0;
|
||||
//
|
||||
// labelSessionHistory
|
||||
//
|
||||
this.labelSessionHistory.Anchor = System.Windows.Forms.AnchorStyles.Top | AnchorStyles.Left;
|
||||
this.labelSessionHistory.AutoSize = true;
|
||||
this.labelSessionHistory.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelSessionHistory.Location = new System.Drawing.Point(20, 20);
|
||||
this.labelSessionHistory.Name = "labelSessionHistory";
|
||||
this.labelSessionHistory.Size = new System.Drawing.Size(103, 21);
|
||||
this.labelSessionHistory.TabIndex = 3;
|
||||
this.labelSessionHistory.Text = "Er zijn geen oude sessies.";
|
||||
|
||||
flowlayout = new FlowLayoutPanel();
|
||||
|
||||
flowlayout.Dock = DockStyle.Fill;
|
||||
flowlayout.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
flowlayout.Location = new System.Drawing.Point(0, 0);
|
||||
flowlayout.Name = "flowlayout";
|
||||
flowlayout.Padding = new Padding(15);
|
||||
flowlayout.AutoScroll = true;
|
||||
|
||||
this.Controls.Add(labelSessionHistory);
|
||||
this.Controls.Add(flowlayout);
|
||||
|
||||
//this.Controls.Add(data);
|
||||
|
||||
updateHistory(MainClient.oldSessionsData);
|
||||
|
||||
}
|
||||
|
||||
public System.Windows.Forms.Label labelSessionHistory;
|
||||
|
||||
public void updateHistory(List<Tuple<string, double, int>> historys)
|
||||
{
|
||||
flowlayout.Controls.Clear();
|
||||
|
||||
foreach (Tuple<string,double,int> sessiondata in historys)
|
||||
{
|
||||
flowlayout.Controls.Add(new SessionPanel(sessiondata.Item3, sessiondata.Item1, false,sessiondata.Item2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,14 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ErgometerLibrary, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\ErgometerLibrary\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll</HintPath>
|
||||
</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" />
|
||||
@@ -46,14 +52,58 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<Compile Include="Client\ChartPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Client\ClientThread.cs" />
|
||||
<Compile Include="Client\PanelClientChat.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Client\PanelClientData.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Client\PanelClientSetData.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Client\PanelGraphView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Client\SessionWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
<Compile Include="Client\SessionWindow.Designer.cs">
|
||||
<DependentUpon>SessionWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ConClientData.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ConPanelLogin.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ConClientBroadcast.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ConSessionHistory.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ConActiveSessions.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainClient.cs" />
|
||||
<Compile Include="MainWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.Designer.cs">
|
||||
<DependentUpon>MainWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SessionPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="MainWindow.resx">
|
||||
<DependentUpon>MainWindow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
@@ -62,7 +112,11 @@
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Client\SessionWindow.resx">
|
||||
<DependentUpon>SessionWindow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
@@ -76,6 +130,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\doctorImage.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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.
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
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 ErgometerDoctorApplication
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
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 ErgometerDoctorApplication
|
||||
{
|
||||
class MainClient
|
||||
{
|
||||
|
||||
public static TcpClient Server { get; set; }
|
||||
|
||||
public static bool loggedin;
|
||||
|
||||
private static Thread t;
|
||||
private static bool running;
|
||||
|
||||
public static int Session;
|
||||
|
||||
public static string HOST = "127.0.0.1";
|
||||
public static int PORT = 8888;
|
||||
|
||||
|
||||
//Server information
|
||||
public static List<ClientThread> clients;
|
||||
public static Dictionary<string, string> users;
|
||||
public static List<Tuple<string, double, int>> oldSessionsData;
|
||||
|
||||
public static void RemoveActiveClient(ClientThread clientThread)
|
||||
{
|
||||
clients.Remove(clientThread);
|
||||
}
|
||||
|
||||
public static Dictionary<int, string> activesessions;
|
||||
|
||||
static MainClient()
|
||||
{
|
||||
Server = new TcpClient();
|
||||
|
||||
loggedin = false;
|
||||
|
||||
clients = new List<ClientThread>();
|
||||
users = new Dictionary<string, string>();
|
||||
activesessions = new Dictionary<int, string>();
|
||||
oldSessionsData = new List<Tuple<string, double, int>>();
|
||||
}
|
||||
|
||||
public static bool Connect(string password, out string error)
|
||||
{
|
||||
error = "Succes";
|
||||
|
||||
if (Server == null || !Server.Connected)
|
||||
{
|
||||
if (Server == null)
|
||||
Server = new TcpClient();
|
||||
|
||||
try
|
||||
{
|
||||
Server.Connect(HOST, PORT);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
error = "Server is niet online.";
|
||||
return false;
|
||||
}
|
||||
|
||||
NetCommand net = NetHelper.ReadNetCommand(Server);
|
||||
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("Doctor0tVfW", true, password, Session);
|
||||
NetHelper.SendNetCommand(Server, command);
|
||||
|
||||
NetCommand response = NetHelper.ReadNetCommand(Server);
|
||||
if (response.Type == NetCommand.CommandType.RESPONSE && response.Response == NetCommand.ResponseType.LOGINWRONG)
|
||||
{
|
||||
loggedin = false;
|
||||
error = "Het wachtwoord is onjuist.";
|
||||
return false;
|
||||
}
|
||||
|
||||
loggedin = true;
|
||||
}
|
||||
|
||||
|
||||
SendNetCommand(new NetCommand(NetCommand.RequestType.SESSIONDATA, Session));
|
||||
Thread.Sleep(15);
|
||||
SendNetCommand(new NetCommand(NetCommand.RequestType.USERS, Session));
|
||||
|
||||
Thread.Sleep(200);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void Disconnect()
|
||||
{
|
||||
|
||||
if (Server != null && Server.Connected)
|
||||
{
|
||||
NetHelper.SendNetCommand(Server, new NetCommand(NetCommand.CommandType.LOGOUT, Session));
|
||||
loggedin = false;
|
||||
running = false;
|
||||
Server.Close();
|
||||
Server = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void run()
|
||||
{
|
||||
while (running)
|
||||
{
|
||||
if (loggedin && Server.Connected)
|
||||
{
|
||||
NetCommand command = NetHelper.ReadNetCommand(Server);
|
||||
HandleNetCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
if(Server != null)
|
||||
Server.Close();
|
||||
}
|
||||
|
||||
private static bool UsersBeingSent = false;
|
||||
private static int UsersSent = 0;
|
||||
private static int UsersLength = 0;
|
||||
|
||||
private static bool SessionsBeingSent = false;
|
||||
private static int SessionsSent = 0;
|
||||
private static int SessionsLength = 0;
|
||||
|
||||
private static bool ActiveSessionsBeingSent = false;
|
||||
private static int ActiveSessionsSent = 0;
|
||||
private static int ActiveSessionsLength = 0;
|
||||
|
||||
private static void HandleNetCommand(NetCommand command)
|
||||
{
|
||||
switch (command.Type)
|
||||
{
|
||||
case NetCommand.CommandType.LENGTH:
|
||||
switch (command.Length)
|
||||
{
|
||||
case NetCommand.LengthType.USERS:
|
||||
users.Clear();
|
||||
UsersBeingSent = true;
|
||||
UsersSent = 0;
|
||||
UsersLength = command.LengthValue;
|
||||
break;
|
||||
case NetCommand.LengthType.SESSIONS:
|
||||
oldSessionsData.Clear();
|
||||
SessionsBeingSent = true;
|
||||
SessionsSent = 0;
|
||||
SessionsLength = command.LengthValue;
|
||||
break;
|
||||
case NetCommand.LengthType.SESSIONDATA:
|
||||
activesessions.Clear();
|
||||
ActiveSessionsBeingSent = true;
|
||||
ActiveSessionsSent = 0;
|
||||
ActiveSessionsLength = command.LengthValue;
|
||||
break;
|
||||
default:
|
||||
throw new FormatException("Error in NetCommand: Length type is not recognised");
|
||||
}
|
||||
break;
|
||||
case NetCommand.CommandType.ERROR:
|
||||
Console.WriteLine("An error occured, ignoring");
|
||||
break;
|
||||
case NetCommand.CommandType.USER:
|
||||
if(UsersBeingSent)
|
||||
{
|
||||
users.Add(command.DisplayName, command.Password);
|
||||
UsersSent++;
|
||||
if (UsersSent >= UsersLength)
|
||||
UsersBeingSent = false;
|
||||
}
|
||||
break;
|
||||
case NetCommand.CommandType.SESSIONDATA:
|
||||
if (ActiveSessionsBeingSent)
|
||||
{
|
||||
activesessions.Add(command.Session, command.DisplayName);
|
||||
ActiveSessionsSent++;
|
||||
if (ActiveSessionsSent >= ActiveSessionsLength)
|
||||
ActiveSessionsBeingSent = false;
|
||||
}
|
||||
if (SessionsBeingSent)
|
||||
{
|
||||
oldSessionsData.Add(new Tuple<string, double, int>(command.DisplayName, command.Timestamp, command.Session));
|
||||
SessionsSent++;
|
||||
if (SessionsSent >= SessionsLength)
|
||||
SessionsBeingSent = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
HandToClient(command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandToClient(NetCommand command)
|
||||
{
|
||||
foreach (ClientThread cl in clients)
|
||||
{
|
||||
if (cl.Session == command.Session)
|
||||
{
|
||||
cl.HandleCommand(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendNetCommand(NetCommand command)
|
||||
{
|
||||
if(! NetHelper.SendNetCommand(Server, command))
|
||||
{
|
||||
Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsSessionRunning(int session)
|
||||
{
|
||||
foreach (ClientThread cl in clients)
|
||||
{
|
||||
if (cl.Session == session)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void StartNewClient(string name, int session)
|
||||
{
|
||||
if (IsSessionRunning(session))
|
||||
return;
|
||||
|
||||
//Start new client
|
||||
ClientThread cl = new ClientThread(name, session, false);
|
||||
clients.Add(cl);
|
||||
|
||||
//Run client on new thread
|
||||
Thread thread = new Thread(new ThreadStart(cl.run));
|
||||
thread.IsBackground = true;
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
public static void StartOldClient(string name, int session)
|
||||
{
|
||||
if (IsSessionRunning(session))
|
||||
return;
|
||||
|
||||
SendNetCommand(new NetCommand(NetCommand.RequestType.OLDDATA, session));
|
||||
SendNetCommand(new NetCommand(NetCommand.RequestType.CHAT, session));
|
||||
|
||||
//Start new client
|
||||
ClientThread cl = new ClientThread(name, session, true);
|
||||
clients.Add(cl);
|
||||
|
||||
//Run client on new thread
|
||||
Thread thread = new Thread(new ThreadStart(cl.run));
|
||||
thread.IsBackground = true;
|
||||
thread.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
+320
@@ -0,0 +1,320 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
partial class MainWindow
|
||||
{
|
||||
/// <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.MenuPanel = new System.Windows.Forms.Panel();
|
||||
this.BtnLogout = new System.Windows.Forms.Button();
|
||||
this.BtnSessionHistory = new System.Windows.Forms.Button();
|
||||
this.BtnBroadcast = new System.Windows.Forms.Button();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.BtnClientData = new System.Windows.Forms.Button();
|
||||
this.BtnActiveSessions = new System.Windows.Forms.Button();
|
||||
this.LblHoofdvenster = new System.Windows.Forms.Label();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.HeaderLabel = new System.Windows.Forms.Label();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.MainContainer = new System.Windows.Forms.Panel();
|
||||
this.conActiveSessions = new ErgometerDoctorApplication.ConActiveSessions();
|
||||
this.conClientData = new ErgometerDoctorApplication.ConClientData();
|
||||
this.conSessionHistory = new ErgometerDoctorApplication.ConSessionHistory();
|
||||
this.conClientBroadcast = new ErgometerDoctorApplication.ConClientBroadcast();
|
||||
this.conPanelLogin = new ErgometerDoctorApplication.ConPanelLogin(this);
|
||||
this.updateTimer = new Timer();
|
||||
MainContainer.Visible = false;
|
||||
panel1.Visible = false;
|
||||
MenuPanel.Visible = false;
|
||||
menuStrip1.Visible = false;
|
||||
//
|
||||
// MenuPanel
|
||||
//
|
||||
this.MenuPanel.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.MenuPanel.Controls.Add(this.BtnLogout);
|
||||
this.MenuPanel.Controls.Add(this.BtnSessionHistory);
|
||||
this.MenuPanel.Controls.Add(this.BtnBroadcast);
|
||||
this.MenuPanel.Controls.Add(this.label2);
|
||||
this.MenuPanel.Controls.Add(this.label1);
|
||||
this.MenuPanel.Controls.Add(this.BtnClientData);
|
||||
this.MenuPanel.Controls.Add(this.BtnActiveSessions);
|
||||
this.MenuPanel.Controls.Add(this.LblHoofdvenster);
|
||||
this.MenuPanel.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.MenuPanel.Location = new System.Drawing.Point(0, 24);
|
||||
this.MenuPanel.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.MenuPanel.Name = "MenuPanel";
|
||||
this.MenuPanel.Size = new System.Drawing.Size(200, 537);
|
||||
this.MenuPanel.TabIndex = 0;
|
||||
|
||||
//
|
||||
// BtnLogout
|
||||
//
|
||||
this.BtnLogout.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.BtnLogout.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.BtnLogout.FlatAppearance.BorderSize = 0;
|
||||
this.BtnLogout.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.BtnLogout.ForeColor = System.Drawing.Color.White;
|
||||
this.BtnLogout.Location = new System.Drawing.Point(0, 205);
|
||||
this.BtnLogout.Name = "BtnLogout";
|
||||
this.BtnLogout.Size = new System.Drawing.Size(200, 35);
|
||||
this.BtnLogout.Text = "Uitloggen";
|
||||
this.BtnLogout.UseVisualStyleBackColor = false;
|
||||
this.BtnLogout.Click += new System.EventHandler(this.buttonLogout_Click);
|
||||
//
|
||||
// BtnSessionHistory
|
||||
//
|
||||
this.BtnSessionHistory.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.BtnSessionHistory.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.BtnSessionHistory.FlatAppearance.BorderSize = 0;
|
||||
this.BtnSessionHistory.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.BtnSessionHistory.ForeColor = System.Drawing.Color.White;
|
||||
this.BtnSessionHistory.Location = new System.Drawing.Point(0, 205);
|
||||
this.BtnSessionHistory.Name = "BtnSessionHistory";
|
||||
this.BtnSessionHistory.Size = new System.Drawing.Size(200, 35);
|
||||
this.BtnSessionHistory.TabIndex = 7;
|
||||
this.BtnSessionHistory.Text = "Sessie Geschiedenis";
|
||||
this.BtnSessionHistory.UseVisualStyleBackColor = false;
|
||||
this.BtnSessionHistory.Click += new System.EventHandler(this.BtnSessionHistory_Click);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.label2.Location = new System.Drawing.Point(0, 180);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(6, 3, 6, 3);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Padding = new System.Windows.Forms.Padding(5, 4, 0, 0);
|
||||
this.label2.Size = new System.Drawing.Size(200, 25);
|
||||
this.label2.TabIndex = 6;
|
||||
this.label2.Text = "SESSIE BEHEER";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// updateTimer
|
||||
//
|
||||
this.updateTimer.Interval = 3000;
|
||||
this.updateTimer.Tick += new EventHandler(this.updateTimer_tick);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.label1.Location = new System.Drawing.Point(0, 95);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(6, 3, 6, 3);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(200, 50);
|
||||
this.label1.TabIndex = 5;
|
||||
//
|
||||
// BtnBroadcast
|
||||
//
|
||||
this.BtnBroadcast.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.BtnBroadcast.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.BtnBroadcast.FlatAppearance.BorderSize = 0;
|
||||
this.BtnBroadcast.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.BtnBroadcast.ForeColor = System.Drawing.Color.White;
|
||||
this.BtnBroadcast.Location = new System.Drawing.Point(0, 95);
|
||||
this.BtnBroadcast.Name = "BtnBroadcast";
|
||||
this.BtnBroadcast.Size = new System.Drawing.Size(200, 35);
|
||||
this.BtnBroadcast.TabIndex = 7;
|
||||
this.BtnBroadcast.Text = "Broadcast";
|
||||
this.BtnBroadcast.UseVisualStyleBackColor = false;
|
||||
this.BtnBroadcast.Click += new System.EventHandler(this.BtnBroadcast_Click);
|
||||
//
|
||||
// BtnClientData
|
||||
//
|
||||
this.BtnClientData.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.BtnClientData.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.BtnClientData.FlatAppearance.BorderSize = 0;
|
||||
this.BtnClientData.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.BtnClientData.ForeColor = System.Drawing.Color.White;
|
||||
this.BtnClientData.Location = new System.Drawing.Point(0, 60);
|
||||
this.BtnClientData.Name = "BtnClientData";
|
||||
this.BtnClientData.Size = new System.Drawing.Size(200, 35);
|
||||
this.BtnClientData.TabIndex = 4;
|
||||
this.BtnClientData.Text = "Clientenbestand";
|
||||
this.BtnClientData.UseVisualStyleBackColor = false;
|
||||
this.BtnClientData.Click += new System.EventHandler(this.BtnClientData_Click);
|
||||
//
|
||||
// BtnActiveSessions
|
||||
//
|
||||
this.BtnActiveSessions.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.BtnActiveSessions.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.BtnActiveSessions.FlatAppearance.BorderSize = 0;
|
||||
this.BtnActiveSessions.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.BtnActiveSessions.ForeColor = System.Drawing.Color.White;
|
||||
this.BtnActiveSessions.Location = new System.Drawing.Point(0, 25);
|
||||
this.BtnActiveSessions.Name = "BtnActiveSessions";
|
||||
this.BtnActiveSessions.Size = new System.Drawing.Size(200, 35);
|
||||
this.BtnActiveSessions.TabIndex = 3;
|
||||
this.BtnActiveSessions.Text = "Actieve Sessies";
|
||||
this.BtnActiveSessions.UseVisualStyleBackColor = false;
|
||||
this.BtnActiveSessions.Click += new System.EventHandler(this.BtnActiveSessions_Click);
|
||||
//
|
||||
// LblHoofdvenster
|
||||
//
|
||||
this.LblHoofdvenster.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.LblHoofdvenster.Location = new System.Drawing.Point(0, 0);
|
||||
this.LblHoofdvenster.Margin = new System.Windows.Forms.Padding(6, 3, 6, 3);
|
||||
this.LblHoofdvenster.Name = "LblHoofdvenster";
|
||||
this.LblHoofdvenster.Padding = new System.Windows.Forms.Padding(5, 4, 0, 0);
|
||||
this.LblHoofdvenster.Size = new System.Drawing.Size(200, 25);
|
||||
this.LblHoofdvenster.TabIndex = 0;
|
||||
this.LblHoofdvenster.Text = "HOOFDVENSTER";
|
||||
this.LblHoofdvenster.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.BackColor = System.Drawing.Color.DimGray;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.editToolStripMenuItem,
|
||||
this.viewToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(784, 24);
|
||||
this.menuStrip1.TabIndex = 1;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.ForeColor = System.Drawing.Color.White;
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "File";
|
||||
//
|
||||
// editToolStripMenuItem
|
||||
//
|
||||
this.editToolStripMenuItem.ForeColor = System.Drawing.Color.White;
|
||||
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
||||
this.editToolStripMenuItem.Text = "Edit";
|
||||
//
|
||||
// viewToolStripMenuItem
|
||||
//
|
||||
this.viewToolStripMenuItem.ForeColor = System.Drawing.Color.White;
|
||||
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
|
||||
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||
this.viewToolStripMenuItem.Text = "View";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.White;
|
||||
this.panel1.Controls.Add(this.HeaderLabel);
|
||||
this.panel1.Controls.Add(this.panel3);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(200, 24);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(584, 78);
|
||||
this.panel1.TabIndex = 2;
|
||||
//
|
||||
// HeaderLabel
|
||||
//
|
||||
this.HeaderLabel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.HeaderLabel.Font = new System.Drawing.Font("Segoe UI Semibold", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.HeaderLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.HeaderLabel.Location = new System.Drawing.Point(0, 0);
|
||||
this.HeaderLabel.Name = "HeaderLabel";
|
||||
this.HeaderLabel.Padding = new System.Windows.Forms.Padding(8, 12, 0, 0);
|
||||
this.HeaderLabel.Size = new System.Drawing.Size(584, 50);
|
||||
this.HeaderLabel.TabIndex = 1;
|
||||
this.HeaderLabel.Text = "Actieve Sessies";
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.BackColor = System.Drawing.Color.Silver;
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel3.ForeColor = System.Drawing.Color.Black;
|
||||
this.panel3.Location = new System.Drawing.Point(0, 74);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(584, 4);
|
||||
this.panel3.TabIndex = 0;
|
||||
//
|
||||
// MainContainer
|
||||
//
|
||||
this.MainContainer.Controls.Add(this.conActiveSessions);
|
||||
this.MainContainer.Controls.Add(this.conClientData);
|
||||
this.MainContainer.Controls.Add(this.conSessionHistory);
|
||||
this.MainContainer.Controls.Add(this.conClientBroadcast);
|
||||
this.MainContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.MainContainer.Location = new System.Drawing.Point(200, 102);
|
||||
this.MainContainer.Name = "MainContainer";
|
||||
this.MainContainer.Size = new System.Drawing.Size(584, 459);
|
||||
this.MainContainer.TabIndex = 3;
|
||||
//
|
||||
// MainWindow
|
||||
//
|
||||
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(650, 550);
|
||||
this.Controls.Add(this.MainContainer);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.MenuPanel);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Controls.Add(this.conPanelLogin);
|
||||
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "MainWindow";
|
||||
this.Text = "Dokter applicatie";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel MenuPanel;
|
||||
private Label LblHoofdvenster;
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem fileToolStripMenuItem;
|
||||
private ToolStripMenuItem editToolStripMenuItem;
|
||||
private ToolStripMenuItem viewToolStripMenuItem;
|
||||
private Button BtnActiveSessions;
|
||||
private Button BtnBroadcast;
|
||||
private Button BtnLogout;
|
||||
private Button BtnSessionHistory;
|
||||
private Button BtnClientData;
|
||||
private Label label2;
|
||||
private Label label1;
|
||||
private Panel panel1;
|
||||
private Panel panel3;
|
||||
public Label HeaderLabel;
|
||||
public Timer updateTimer;
|
||||
public Panel MainContainer;
|
||||
public ConActiveSessions conActiveSessions;
|
||||
public ConSessionHistory conSessionHistory;
|
||||
public ConClientData conClientData;
|
||||
public ConPanelLogin conPanelLogin;
|
||||
public ConClientBroadcast conClientBroadcast;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
using ErgometerLibrary;
|
||||
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 ErgometerDoctorApplication
|
||||
{
|
||||
public partial class MainWindow : Form
|
||||
{
|
||||
private int request;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
conPanelLogin.BringToFront();
|
||||
request = 2;
|
||||
updateTimer.Start();
|
||||
|
||||
}
|
||||
|
||||
private void BtnActiveSessions_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.HeaderLabel.Text = "Actieve Sessies";
|
||||
|
||||
if(MainClient.activesessions.Count > 0)
|
||||
{
|
||||
conActiveSessions.labelActiveSessions.Text = "";
|
||||
conActiveSessions.updateActiveSessions(MainClient.activesessions);
|
||||
}
|
||||
else
|
||||
{
|
||||
conActiveSessions.updateActiveSessions(MainClient.activesessions);
|
||||
conActiveSessions.labelActiveSessions.Text = "Er zijn geen actieve sessies.";
|
||||
}
|
||||
|
||||
conActiveSessions.BringToFront();
|
||||
}
|
||||
|
||||
private void BtnClientData_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.HeaderLabel.Text = "Clientenbestand";
|
||||
|
||||
|
||||
if (MainClient.users.Count > 0)
|
||||
{
|
||||
conClientData.updateUsers(MainClient.users);
|
||||
}
|
||||
|
||||
conClientData.BringToFront();
|
||||
}
|
||||
|
||||
private void BtnBroadcast_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.HeaderLabel.Text = "Broadcast";
|
||||
conClientBroadcast.BringToFront();
|
||||
}
|
||||
|
||||
private void BtnSessionHistory_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.HeaderLabel.Text = "Sessie geschiedenis";
|
||||
|
||||
if (MainClient.oldSessionsData.Count > 0)
|
||||
{
|
||||
conSessionHistory.labelSessionHistory.Text = "";
|
||||
conSessionHistory.updateHistory(MainClient.oldSessionsData);
|
||||
}
|
||||
else
|
||||
{
|
||||
conSessionHistory.updateHistory(MainClient.oldSessionsData);
|
||||
conSessionHistory.labelSessionHistory.Text = "Er zijn geen oude sessies.";
|
||||
}
|
||||
|
||||
conSessionHistory.BringToFront();
|
||||
}
|
||||
public void validateLogin()
|
||||
{
|
||||
string error = "";
|
||||
bool connect = MainClient.Connect(conPanelLogin.textBoxPassword.Text, out error);
|
||||
|
||||
if (connect)
|
||||
{
|
||||
conPanelLogin.textBoxPassword.Text = "";
|
||||
conPanelLogin.labelLoginInfo.Text = "";
|
||||
|
||||
if (MainClient.activesessions.Count > 0)
|
||||
{
|
||||
conActiveSessions.labelActiveSessions.Text = "";
|
||||
conActiveSessions.updateActiveSessions(MainClient.activesessions);
|
||||
}
|
||||
|
||||
showDashboard();
|
||||
}
|
||||
else
|
||||
{
|
||||
conPanelLogin.labelLoginInfo.Text = error;
|
||||
showLoginScreen();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonLogout_Click(object sender, EventArgs e)
|
||||
{
|
||||
MainClient.Disconnect();
|
||||
showLoginScreen();
|
||||
}
|
||||
|
||||
private void showDashboard()
|
||||
{
|
||||
conPanelLogin.Visible = false;
|
||||
MainContainer.Visible = true;
|
||||
panel1.Visible = true;
|
||||
MenuPanel.Visible = true;
|
||||
menuStrip1.Visible = true;
|
||||
}
|
||||
|
||||
private void showLoginScreen()
|
||||
{
|
||||
MainContainer.Visible = false;
|
||||
panel1.Visible = false;
|
||||
MenuPanel.Visible = false;
|
||||
menuStrip1.Visible = false;
|
||||
conPanelLogin.Visible = true;
|
||||
conPanelLogin.BringToFront();
|
||||
}
|
||||
|
||||
private void updateTimer_tick(object sender, EventArgs e)
|
||||
{
|
||||
if (request == 0)
|
||||
MainClient.SendNetCommand(new NetCommand(NetCommand.RequestType.USERS, MainClient.Session));
|
||||
else if (request == 1)
|
||||
MainClient.SendNetCommand(new NetCommand(NetCommand.RequestType.SESSIONDATA, MainClient.Session));
|
||||
else if (request == 2)
|
||||
MainClient.SendNetCommand(new NetCommand(NetCommand.RequestType.ALLSESSIONS, MainClient.Session));
|
||||
|
||||
request ++;
|
||||
if (request > 2)
|
||||
{
|
||||
request = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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="menuStrip1.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>
|
||||
@@ -16,7 +16,7 @@ namespace ErgometerDoctorApplication
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new MainWindow());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+28
-26
@@ -1,17 +1,17 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
// Runtime Version:4.0.30319.0
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ErgometerDoctorApplication.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace ErgometerDoctorApplication.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
@@ -22,50 +22,52 @@ namespace ErgometerDoctorApplication.Properties
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ErgometerDoctorApplication.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap imageDoctor {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("imageDoctor", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
@@ -60,6 +60,7 @@
|
||||
: 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">
|
||||
@@ -68,9 +69,10 @@
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</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="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
@@ -85,9 +87,10 @@
|
||||
<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" 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="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
@@ -109,9 +112,13 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<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 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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="imageDoctor" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\doctorImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,91 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ErgometerDoctorApplication
|
||||
{
|
||||
class SessionPanel : Panel
|
||||
{
|
||||
private int Session;
|
||||
private string name;
|
||||
private bool IsNew;
|
||||
private double timestamp;
|
||||
|
||||
public SessionPanel(int session, string name, bool isNew,double timestamp) : base()
|
||||
{
|
||||
this.timestamp = timestamp;
|
||||
Session = session;
|
||||
this.name = name;
|
||||
IsNew = isNew;
|
||||
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
this.Size = new System.Drawing.Size(180, 100);
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
|
||||
this.Click += SessionPanel_Click;
|
||||
this.MouseEnter += SessionPanel_MouseEnter;
|
||||
this.MouseLeave += SessionPanel_MouseLeave;
|
||||
this.Cursor = Cursors.Hand;
|
||||
|
||||
this.labelTimestamp = new Label();
|
||||
this.labelName = new System.Windows.Forms.Label();
|
||||
|
||||
//
|
||||
// labelActiveSessions
|
||||
//
|
||||
this.labelName.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.labelName.AutoSize = true;
|
||||
this.labelName.Font = new System.Drawing.Font("Segoe UI Semibold", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelName.Location = new System.Drawing.Point(10, 10);
|
||||
this.labelName.ForeColor = System.Drawing.Color.White;
|
||||
this.labelName.Name = "labelActiveSessions";
|
||||
this.labelName.Size = new System.Drawing.Size(103, 21);
|
||||
this.labelName.TabIndex = 3;
|
||||
this.labelName.Text = name;
|
||||
this.labelName.Click += SessionPanel_Click;
|
||||
this.labelName.MouseEnter += SessionPanel_MouseEnter;
|
||||
this.labelName.MouseLeave += SessionPanel_MouseLeave;
|
||||
this.labelName.Cursor = Cursors.Hand;
|
||||
|
||||
this.labelTimestamp.Name = "labelTimeStamp";
|
||||
this.labelTimestamp.Anchor = AnchorStyles.None;
|
||||
this.labelTimestamp.Text = ErgometerLibrary.Helper.MillisecondsToTime(timestamp);
|
||||
this.labelTimestamp.Location = new System.Drawing.Point(10, 40);
|
||||
this.labelTimestamp.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelTimestamp.ForeColor = System.Drawing.Color.White;
|
||||
this.labelTimestamp.Size = new System.Drawing.Size(103, 21);
|
||||
this.labelTimestamp.Click += SessionPanel_Click;
|
||||
this.labelTimestamp.MouseEnter += SessionPanel_MouseEnter;
|
||||
this.labelTimestamp.MouseLeave += SessionPanel_MouseLeave;
|
||||
|
||||
if (isNew)
|
||||
labelTimestamp.Visible = false;
|
||||
|
||||
this.Controls.Add(labelName);
|
||||
this.Controls.Add(labelTimestamp);
|
||||
}
|
||||
|
||||
private void SessionPanel_MouseEnter(object sender, System.EventArgs e)
|
||||
{
|
||||
this.BackColor = System.Drawing.Color.Gray;
|
||||
this.labelName.ForeColor = System.Drawing.Color.WhiteSmoke;
|
||||
labelTimestamp.ForeColor = System.Drawing.Color.WhiteSmoke;
|
||||
}
|
||||
|
||||
private void SessionPanel_MouseLeave(object sender, System.EventArgs e)
|
||||
{
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.labelName.ForeColor = System.Drawing.Color.White;
|
||||
this.labelTimestamp.ForeColor = System.Drawing.Color.White;
|
||||
}
|
||||
|
||||
private void SessionPanel_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
if(IsNew)
|
||||
MainClient.StartNewClient(name, Session);
|
||||
else
|
||||
MainClient.StartOldClient(name, Session);
|
||||
}
|
||||
|
||||
public System.Windows.Forms.Label labelName;
|
||||
public Label labelTimestamp;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user