public void HandleCommand(NetCommand command) { switch (command.Type) { case NetCommand.CommandType.DATA: 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 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; case NetCommand.CommandType.UITLEG: window.steps.UitlegText.Invoke((MethodInvoker)(() => window.steps.UitlegText.Text = command.UitlegText)); break; case NetCommand.CommandType.PERSONDATA: window.panelClientChat.Invoke(window.panelClientChat.passChatMessage, new Object[] { new ChatMessage("Test", "DATA Gewicht=" + command.Gewicht + " Geslacht=" + command.Geslacht + " Leeftijd=" + command.Leeftijd + " Lengte=" + command.Lengte + ".", false) }); Console.WriteLine("Not fully implemented"); //NOG DOEN break; case NetCommand.CommandType.TESTRESULT: window.panelClientChat.Invoke(window.panelClientChat.passChatMessage, new Object[] { new ChatMessage("Test", "DATA Vo2Max=" + command.VO2Max + " MET=" + command.MET + " PopulationAvg=" + command.PopulationAvg + " Zscore=" + command.ZScore + " Rating=" + command.Rating + ".", false) }); Console.WriteLine("Not fully implemented"); //NOG DOEN break; } }