예제 #1
0
        /// <summary>
        /// Notification callback for getting messages from the clients.
        /// </summary>
        /// <param name="message"></param>
        public void Notify(string message)
        {
            ClientMessage settings = JsonConvert.DeserializeObject <ClientMessage>(message);

            KinectAudioHandler.Initialize(KinectHandler.Instance().SensorChooser.Kinect, settings.Contents);

            //TODO: You can add more code here for notifying more components using client-side messages properly.
        }
예제 #2
0
        /// <summary>
        /// Notification callback for getting messages from the clients.
        /// </summary>
        /// <param name="message"></param>
        public void Notify(string message)
        {
            ClientMessage clientMessage = JsonConvert.DeserializeObject <ClientMessage>(message);
            List <string> contents      = clientMessage.Contents;

            if (clientMessage.MessageType == "Speech")
            {
                KinectAudioHandler.Initialize(this.SensorChooser.Kinect, contents);
            }
            else if (clientMessage.MessageType == "Light")
            {
                try
                {
                    SensorsHandler.Instance().ChangeLight(Convert.ToBoolean(contents[0]), Convert.ToBoolean(contents[1]), Convert.ToBoolean(contents[2]));
                }
                catch (FormatException)
                {
                    Console.Error.WriteLine("Incorrect format from data received from the clients. Data are ignored.");
                }
            }

            //TODO: You can add more code here for notifying more components using client-side messages properly.
        }