Exemplo n.º 1
0
        internal RemoteCommandDelegate Add(string commandID, string uiType, string uiData)
        {
            var callback = Callback;

            if (!CommandDelegates.ContainsKey(callback))
            {
                var command = new RemoteCommandDelegate(CommandService, commandID, uiType, callback)
                {
                    UIData = uiData
                };
                command.CanExecuteChanged += CompositeRaiseCanExecuteChanged;
                CommandDelegates.Add(callback, command);
                return(command);
            }
            else
            {
                var fault = new RemoteCommandFault
                {
                    Result      = false,
                    Message     = "The Remote Command Of This Client With Same ID Has Already Been Added!",
                    Description = "Invalid CommandID"
                };
                throw new FaultException <RemoteCommandFault>(fault);
            }
        }
 internal RemoteCommandDelegate this[string commandID]
 {
     get
     {
         CompositeRemoteCommand compositeRemoteCommand = null;
         if (Commands.TryGetValue(commandID, out compositeRemoteCommand))
         {
             RemoteCommandDelegate remoteCommand = null;
             if (compositeRemoteCommand.CommandDelegates.TryGetValue(Callback, out remoteCommand))
             {
                 return(remoteCommand);
             }
         }
         return(null);
     }
 }