Implemented user viewing/adding.
Tried to add old sessions (broken).
This commit is contained in:
@@ -13,17 +13,20 @@ namespace ErgometerDoctorApplication
|
|||||||
public int Session { get; }
|
public int Session { get; }
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
|
public bool IsOldData { get; }
|
||||||
|
|
||||||
private SessionWindow window;
|
private SessionWindow window;
|
||||||
|
|
||||||
public List<Meting> Metingen { get; }
|
public List<Meting> Metingen { get; set; }
|
||||||
public List<ChatMessage> Chat { get; }
|
public List<ChatMessage> Chat { get; }
|
||||||
|
|
||||||
public ClientThread(string name, int session)
|
public ClientThread(string name, int session, bool old)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Session = session;
|
Session = session;
|
||||||
|
IsOldData = old;
|
||||||
|
|
||||||
window = new SessionWindow(Name, true, Session, this);
|
window = new SessionWindow(Name, old, Session, this);
|
||||||
window.FormClosed += Window_FormClosed;
|
window.FormClosed += Window_FormClosed;
|
||||||
|
|
||||||
Metingen = new List<Meting>();
|
Metingen = new List<Meting>();
|
||||||
@@ -40,11 +43,14 @@ namespace ErgometerDoctorApplication
|
|||||||
switch (command.Type)
|
switch (command.Type)
|
||||||
{
|
{
|
||||||
case NetCommand.CommandType.DATA:
|
case NetCommand.CommandType.DATA:
|
||||||
lock(Metingen)
|
if (!IsOldData)
|
||||||
{
|
{
|
||||||
Metingen.Add(command.Meting);
|
lock (Metingen)
|
||||||
|
{
|
||||||
|
Metingen.Add(command.Meting);
|
||||||
|
}
|
||||||
|
window.Invoke(window.updateMetingen, new Object[] { command.Meting });
|
||||||
}
|
}
|
||||||
window.Invoke(window.updateMetingen, new Object[] { command.Meting });
|
|
||||||
break;
|
break;
|
||||||
case NetCommand.CommandType.CHAT:
|
case NetCommand.CommandType.CHAT:
|
||||||
ChatMessage chat = new ChatMessage(command.DisplayName, command.ChatMessage, false);
|
ChatMessage chat = new ChatMessage(command.DisplayName, command.ChatMessage, false);
|
||||||
@@ -67,7 +73,14 @@ namespace ErgometerDoctorApplication
|
|||||||
|
|
||||||
private void sendCommand(NetCommand command)
|
private void sendCommand(NetCommand command)
|
||||||
{
|
{
|
||||||
MainClient.SendNetCommand(command);
|
if(! IsOldData)
|
||||||
|
MainClient.SendNetCommand(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandMetingen(List<Meting> metingen)
|
||||||
|
{
|
||||||
|
Metingen = metingen;
|
||||||
|
window.Invoke(window.updateMetingen, new Object[] { new Meting(0,0,0,0,0,0,0,0,0) });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ namespace ErgometerDoctorApplication
|
|||||||
public delegate void UpdateMetingen(Meting m);
|
public delegate void UpdateMetingen(Meting m);
|
||||||
public UpdateMetingen updateMetingen;
|
public UpdateMetingen updateMetingen;
|
||||||
|
|
||||||
public SessionWindow(string ClientName, bool ActiveSessionm, int session, ClientThread parentthread)
|
public SessionWindow(string ClientName, bool old, int session, ClientThread parentthread)
|
||||||
{
|
{
|
||||||
this.ActiveSession = ActiveSession;
|
this.ActiveSession = !old;
|
||||||
this.ClientName = ClientName;
|
this.ClientName = ClientName;
|
||||||
this.client = parentthread;
|
this.client = parentthread;
|
||||||
Session = session;
|
Session = session;
|
||||||
@@ -38,7 +38,8 @@ namespace ErgometerDoctorApplication
|
|||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Form.CheckForIllegalCrossThreadCalls = false;
|
if (!ActiveSession)
|
||||||
|
panelClientChat.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClientApplicatie_Resize(object sender, EventArgs e)
|
public void ClientApplicatie_Resize(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ namespace ErgometerDoctorApplication
|
|||||||
this.Controls.Add(flowlayout);
|
this.Controls.Add(flowlayout);
|
||||||
|
|
||||||
//this.Controls.Add(data);
|
//this.Controls.Add(data);
|
||||||
|
|
||||||
|
updateActiveSessions(MainClient.activesessions);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using ErgometerLibrary;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -9,8 +10,62 @@ namespace ErgometerDoctorApplication
|
|||||||
{
|
{
|
||||||
public class ConClientData : Panel
|
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 ConClientData() : base()
|
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();
|
||||||
|
|
||||||
|
//
|
||||||
|
// buttonLogin
|
||||||
|
//
|
||||||
|
this.buttonCreate.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
|
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(0, -40);
|
||||||
|
this.buttonCreate.Name = "buttonCreate";
|
||||||
|
this.buttonCreate.Size = new System.Drawing.Size(168, 31);
|
||||||
|
this.buttonCreate.TabIndex = 3;
|
||||||
|
this.buttonCreate.Text = "Aanmaken";
|
||||||
|
this.buttonCreate.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
|
||||||
|
//
|
||||||
|
// textBoxPassword
|
||||||
|
//
|
||||||
|
this.textBoxPassword.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
|
this.textBoxPassword.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.textBoxPassword.MaxLength = 16;
|
||||||
|
this.textBoxPassword.Name = "textBoxPassword";
|
||||||
|
this.textBoxPassword.Size = new System.Drawing.Size(167, 20);
|
||||||
|
this.textBoxPassword.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// textBoxUsername
|
||||||
|
//
|
||||||
|
this.textBoxUsername.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
|
this.textBoxUsername.Location = new System.Drawing.Point(0, 40);
|
||||||
|
this.textBoxUsername.MaxLength = 16;
|
||||||
|
this.textBoxUsername.Name = "textBoxUsername";
|
||||||
|
this.textBoxUsername.Size = new System.Drawing.Size(167, 20);
|
||||||
|
this.textBoxUsername.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// listUsers
|
||||||
|
//
|
||||||
|
this.listUsers.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
|
this.listUsers.Location = new System.Drawing.Point(0, 80);
|
||||||
|
this.listUsers.Name = "listUsers";
|
||||||
|
this.listUsers.Size = new System.Drawing.Size(200, 400);
|
||||||
|
this.listUsers.Items.Add("No Users");
|
||||||
|
|
||||||
|
this.Controls.Add(this.listUsers);
|
||||||
|
this.Controls.Add(this.buttonCreate);
|
||||||
|
this.Controls.Add(this.textBoxUsername);
|
||||||
|
this.Controls.Add(this.textBoxPassword);
|
||||||
//
|
//
|
||||||
// ConClientData
|
// ConClientData
|
||||||
//
|
//
|
||||||
@@ -20,7 +75,25 @@ namespace ErgometerDoctorApplication
|
|||||||
this.Size = new System.Drawing.Size(584, 459);
|
this.Size = new System.Drawing.Size(584, 459);
|
||||||
this.TabIndex = 0;
|
this.TabIndex = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.BackColor = System.Drawing.Color.Red;
|
this.BackColor = System.Drawing.Color.Red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
MainClient.SendNetCommand(new NetCommand(textBoxUsername.Text, textBoxPassword.Text, MainClient.Session));
|
||||||
|
MainClient.SendNetCommand(new NetCommand(NetCommand.RequestType.USERS, MainClient.Session));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace ErgometerDoctorApplication
|
|
||||||
{
|
|
||||||
public class ConSessionLibrary : Panel
|
|
||||||
{
|
|
||||||
public ConSessionLibrary() : base()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// ConSessionLibrary
|
|
||||||
//
|
|
||||||
this.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.Name = "ConSessionLibrary";
|
|
||||||
this.Size = new System.Drawing.Size(584, 459);
|
|
||||||
this.TabIndex = 0;
|
|
||||||
|
|
||||||
this.BackColor = System.Drawing.Color.Blue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -83,9 +83,6 @@
|
|||||||
<Compile Include="ConActiveSessions.cs">
|
<Compile Include="ConActiveSessions.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ConSessionLibrary.cs">
|
|
||||||
<SubType>Component</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="MainClient.cs" />
|
<Compile Include="MainClient.cs" />
|
||||||
<Compile Include="MainWindow.cs">
|
<Compile Include="MainWindow.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace ErgometerDoctorApplication
|
|||||||
{
|
{
|
||||||
Server.Connect(HOST, PORT);
|
Server.Connect(HOST, PORT);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
error = "Server is niet online.";
|
error = "Server is niet online.";
|
||||||
return false;
|
return false;
|
||||||
@@ -121,19 +121,31 @@ namespace ErgometerDoctorApplication
|
|||||||
if (Server.Connected && Server.Available > 0)
|
if (Server.Connected && Server.Available > 0)
|
||||||
{
|
{
|
||||||
NetCommand command = NetHelper.ReadNetCommand(Server);
|
NetCommand command = NetHelper.ReadNetCommand(Server);
|
||||||
switch(command.Type)
|
Console.WriteLine(command.Type.ToString());
|
||||||
|
switch (command.Type)
|
||||||
{
|
{
|
||||||
case NetCommand.CommandType.LENGTH:
|
case NetCommand.CommandType.LENGTH:
|
||||||
switch(command.Length)
|
Console.WriteLine(command.Length.ToString() + " : " + command.LengthValue);
|
||||||
|
switch (command.Length)
|
||||||
{
|
{
|
||||||
case NetCommand.LengthType.USERS:
|
case NetCommand.LengthType.USERS:
|
||||||
users.Clear();
|
lock (users)
|
||||||
for(int i=0; i<command.LengthValue; i++)
|
|
||||||
{
|
{
|
||||||
NetCommand c = NetHelper.ReadNetCommand(Server);
|
users.Clear();
|
||||||
if(c.Type == NetCommand.CommandType.USER)
|
for (int i = 0; i < command.LengthValue; i++)
|
||||||
{
|
{
|
||||||
users.Add(c.DisplayName, c.Password);
|
NetCommand c = NetHelper.ReadNetCommand(Server);
|
||||||
|
if (c.Type == NetCommand.CommandType.USER)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
users.Add(c.DisplayName, c.Password);
|
||||||
|
}
|
||||||
|
catch (ArgumentException e)
|
||||||
|
{
|
||||||
|
// ignore double username
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -159,6 +171,21 @@ namespace ErgometerDoctorApplication
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NetCommand.LengthType.DATA:
|
||||||
|
Console.WriteLine(command);
|
||||||
|
List<Meting> metingen = new List<Meting>();
|
||||||
|
for (int i = 0; i < command.LengthValue; i++)
|
||||||
|
{
|
||||||
|
NetCommand c = NetHelper.ReadNetCommand(Server);
|
||||||
|
Console.WriteLine(c);
|
||||||
|
if (c.Type == NetCommand.CommandType.DATA)
|
||||||
|
{
|
||||||
|
metingen.Add(c.Meting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HandMetingenToClient(metingen, command.Session);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new FormatException("Error in NetCommand: Length type is not recognised");
|
throw new FormatException("Error in NetCommand: Length type is not recognised");
|
||||||
}
|
}
|
||||||
@@ -170,7 +197,7 @@ namespace ErgometerDoctorApplication
|
|||||||
HandToClient(command);
|
HandToClient(command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,15 +206,26 @@ namespace ErgometerDoctorApplication
|
|||||||
|
|
||||||
private static void HandToClient(NetCommand command)
|
private static void HandToClient(NetCommand command)
|
||||||
{
|
{
|
||||||
foreach(ClientThread cl in clients)
|
foreach (ClientThread cl in clients)
|
||||||
{
|
{
|
||||||
if(cl.Session == command.Session)
|
if (cl.Session == command.Session)
|
||||||
{
|
{
|
||||||
cl.HandleCommand(command);
|
cl.HandleCommand(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void HandMetingenToClient(List<Meting> metingen, int session)
|
||||||
|
{
|
||||||
|
foreach (ClientThread cl in clients)
|
||||||
|
{
|
||||||
|
if (cl.Session == session)
|
||||||
|
{
|
||||||
|
cl.HandMetingen(metingen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void SendNetCommand(NetCommand command)
|
public static void SendNetCommand(NetCommand command)
|
||||||
{
|
{
|
||||||
NetHelper.SendNetCommand(Server, command);
|
NetHelper.SendNetCommand(Server, command);
|
||||||
@@ -195,7 +233,7 @@ namespace ErgometerDoctorApplication
|
|||||||
|
|
||||||
private static bool IsSessionRunning(int session)
|
private static bool IsSessionRunning(int session)
|
||||||
{
|
{
|
||||||
foreach(ClientThread cl in clients)
|
foreach (ClientThread cl in clients)
|
||||||
{
|
{
|
||||||
if (cl.Session == session)
|
if (cl.Session == session)
|
||||||
return true;
|
return true;
|
||||||
@@ -210,7 +248,24 @@ namespace ErgometerDoctorApplication
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Start new client
|
//Start new client
|
||||||
ClientThread cl = new ClientThread(name, session);
|
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));
|
||||||
|
|
||||||
|
//Start new client
|
||||||
|
ClientThread cl = new ClientThread(name, session, true);
|
||||||
clients.Add(cl);
|
clients.Add(cl);
|
||||||
|
|
||||||
//Run client on new thread
|
//Run client on new thread
|
||||||
|
|||||||
-21
@@ -33,7 +33,6 @@ namespace ErgometerDoctorApplication
|
|||||||
{
|
{
|
||||||
this.MenuPanel = new System.Windows.Forms.Panel();
|
this.MenuPanel = new System.Windows.Forms.Panel();
|
||||||
this.BtnLogout = new System.Windows.Forms.Button();
|
this.BtnLogout = new System.Windows.Forms.Button();
|
||||||
this.BtnSessionLibrary = new System.Windows.Forms.Button();
|
|
||||||
this.BtnSessionHistory = new System.Windows.Forms.Button();
|
this.BtnSessionHistory = new System.Windows.Forms.Button();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
@@ -51,7 +50,6 @@ namespace ErgometerDoctorApplication
|
|||||||
this.conActiveSessions = new ErgometerDoctorApplication.ConActiveSessions();
|
this.conActiveSessions = new ErgometerDoctorApplication.ConActiveSessions();
|
||||||
this.conClientData = new ErgometerDoctorApplication.ConClientData();
|
this.conClientData = new ErgometerDoctorApplication.ConClientData();
|
||||||
this.conSessionHistory = new ErgometerDoctorApplication.ConSessionHistory();
|
this.conSessionHistory = new ErgometerDoctorApplication.ConSessionHistory();
|
||||||
this.conSessionLibrary = new ErgometerDoctorApplication.ConSessionLibrary();
|
|
||||||
this.conPanelLogin = new ErgometerDoctorApplication.ConPanelLogin(this);
|
this.conPanelLogin = new ErgometerDoctorApplication.ConPanelLogin(this);
|
||||||
this.updateTimer = new Timer();
|
this.updateTimer = new Timer();
|
||||||
MainContainer.Visible = false;
|
MainContainer.Visible = false;
|
||||||
@@ -63,7 +61,6 @@ namespace ErgometerDoctorApplication
|
|||||||
//
|
//
|
||||||
this.MenuPanel.BackColor = System.Drawing.SystemColors.ControlLight;
|
this.MenuPanel.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||||
this.MenuPanel.Controls.Add(this.BtnLogout);
|
this.MenuPanel.Controls.Add(this.BtnLogout);
|
||||||
this.MenuPanel.Controls.Add(this.BtnSessionLibrary);
|
|
||||||
this.MenuPanel.Controls.Add(this.BtnSessionHistory);
|
this.MenuPanel.Controls.Add(this.BtnSessionHistory);
|
||||||
this.MenuPanel.Controls.Add(this.label2);
|
this.MenuPanel.Controls.Add(this.label2);
|
||||||
this.MenuPanel.Controls.Add(this.label1);
|
this.MenuPanel.Controls.Add(this.label1);
|
||||||
@@ -92,21 +89,6 @@ namespace ErgometerDoctorApplication
|
|||||||
this.BtnLogout.UseVisualStyleBackColor = false;
|
this.BtnLogout.UseVisualStyleBackColor = false;
|
||||||
this.BtnLogout.Click += new System.EventHandler(this.buttonLogout_Click);
|
this.BtnLogout.Click += new System.EventHandler(this.buttonLogout_Click);
|
||||||
//
|
//
|
||||||
// BtnSessionLibrary
|
|
||||||
//
|
|
||||||
this.BtnSessionLibrary.BackColor = System.Drawing.Color.DarkGray;
|
|
||||||
this.BtnSessionLibrary.Dock = System.Windows.Forms.DockStyle.Top;
|
|
||||||
this.BtnSessionLibrary.FlatAppearance.BorderSize = 0;
|
|
||||||
this.BtnSessionLibrary.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
||||||
this.BtnSessionLibrary.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.BtnSessionLibrary.Location = new System.Drawing.Point(0, 205);
|
|
||||||
this.BtnSessionLibrary.Name = "BtnSessionLibrary";
|
|
||||||
this.BtnSessionLibrary.Size = new System.Drawing.Size(200, 35);
|
|
||||||
this.BtnSessionLibrary.TabIndex = 8;
|
|
||||||
this.BtnSessionLibrary.Text = "Sessie Bibliotheek";
|
|
||||||
this.BtnSessionLibrary.UseVisualStyleBackColor = false;
|
|
||||||
this.BtnSessionLibrary.Click += new System.EventHandler(this.BtnSessionLibrary_Click);
|
|
||||||
//
|
|
||||||
// BtnSessionHistory
|
// BtnSessionHistory
|
||||||
//
|
//
|
||||||
this.BtnSessionHistory.BackColor = System.Drawing.Color.DarkGray;
|
this.BtnSessionHistory.BackColor = System.Drawing.Color.DarkGray;
|
||||||
@@ -262,7 +244,6 @@ namespace ErgometerDoctorApplication
|
|||||||
this.MainContainer.Controls.Add(this.conActiveSessions);
|
this.MainContainer.Controls.Add(this.conActiveSessions);
|
||||||
this.MainContainer.Controls.Add(this.conClientData);
|
this.MainContainer.Controls.Add(this.conClientData);
|
||||||
this.MainContainer.Controls.Add(this.conSessionHistory);
|
this.MainContainer.Controls.Add(this.conSessionHistory);
|
||||||
this.MainContainer.Controls.Add(this.conSessionLibrary);
|
|
||||||
this.MainContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.MainContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.MainContainer.Location = new System.Drawing.Point(200, 102);
|
this.MainContainer.Location = new System.Drawing.Point(200, 102);
|
||||||
this.MainContainer.Name = "MainContainer";
|
this.MainContainer.Name = "MainContainer";
|
||||||
@@ -297,7 +278,6 @@ namespace ErgometerDoctorApplication
|
|||||||
private ToolStripMenuItem editToolStripMenuItem;
|
private ToolStripMenuItem editToolStripMenuItem;
|
||||||
private ToolStripMenuItem viewToolStripMenuItem;
|
private ToolStripMenuItem viewToolStripMenuItem;
|
||||||
private Button BtnActiveSessions;
|
private Button BtnActiveSessions;
|
||||||
private Button BtnSessionLibrary;
|
|
||||||
private Button BtnLogout;
|
private Button BtnLogout;
|
||||||
private Button BtnSessionHistory;
|
private Button BtnSessionHistory;
|
||||||
private Button BtnClientData;
|
private Button BtnClientData;
|
||||||
@@ -311,7 +291,6 @@ namespace ErgometerDoctorApplication
|
|||||||
public ConActiveSessions conActiveSessions;
|
public ConActiveSessions conActiveSessions;
|
||||||
public ConSessionHistory conSessionHistory;
|
public ConSessionHistory conSessionHistory;
|
||||||
public ConClientData conClientData;
|
public ConClientData conClientData;
|
||||||
public ConSessionLibrary conSessionLibrary;
|
|
||||||
public ConPanelLogin conPanelLogin;
|
public ConPanelLogin conPanelLogin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,15 @@ namespace ErgometerDoctorApplication
|
|||||||
{
|
{
|
||||||
public partial class MainWindow : Form
|
public partial class MainWindow : Form
|
||||||
{
|
{
|
||||||
|
private bool request;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
conPanelLogin.BringToFront();
|
conPanelLogin.BringToFront();
|
||||||
updateTimer.Start();
|
request = false;
|
||||||
|
//updateTimer.Start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnActiveSessions_Click(object sender, EventArgs e)
|
private void BtnActiveSessions_Click(object sender, EventArgs e)
|
||||||
@@ -46,22 +50,23 @@ namespace ErgometerDoctorApplication
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnSessionLibrary_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
this.HeaderLabel.Text = "Bibliotheek";
|
|
||||||
conSessionLibrary.BringToFront();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BtnClientData_Click(object sender, EventArgs e)
|
private void BtnClientData_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.HeaderLabel.Text = "Clientenbestand";
|
this.HeaderLabel.Text = "Clientenbestand";
|
||||||
conClientData.BringToFront();
|
conClientData.BringToFront();
|
||||||
|
|
||||||
|
if (MainClient.users.Count > 0)
|
||||||
|
{
|
||||||
|
conClientData.updateUsers(MainClient.users);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnSessionHistory_Click(object sender, EventArgs e)
|
private void BtnSessionHistory_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.HeaderLabel.Text = "Sessie geschiedenis";
|
this.HeaderLabel.Text = "Sessie geschiedenis";
|
||||||
conSessionHistory.BringToFront();
|
conSessionHistory.BringToFront();
|
||||||
|
|
||||||
|
MainClient.StartOldCLient("Test", 2001739555);
|
||||||
}
|
}
|
||||||
public void validateLogin()
|
public void validateLogin()
|
||||||
{
|
{
|
||||||
@@ -108,7 +113,12 @@ namespace ErgometerDoctorApplication
|
|||||||
|
|
||||||
private void updateTimer_tick(object sender, EventArgs e)
|
private void updateTimer_tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MainClient.SendNetCommand(new NetCommand(NetCommand.RequestType.SESSIONDATA, MainClient.Session));
|
if (request)
|
||||||
|
MainClient.SendNetCommand(new NetCommand(NetCommand.RequestType.USERS, MainClient.Session));
|
||||||
|
else
|
||||||
|
MainClient.SendNetCommand(new NetCommand(NetCommand.RequestType.SESSIONDATA, MainClient.Session));
|
||||||
|
|
||||||
|
request = !request;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user