Beispiel #1
0
        /// <summary>
        /// Create a pair.
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public static CommandResponsePair Create(SyncMLCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }

            CommandResponsePair r = new CommandResponsePair();

            r.command = command;
            r.cmdRef  = command.CmdID.Content;
            return(r);
        }
Beispiel #2
0
        /// <summary>
        /// Marked a command registered with a status code from server.
        /// </summary>
        /// <param name="cmdRef">Index to locate the command to register.</param>
        /// <param name="statusCode">Status code.</param>
        /// <returns>Command if located.</returns>
        public SyncMLCommand RegisterStatus(string cmdRef, string statusCode)
        {
            SyncMLCommand r = null;

            foreach (CommandResponsePair pair in pairs)
            {
                if (pair.CmdRef == cmdRef)
                {
                    pair.StatusCode = statusCode;
                    r = pair.Command;
                    break;
                }
            }

            return(r);
        }
Beispiel #3
0
 /// <summary>
 /// Add a command to the register.
 /// </summary>
 /// <param name="command"></param>
 public void Add(SyncMLCommand command)
 {
     pairs.Add(CommandResponsePair.Create(command));
 }