示例#1
0
        /// <summary>
        /// Fired when we get a response from the server
        /// </summary>
        /// <param name="cmd"></param>
        public void OnCommand(Command cmd)
        {
            switch (cmd.MessageId)
            {
                case Command.COMMAND_RECIEVE_SETTINGS:
                    // Parse the settings
                    m_settings = Newtonsoft.Json.JsonConvert.DeserializeObject<RandomColorSettings>(cmd.Message);

                    // Update the UI
                    UpdateRandomColorSettingsUi();
                    break;
            }
        }
示例#2
0
        // Updates the settings given a settings command.
        private void UpdateSettings(Command command)
        {
            // Get the settings from the message
            RandomColorSettings newSettings = Newtonsoft.Json.JsonConvert.DeserializeObject<RandomColorSettings>(command.Message);
            if (newSettings == null)
            {
                return;
            }

            // Set the new settings
            m_settings = newSettings;
        }