Correct loading on start. Bugfixes

This commit is contained in:
2015-10-20 23:28:02 +02:00
parent d01ad475a1
commit f41047300f
+12 -4
View File
@@ -96,8 +96,12 @@ namespace ErgometerDoctorApplication
loggedin = true; loggedin = true;
} }
//SendNetCommand(new NetCommand(NetCommand.RequestType.USERS, Session));
SendNetCommand(new NetCommand(NetCommand.RequestType.SESSIONDATA, Session)); SendNetCommand(new NetCommand(NetCommand.RequestType.SESSIONDATA, Session));
Thread.Sleep(15);
SendNetCommand(new NetCommand(NetCommand.RequestType.USERS, Session));
Thread.Sleep(200);
return true; return true;
} }
@@ -105,7 +109,7 @@ namespace ErgometerDoctorApplication
public static void Disconnect() public static void Disconnect()
{ {
if (Server.Connected) if (Server != null && Server.Connected)
{ {
NetHelper.SendNetCommand(Server, new NetCommand(NetCommand.CommandType.LOGOUT, Session)); NetHelper.SendNetCommand(Server, new NetCommand(NetCommand.CommandType.LOGOUT, Session));
loggedin = false; loggedin = false;
@@ -127,7 +131,8 @@ namespace ErgometerDoctorApplication
} }
} }
Server.Close(); if(Server != null)
Server.Close();
} }
private static bool UsersBeingSent = false; private static bool UsersBeingSent = false;
@@ -218,7 +223,10 @@ namespace ErgometerDoctorApplication
public static void SendNetCommand(NetCommand command) public static void SendNetCommand(NetCommand command)
{ {
NetHelper.SendNetCommand(Server, command); if(! NetHelper.SendNetCommand(Server, command))
{
Disconnect();
}
} }
private static bool IsSessionRunning(int session) private static bool IsSessionRunning(int session)