Merge remote-tracking branch 'origin/develop' into develop
Conflicts: ErgometerDoctorApplication/MainWindow.cs
This commit is contained in:
@@ -9,18 +9,57 @@ namespace ErgometerDoctorApplication
|
||||
{
|
||||
public class ConSessionHistory : Panel
|
||||
{
|
||||
private FlowLayoutPanel flowlayout;
|
||||
|
||||
public ConSessionHistory() : base()
|
||||
{
|
||||
//
|
||||
// ConSessionLibrary
|
||||
//
|
||||
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.None;
|
||||
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(0, 50);
|
||||
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.";
|
||||
|
||||
this.BackColor = System.Drawing.Color.Yellow;
|
||||
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;
|
||||
|
||||
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>> actives)
|
||||
{
|
||||
flowlayout.Controls.Clear();
|
||||
|
||||
foreach (Tuple<string,double,int> sessiondata in actives)
|
||||
{
|
||||
flowlayout.Controls.Add(new SessionPanel(sessiondata.Item3, sessiondata.Item1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ErgometerLibrary, Version=1.0.2.8, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="ErgometerLibrary, Version=1.0.3.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\ErgometerLibrary\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll</HintPath>
|
||||
<HintPath>..\..\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ErgometerDoctorApplication
|
||||
//Server information
|
||||
public static List<ClientThread> clients;
|
||||
public static Dictionary<string, string> users;
|
||||
public static List<int> oldsessions;
|
||||
public static List<Tuple<string, double, int>> oldSessionsData;
|
||||
|
||||
public static void RemoveActiveClient(ClientThread clientThread)
|
||||
{
|
||||
@@ -45,8 +45,8 @@ namespace ErgometerDoctorApplication
|
||||
|
||||
clients = new List<ClientThread>();
|
||||
users = new Dictionary<string, string>();
|
||||
oldsessions = new List<int>();
|
||||
activesessions = new Dictionary<int, string>();
|
||||
oldSessionsData = new List<Tuple<string, double, int>>();
|
||||
}
|
||||
|
||||
public static bool Connect(string password, out string error)
|
||||
@@ -157,7 +157,7 @@ namespace ErgometerDoctorApplication
|
||||
UsersLength = command.LengthValue;
|
||||
break;
|
||||
case NetCommand.LengthType.SESSIONS:
|
||||
oldsessions.Clear();
|
||||
oldSessionsData.Clear();
|
||||
SessionsBeingSent = true;
|
||||
SessionsSent = 0;
|
||||
SessionsLength = command.LengthValue;
|
||||
@@ -184,15 +184,6 @@ namespace ErgometerDoctorApplication
|
||||
UsersBeingSent = false;
|
||||
}
|
||||
break;
|
||||
case NetCommand.CommandType.SESSION:
|
||||
if (SessionsBeingSent)
|
||||
{
|
||||
oldsessions.Add(command.Session);
|
||||
SessionsSent++;
|
||||
if (SessionsSent >= SessionsLength)
|
||||
SessionsBeingSent = false;
|
||||
}
|
||||
break;
|
||||
case NetCommand.CommandType.SESSIONDATA:
|
||||
if (ActiveSessionsBeingSent)
|
||||
{
|
||||
@@ -201,6 +192,13 @@ namespace ErgometerDoctorApplication
|
||||
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);
|
||||
|
||||
@@ -13,13 +13,13 @@ namespace ErgometerDoctorApplication
|
||||
{
|
||||
public partial class MainWindow : Form
|
||||
{
|
||||
private bool request;
|
||||
private int request;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
conPanelLogin.BringToFront();
|
||||
request = false;
|
||||
request = 0;
|
||||
updateTimer.Start();
|
||||
|
||||
}
|
||||
@@ -67,7 +67,18 @@ namespace ErgometerDoctorApplication
|
||||
this.HeaderLabel.Text = "Sessie geschiedenis";
|
||||
conSessionHistory.BringToFront();
|
||||
|
||||
MainClient.StartOldCLient("Test", 315896171);
|
||||
//MainClient.StartOldCLient("Test", 1148735907);
|
||||
|
||||
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.";
|
||||
}
|
||||
}
|
||||
public void validateLogin()
|
||||
{
|
||||
@@ -114,12 +125,18 @@ namespace ErgometerDoctorApplication
|
||||
|
||||
private void updateTimer_tick(object sender, EventArgs e)
|
||||
{
|
||||
if (request)
|
||||
if (request == 0)
|
||||
MainClient.SendNetCommand(new NetCommand(NetCommand.RequestType.USERS, MainClient.Session));
|
||||
else
|
||||
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 = !request;
|
||||
request ++;
|
||||
if (request > 2)
|
||||
{
|
||||
request = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user