Ejemplo n.º 1
0
 public static Meting GetLastMeting()
 {
     if (Metingen.Count > 1)
     {
         return(Metingen.Last());
     }
     else
     {
         return(new Meting(0, 0, 0, 0, 0, 0, 0, 0, 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;

            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");
            }
        }
        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 static Meting SaveMeting(string meting)
        {
            Meting m = null;

            try
            {
                m = Meting.Parse(meting);
            }
            catch (Exception e)
            {
                return(new Meting(0, 0, 0, 0, 0, 0, 0, 0, 0));
            }


            Metingen.Add(m);
            if (Doctor.Connected)
            {
                NetHelper.SendNetCommand(Doctor, new NetCommand(m, Session));
            }

            return(m);
        }
Ejemplo n.º 5
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;
            }
        }
Ejemplo n.º 6
0
 public double GemiddeldeTemp()
 {
     return(Math.Round(Metingen.Sum(e => e.Temperatuur) / 12, 2));
 }
Ejemplo n.º 7
0
 public int TotaleNeerslag()
 {
     return(Metingen.Sum(e => e.Neerslag));
 }