Example #1
0
        private void EndRead(IAsyncResult ar, CommandStreams state)
        {
            var read = state.StreamReader.EndRead(ar);

            if (read > 0)
            {
                state.StreamWriter.BeginWrite(state.Buffer, 0, read, __EndWrite, state);
            }
            else
            {
                CommandThreads.Run(() => Completing(state));
            }
        }
 private void Execute(object value, ICommand nextCommand)
 {
     for (int i = 0; i < Component.OnExecute.Count; i++)
     {
         var command = Component.OnExecute[i];
         if (command == null || ReferenceEquals(command, nextCommand))
         {
             continue;
         }
         TrySetJobLevel(command);
         TrySetValue(command, value);
         CommandThreads.Run(() => command.Execute());
     }
 }
Example #3
0
        private CommandStreams BeginRead()
        {
            var state = GetStreams();
            var ms    = state.StreamReader as MemoryStream;

            if (ms != null && ms.Length == 0)
            {
                CommandThreads.Run(() => Completing(state));
            }
            else
            {
                state.StreamReader.BeginRead(state.Buffer, 0, state.Buffer.Length, __EndRead, state);
            }
            return(state);
        }
Example #4
0
 private void EndExecuteReader(IAsyncResult ar)
 {
     try
     {
         var state = ar.AsyncState as MssqlCommandState;
         if (state == null)
         {
             return;
         }
         var reader = state.Command.EndExecuteReader(ar);
         state.Reader = reader;
         CommandThreads.Run(() => Completing(state));
     }
     catch (Exception e)
     {
         Finalize(e);
     }
 }