Esempio n. 1
0
 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.STEP:
             int stepID = command.stepID;
             window.panelClientChat.Invoke(window.panelClientChat.passStep, new Object[] { stepID });
             break;
     }
 }
Esempio n. 2
0
 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;
     }
 }
Esempio n. 3
0
 public void AddChatItem(ChatMessage chat)
 {
     flowLayoutPanel1.Controls.Add(new ChatItem(chat));
 }
Esempio n. 4
0
 private static void ParseCommand(NetCommand command)
 {
     switch(command.Type)
     {
         case NetCommand.CommandType.VALUESET:
             ParseValueSet(command);
             break;
         case NetCommand.CommandType.CHAT:
             ChatMessage chat = new ChatMessage(command.DisplayName, command.ChatMessage, true);
             Chat.Add(chat);
             Client.chat.Invoke(Client.chat.passChatMessage, new Object[] { chat });
             break;
         case NetCommand.CommandType.RESPONSE:
             Console.WriteLine(command.Response.ToString());
             break;
         case NetCommand.CommandType.SESSION:
             Session = command.Session;
             break;
         case NetCommand.CommandType.ERROR:
             Console.WriteLine("An error occured, ignoring");
             break;
         default:
             throw new FormatException("Error in Netcommand: Received command not recognized");
     }
 }
 private static void ParseCommand(NetCommand command)
 {
     switch(command.Type)
     {
         case NetCommand.CommandType.VALUESET:
             ParseValueSet(command);
             break;
         case NetCommand.CommandType.CHAT:
             ChatMessage chat = new ChatMessage(command.DisplayName, command.ChatMessage, true);
             Chat.Add(chat);
             Client.chat.Invoke(Client.chat.passChatMessage, new Object[] { chat });
             break;
         case NetCommand.CommandType.RESPONSE:
             Console.WriteLine(command.Response.ToString());
             break;
         case NetCommand.CommandType.SESSION:
             Session = command.Session;
             break;
         case NetCommand.CommandType.ERROR:
             Console.WriteLine("An error occured, ignoring");
             break;
         case NetCommand.CommandType.SESSIONDATA:
             if (SessionsBeingSent)
             {
                 oldSessionsData.Add(new Tuple<string, double, int>(command.DisplayName, command.Timestamp, command.Session));
                 SessionsSent++;
                 //if (SessionsSent >= SessionsLength)
                 //    SessionsBeingSent = false;
             }
             break;
         case NetCommand.CommandType.DATA:
             lock (Metingen)
             {
                 Metingen.Add(command.Meting);
             }
             //window.Invoke(window.updateMetingen, new Object[] { command.Meting });
             break;
         default:
             throw new FormatException("Error in Netcommand: Received command not recognized");
     }
 }